微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在64位ubuntu上编译32位应用程序

如何解决在64位ubuntu上编译32位应用程序

我正在尝试构建NASA cFS版本6.5,该版本在运行Ubuntu的64位Jetson TX2上使用32位应用程序。

我遇到错误"gcc: error: unrecognized command line option -m32"

我尝试安装gcc-multilib,但得到:

Package gcc-multilib is not available,but is referred to by another package. This may mean that the package is missing,has been obsoleted,or is only available from another source

我尝试使用apt search gcc-multilib寻找其他软件包,并安装了: gcc-multilib-arm-linux-gnueabi gcc-multilib-arm-linux-gnueabihf gcc-multilib-x86-64-linux-gnu gcc-multilib-x86-64-linux-gnux32

我知道有些可能不需要安装,但是我到处寻找解决方案,但是找不到任何解决方法

我尝试取消注释sources.list中的所有行,运行sudo apt-get update,然后尝试安装,但仍然没有成功。

有帮助吗?

编辑:

好的,所以我从具有cmake的文件删除了-m32选项,并尝试进行编译,但出现了很多错误,从typedef错误到missing;和其他,因为它们可能超过100个错误,所以不会列出所有错误,但是我得到的第一个错误是: /home/deployer/CFS-101.initial/osal/src/os/inc/common_types.h:285:5: error: #error undefined processor

所以我去了common_types.h,它包含了以下内容

#ifndef _common_types_
#define _common_types_

#ifdef __cplusplus
   extern "C" {
#endif

/*
** Includes
*/

/*
** Macro DeFinitions
*/

/* 
** Condition = TRUE is ok,Condition = FALSE is error 
*/
#define CompileTimeAssert(Condition,Message) typedef char Message[(Condition) ? 1 : -1]


/*
** Define compiler specific macros
** The __extension__ compiler pragma is required
** for the uint64 type using GCC with the ANSI C90 standard.
** Other macros can go in here as needed,for example alignment 
** pragmas.
**
** NOTE: The white-Box (coverage) unit testing may need to disable
** these extra attributes.  These test builds define the OSAPI_NO_SPECIAL_ATTRIBS
** macro to disable this.
*/
#if defined (__GNUC__) && !defined(OSAPI_NO_SPECIAL_ATTRIBS)
   #define _EXTENSION_     __extension__
   #define OS_PACK         __attribute__ ((packed))
   #define OS_ALIGN(n)     __attribute__((aligned(n)))
   #define OS_USED         __attribute__((used))
   #define OS_PRINTF(n,m)  __attribute__ ((format (printf,n,m)))
#else
   #define _EXTENSION_ 
   #define OS_PACK
   #define OS_ALIGN(n) 
   #define OS_USED 
   #define OS_PRINTF(n,m)
#endif

/*
 * If the host system has a ISO C99 standard stdint header file,prefer it.
 * This ensures that fixed-width types are correct including on 64-bit systems.
 */
#if defined(_HAVE_STDINT_)

#include <stdint.h>
#include <stddef.h>
/*
 * NOTE - NOT DEFINING STRUCT_LOW_BIT_FirsT or STRUCT_HIGH_BIT_FirsT
 * We should not make assumptions about the bit order here
 */

  typedef uint8_t                               osalbool;
  typedef int8_t                                int8;
  typedef int16_t                               int16;
  typedef int32_t                               int32;
  typedef int64_t                               int64;
  typedef uint8_t                               uint8;
  typedef uint16_t                              uint16;
  typedef uint32_t                              uint32;
  typedef uint64_t                              uint64;
  typedef intptr_t                              intptr;
  typedef uintptr_t                             cpuaddr;
  typedef size_t                                cpusize;
  typedef ptrdiff_t                             cpudiff;

/*
 * Fall back to default integer type maps -
 * These deFinitions assume a 32-bit processor
 */
#elif defined(_ix86_) || defined (__i386__)
/* ----------------------- Intel x86 processor family -------------------------*/
  /* Little endian */
  #undef   _STRUCT_HIGH_BIT_FirsT_
  #define  _STRUCT_LOW_BIT_FirsT_

  typedef unsigned char                         osalbool;
  typedef signed char                           int8;
  typedef short int                             int16;
  typedef long int                              int32;
 _EXTENSION_ typedef long long int              int64; 
  typedef unsigned char                         uint8;
  typedef unsigned short int                    uint16;
  typedef unsigned long int                     uint32;
  _EXTENSION_ typedef unsigned long long int    uint64;

  typedef unsigned long int                     cpuaddr;
  typedef unsigned long int                     cpusize;
  typedef long int                              cpudiff;

#elif defined (_ix64_) || defined (__x86_64__) 
/* ----------------------- Intel/AMD x64 processor family -------------------------*/
  /* Little endian */
  #undef   _STRUCT_HIGH_BIT_FirsT_
  #define  _STRUCT_LOW_BIT_FirsT_

  typedef unsigned char                         osalbool;
  typedef signed char                           int8;
  typedef short int                             int16;
  typedef int                                   int32;
  typedef long int                              int64;
  typedef unsigned char                         uint8;
  typedef unsigned short int                    uint16;
  typedef unsigned int                          uint32;
  typedef unsigned long int                     uint64;

  typedef unsigned long int                     cpuaddr;
  typedef unsigned long int                     cpusize;
  typedef long int                              cpudiff;

#elif defined(__PPC__) || defined (__ppc__)
   /* ----------------------- Motorola Power PC family ---------------------------*/
   /* The PPC can be programmed to be big or little endian,we assume native */
   /* Big endian */
   #define _STRUCT_HIGH_BIT_FirsT_
   #undef  _STRUCT_LOW_BIT_FirsT_

   typedef unsigned char                        osalbool;
   typedef signed char                          int8;
   typedef short int                            int16;
   typedef long int                             int32;
   _EXTENSION_ typedef long long int            int64;
   typedef unsigned char                        uint8;
   typedef unsigned short int                   uint16;
   typedef unsigned long int                    uint32;
   _EXTENSION_ typedef unsigned long long int   uint64;

   typedef unsigned long int                     cpuaddr;
   typedef unsigned long int                     cpusize;
   typedef long int                              cpudiff;

#elif defined(_m68k_) || defined(__m68k__)
   /* ----------------------- Motorola m68k/Coldfire family ---------------------------*/
   /* Big endian */
   #define _STRUCT_HIGH_BIT_FirsT_
   #undef  _STRUCT_LOW_BIT_FirsT_

   typedef unsigned char                        osalbool;
   typedef signed char                          int8;
   typedef short int                            int16;
   typedef long int                             int32;
   _EXTENSION_ typedef long long int            int64;
   typedef unsigned char                        uint8;
   typedef unsigned short int                   uint16;
   typedef unsigned long int                    uint32;
   _EXTENSION_ typedef unsigned long long int   uint64;

   typedef unsigned long int                     cpuaddr;
   typedef unsigned long int                     cpusize;
   typedef long int                              cpudiff;

#elif defined (__ARM__) || defined(__arm__)
/* ----------------------- ARM processor family -------------------------*/
  /* Little endian */
  #undef   _STRUCT_HIGH_BIT_FirsT_
  #define  _STRUCT_LOW_BIT_FirsT_

  typedef unsigned char                         osalbool;
  typedef signed char                           int8;
  typedef short int                             int16;
  typedef long int                              int32;
  _EXTENSION_ typedef long long int             int64;
  typedef unsigned char                         uint8;
  typedef unsigned short int                    uint16;
  typedef unsigned long int                     uint32;
  _EXTENSION_ typedef unsigned long long int    uint64;

  typedef unsigned long int                     cpuaddr;
  typedef unsigned long int                     cpusize;
  typedef long int                              cpudiff;

#elif defined(__SPARC__) || defined (_sparc_)
   /* ----------------------- SPARC/LEON family ---------------------------*/
   /* SPARC Big endian */
   #define _STRUCT_HIGH_BIT_FirsT_
   #undef  _STRUCT_LOW_BIT_FirsT_

   typedef unsigned char                        osalbool;
   typedef signed char                          int8;
   typedef short int                            int16;
   typedef long int                             int32;
   _EXTENSION_ typedef long long int            int64;
   typedef unsigned char                        uint8;
   typedef unsigned short int                   uint16;
   typedef unsigned long int                    uint32;
   _EXTENSION_ typedef unsigned long long int   uint64;

   typedef unsigned long int                     cpuaddr;
   typedef unsigned long int                     cpusize;
   typedef long int                              cpudiff;

#else  /* not any of the above */
   #error undefined processor
#endif  /* processor types */

/*
 * Boolean type for compatibility --
 *
 * Note it is a bad idea to typedef "bool" or "boolean" -- MANY other projects
 * and libraries also define a boolean type due to the lack of a standard bool in C89.
 * But calling it simply "bool" or "boolean" almost guarantees a namespace conflict
 * if trying to use OSAL with one of those other existing projects.
 *
 * RTEMS 4.11 no longer defines boolean type by default (deprecated) probably also
 * due to the high likelihood of name conflicts.
 *
 * In order to preserve compatibility for apps written against prior versions of
 * OSAL,the name "boolean" is typedefed as well,but this may be turned off
 * in a future version whenever appropriate.
 */

#if (!defined(_USING_RTEMS_INCLUDES_) || !defined(RTEMS_DEPRECATED_TYPES))
  typedef osalbool boolean;
#endif


#ifndef NULL              /* pointer to nothing */
   #define NULL ((void *) 0)
#endif

#ifndef TRUE              /* Boolean true */
   #define TRUE (1)
#endif

#ifndef FALSE              /* Boolean false */
   #define FALSE (0)
#endif

/* 
** Check Sizes 
*/
CompileTimeAssert(sizeof(uint8)==1,TypeUint8WrongSize);
CompileTimeAssert(sizeof(uint16)==2,TypeUint16WrongSize);
CompileTimeAssert(sizeof(uint32)==4,TypeUint32WrongSize);
CompileTimeAssert(sizeof(uint64)==8,TypeUint64WrongSize);
CompileTimeAssert(sizeof(int8)==1,Typeint8WrongSize);
CompileTimeAssert(sizeof(int16)==2,Typeint16WrongSize);
CompileTimeAssert(sizeof(int32)==4,Typeint32WrongSize);
CompileTimeAssert(sizeof(int64)==8,Typeint64WrongSize);
CompileTimeAssert(sizeof(cpuaddr) >= sizeof(void *),TypePtrWrongSize);

/*
 * TEMPORARY COMPATIBILITY MACRO
 *
 * Any code that depends on this macro should be fixed so as to not need it.
 * The value for this had been set by the BSP makefiles but this is not reliable,* especially on processors that support both big- and little- endian modes e.g.
 * ARM and MIPS.
 *
 * This is deprecated and only here to bridge the gap until code that depends
 * on this can be fixed.  Do not write any new code that uses this macro.
 *
 * If using an older makefile that defines one of the BIT_ORDER macros already,* then this entire section is skipped and the macro is used as-is.
 */
#if !defined(SOFTWARE_BIG_BIT_ORDER) && !defined(SOFTWARE_LITTLE_BIT_ORDER)

#if defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN || \
    defined(__BIG_ENDIAN__) || \
    defined(__ARMEB__) || \
    defined(__THUMBEB__) || \
    defined(__AARCH64EB__) || \
    defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__)
/* It is a big-endian target architecture */
#define SOFTWARE_BIG_BIT_ORDER
#elif defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN || \
    defined(__LITTLE_ENDIAN__) || \
    defined(__ARMEL__) || \
    defined(__THUMBEL__) || \
    defined(__AARCH64EL__) || \
    defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__)
/* It is a little-endian target architecture */
#define SOFTWARE_LITTLE_BIT_ORDER
#endif

#endif /* !defined(SOFTWARE_BIG_BIT_ORDER) && !defined(SOFTWARE_LITTLE_BIT_ORDER) */

#ifdef __cplusplus
   }
#endif

#endif  /* _common_types_ */

我尝试检查是否有stdint.h和stddef.h,结果是,但是我不知道为什么 HAVE_STDINT 没有定义。另外,没有情况可以检查 aarch64 这是我的机器,所以我更改了

#if defined(_HAVE_STDINT_)

#if defined(_HAVE_STDINT_) || defined(__arch64__)

我尝试编译,并且它编译了大多数工具,但随后出现此错误

Source file 'to_config.o' contains objects of class type 'ELFCLASS64 (2)' which is unsupported by this utility 

我猜想是因为我删除了elf2cfetbl工具的-m32标志。

有帮助吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?