使用交叉编译器为 arm 编译本机 GCC [英] compiling native GCC for arm using cross-compiler

查看:36
本文介绍了使用交叉编译器为 arm 编译本机 GCC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望为 ARM 系统创建本机构建的 GCC,但遇到了一些麻烦.构建机器是 i686-linux.我看到的每个教程都告诉我如何设置实际的交叉编译套件(我已经使用 crosstools-ng 完成了).但是,我没有看到与编译本机 ARM GCC 相关的任何内容.我使用的配置字符串如下,我只设置了带有标题的 sysroot.我也交叉编译安装了GMP和MPFR.

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 会建立一段时间,但随后会死掉:

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.

我不确定这会如何在我的系统上运行,因为我在 i686-linux 上构建并且目标/主机都是 arm-linux.我现在的想法是找到一个 ltib 发行版并查看 GCC 的规范文件并尝试执行所有步骤.由于与 std 命名空间冲突,ltib 为我的电路板提供的 GCC 无法在我的系统上编译.

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!

推荐答案

查看 config.log 文件(可能不是顶级文件),看看它在测试失败时尝试做什么.只需为 cannot compute suffix 消息 grep,你应该找到正确的位(它不会在文件的末尾).

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).

请注意,如果您想构建跨本机工具链,您需要在路径上的某个位置使用一个有效的 arm-unknown-linux-gnueabi-gcc.IE.你需要一个交叉编译器来构建跨原生编译器.

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.

这篇关于使用交叉编译器为 arm 编译本机 GCC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆