Gcc 代码源ARM交叉编译

Gcc 代码源ARM交叉编译,gcc,cross-compiling,Gcc,Cross Compiling,编译一个简单的测试。c: #include <stdio.h> void main() { printf("Hello World!\n"); while(1); } 但如果我使用Ubuntu(12.04 LTS 32位)的arm gcc: armlinuxgnueabigcc-static-omytest.c arm-linux-gnueabi-gcc -v Using built-in specs. COLLECT_GCC=arm-linux-gnueabi-gcc

编译一个简单的测试。c:

#include <stdio.h>

void main() {
  printf("Hello World!\n");
  while(1);
}
但如果我使用Ubuntu(12.04 LTS 32位)的arm gcc:

armlinuxgnueabigcc-static-omytest.c

arm-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabi/4.6/lto-wrapper
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/arm-linux-gnueabi/include/c++/4.6.3 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-float=softfp --with-fpu=vfpv3-d16 --with-mode=thumb --disable-werror --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=arm-linux-gnueabi --program-prefix=arm-linux-gnueabi- --includedir=/usr/arm-linux-gnueabi/include --with-headers=/usr/arm-linux-gnueabi/include --with-libs=/usr/arm-linux-gnueabi/lib
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 
生成输出文件时没有错误

有人能解释一下吗

我最好的推荐人(但我仍然没有成功):


arm none eabi gcc是一款针对裸机arm的编译器。也就是说,在没有操作系统的arm处理器上运行,或者在自己制作操作系统的arm处理器上运行。该编译器包含newlib C库,它将为您提供大部分标准C库,但您必须提供低级实现(例如,printf()实际打印的地方、内存管理、文件系统(如果需要)。简言之,您需要自行引导处理器、C运行时并加载生成的代码(请参见问题))


arm-linux-gnueabi-gcc是一个针对在arm上运行的linux的编译器,这个工具链将使用熟悉的glibc库和头文件生成在linux上运行的可执行文件。

哦,是的,这解释了问题的第二部分。但我仍然无法成功编译简单的VersatilePB QEMU arm模拟器二进制文件。我该怎么说呢?@PeterTech我不太清楚你的意思,如果你是说为什么你的1。选项不链接,这是因为您需要实现相当多的低级功能,因为您是为不运行任何操作系统的目标编译的。因此,您需要坐下来,根据现有(或正在仿真的)arm处理器的数据表编写许多低级函数的实现。(这是一个很小的例子,但是如果你想显示文本,你需要编写一个显示驱动程序,或者UART驱动程序)太好了!谢谢你的回答,现在我对:-)有了更好的理解。我想我看到了这个链接:它完整地实现了很多低级的东西。
arm-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabi/4.6/lto-wrapper
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/arm-linux-gnueabi/include/c++/4.6.3 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-float=softfp --with-fpu=vfpv3-d16 --with-mode=thumb --disable-werror --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=arm-linux-gnueabi --program-prefix=arm-linux-gnueabi- --includedir=/usr/arm-linux-gnueabi/include --with-headers=/usr/arm-linux-gnueabi/include --with-libs=/usr/arm-linux-gnueabi/lib
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)