Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 在64位ubuntu上编译32位应用程序_C_Gcc_Cross Compiling_Cfs - Fatal编程技术网

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

C 在64位ubuntu上编译32位应用程序,c,gcc,cross-compiling,cfs,C,Gcc,Cross Compiling,Cfs,我正在尝试构建NASA cFS版本6.5,它在运行Ubuntu的64位Jetson TX2上使用32位应用程序 我得到的错误是“gcc:error:unrecognized命令行选项-m32” 我尝试安装gcc multilib,但我得到: 包gcc multilib不可用,但被另一个包引用。这可能意味着该软件包丢失、已过时或只能从其他来源获得 我尝试使用apt search gcc multilib查找其他软件包,并安装了: gcc多库arm linux gnueabi gcc多库arm li

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

我得到的错误是“gcc:error:unrecognized命令行选项-m32”

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

包gcc multilib不可用,但被另一个包引用。这可能意味着该软件包丢失、已过时或只能从其他来源获得

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

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

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

有什么帮助吗

编辑:

好的,所以我从拥有它的cmake文件中删除了-m32选项,并尝试编译,我得到了一大堆错误,从typedef erorrs到missing;还有一些,我不会列出所有的错误,因为它们可能有100多个错误,但我得到的第一个错误是:
/home/deployer/CFS-101.initial/osal/src/os/inc/common_-types.h:285:5:error:#error未定义处理器

所以我选择了普通的_类型。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_ */

我尝试编译,它编译了大多数工具,但后来我遇到了以下错误:

Source file 'to_config.o' contains objects of class type 'ELFCLASS64 (2)' which is unsupported by this utility 
我猜发生这个错误是因为我删除了elf2cfetbl工具的-m32标志


有什么帮助吗?

gcc文档没有提到ARM的
-m32
。您可能应该修复损坏的生成系统文件,这些文件导致使用对您的目标无效的标志调用gcc。我尝试从生成文件中删除-m32标志,但其中一些工具在执行此操作时无法生成。它在源代码中给了我很多错误。我尝试在安装了gcc multilib的ubuntuvm上构建CFS,它工作正常,所以代码没有问题。在这种情况下,我能做什么呢?
-m32
标志只适用于某些平台,请参阅,因此它在Ubuntu虚拟机(可能是x86-64)上工作而不在ARM机器上工作也就不足为奇了。如果需要帮助修复这些错误,您必须解释这些“许多错误”是什么。我刚刚编辑了这个问题。在arm上获取32位代码的通常方法是使用
-march=armv7
或其他一些32位体系结构变体。我会尝试用
-march=armv7
替换
-m32
,看看会发生什么。gcc文档没有提到ARM的
-m32
。您可能应该修复损坏的生成系统文件,这些文件导致使用对您的目标无效的标志调用gcc。我尝试从生成文件中删除-m32标志,但其中一些工具在执行此操作时无法生成。它在源代码中给了我很多错误。我尝试在安装了gcc multilib的ubuntuvm上构建CFS,它工作正常,所以代码没有问题。在这种情况下,我能做什么呢?
-m32
标志只适用于某些平台,请参阅,因此它在Ubuntu虚拟机(可能是x86-64)上工作而不在ARM机器上工作也就不足为奇了。如果需要帮助修复这些错误,您必须解释这些“许多错误”是什么。我刚刚编辑了这个问题。在arm上获取32位代码的通常方法是使用
-march=armv7
或其他一些32位体系结构变体。我会尝试用
-march=armv7
替换
-m32
,看看会发生什么。
#if defined(_HAVE_STDINT_) || defined(__arch64__)
Source file 'to_config.o' contains objects of class type 'ELFCLASS64 (2)' which is unsupported by this utility