使用交叉编译器为arm编译原生GCC
我正在寻找为 ARM 系统创建 GCC 的本机版本,但遇到了一些麻烦。构建机器是 i686-linux。我看到的每个教程都告诉我如何设置实际的交叉编译套件(我已经使用 crosstools-ng 完成了)。但是,我没有看到任何与编译本机 ARM GCC 相关的内容。我使用的配置字符串如下,我仅使用标头设置了 sysroot。我还交叉编译并安装了 GMP 和 MPFR。
../../gcc-4.3.5/configure \
--host=arm-unknown-linux-gnueabi \
--build=i686-build_pc-linux-gnu \
--target=arm-unknown-linux-gnueabi \
--prefix=/home/vm/gcc-native/sysroot \
--with-sysroot=/home/vm/gcc-native/sysroot \
--enable-shared --enable-threads --disable-libmudflap --disable-libssp \
--disable-libgomp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld \
--enable-languages=c,c++ --enable-symvers=gnu --enable-__cxa_atexit \
--disable-nls --disable-multilib \
--with-gmp=/home/vm/gcc-native/sysroot/ \
--with-mpfr=/home/vm/gcc-native/sysroot/
GCC 将构建一段时间,但随后就会消亡:
正在检查目标文件的后缀...配置:错误:无法计算目标文件的后缀:无法编译。
我不确定这将如何在我的系统上运行,因为我是在 i686-linux 上构建的,并且目标/主机都是 arm-linux。我现在的想法是找到一个 ltib 发行版并查看 GCC 的规范文件并尝试遵循所有步骤。由于与 std 命名空间冲突,ltib 为我的主板附带的 GCC 无法在我的系统上编译。
任何信息/链接将不胜感激!
I am looking to create a native build of GCC for an ARM system and I am running into some trouble. The build machine is i686-linux. Every tutorial I see tells me how to set up the actual cross compiling suite (which I have already done using crosstools-ng). However, I don't see anything related to compiling native ARM GCC. The configure string I used is below, I have set up the sysroot only with headers. I have also cross-compiled and installed GMP and MPFR.
../../gcc-4.3.5/configure \
--host=arm-unknown-linux-gnueabi \
--build=i686-build_pc-linux-gnu \
--target=arm-unknown-linux-gnueabi \
--prefix=/home/vm/gcc-native/sysroot \
--with-sysroot=/home/vm/gcc-native/sysroot \
--enable-shared --enable-threads --disable-libmudflap --disable-libssp \
--disable-libgomp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld \
--enable-languages=c,c++ --enable-symvers=gnu --enable-__cxa_atexit \
--disable-nls --disable-multilib \
--with-gmp=/home/vm/gcc-native/sysroot/ \
--with-mpfr=/home/vm/gcc-native/sysroot/
GCC will build for a while but then dies with this:
checking for suffix of object files... configure: error: cannot compute suffix of object files: cannot compile.
I am not sure how this would even run on my system as I am building on i686-linux and the target/host are both arm-linux. My thought right now is to find a ltib distro and looking at a spec file for GCC and trying to follow all of the steps. The GCC that ltib shipped with for my board fails to compile on my system due to conflicts with the std namespace.
Any info/links would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 config.log 文件(可能不是顶级文件)并查看测试失败时它尝试执行的操作。只需 grep 查找
cannotcomputesuffix
消息,您应该找到正确的位(它不会位于文件末尾)。请注意,如果您想构建跨本机工具链,则在路径上的某个位置需要有一个可用的
arm-unknown-linux-gnueabi-gcc
。即你需要一个交叉编译器来构建跨本机编译器。Look in the config.log file (maybe not the top-level one) and see what it was trying to do when the test failed. Just grep for the
cannot compute suffix
message and you should find the right bit (it won't be at the end of the file).Note that you'll need a working
arm-unknown-linux-gnueabi-gcc
on your path somewhere if you want to build a cross-native toolchain. I.e. you need a cross compiler to build cross-native compiler.