linux – 编译gcc 4.6.2(不能计算对象文件的后缀)

前端之家收集整理的这篇文章主要介绍了linux – 编译gcc 4.6.2(不能计算对象文件的后缀)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
编译 gcc 4.6.2时出现问题:
checking for avr-gcc... /data/data6/soft/src_build/gcc-4.6.2/host-x86_64-unknown-linux-gnu/gcc/xgcc -B/data/data6/soft/src_build/gcc-4.6.2/host-x86_64-unknown-linux-gnu/gcc/ -B/data/data6/soft/programming/gcc-avr/avr/bin/ -B/data/data6/soft/programming/gcc-avr/avr/lib/ -isystem /data/data6/soft/programming/gcc-avr/avr/include -isystem /data/data6/soft/programming/gcc-avr/avr/sys-include 
checking for suffix of object files... configure: error: in `/data/data6/soft/src_build/gcc-4.6.2/avr/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.

在我的gcc-4.6.2 / avr / libgcc / config.log中我发现:

configure:3268: /data/data6/soft/src_build/gcc-4.6.2/host-x86_64-unknown-linux-gnu/gcc/xgcc -B/data/data6/soft/src_build/gcc-4.6.2/host-x86_64-unknown-linux-gnu/gcc/ -B/data/data6/soft/programming/gcc-avr/avr/bin/ -B/data/data6/soft/programming/gcc-avr/avr/lib/ -isystem /data/data6/soft/programming/gcc-avr/avr/include -isystem /data/data6/soft/programming/gcc-avr/avr/sys-include -c -g -O2 conftest.c >&5
exec: 89: -o: not found
configure:3272: $? = 1
configure: Failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h. */
| 
| int
| main ()
| {
| 
| ;
| return 0;
| }
configure:3286: error: in `/data/data6/soft/src_build/gcc-4.6.2/avr/libgcc':
configure:3289: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.

如果这个命令直接运行(在创建conftest.c之后)输出将是一样的.

什么是exec:89:-o:找不到?哪个程序写? 89线在哪里?

像导出LD_CONFIG_PATH或者在/etc/ld.so.conf中添加行的方案,其中包含GMP,MPFR,MPC的路径对我而言无效.

哪里找到解决这个问题的办法?

更新.看来是配置问题. Gcc有非常好的选择-v :-)而且我看到这是gcc的汇编程序调用,它失败了.使用选项-save-temps我保存汇编源,并运行汇编程序,但它没关系.

而不是调用实际的汇编器,它调用shell脚本包装器,在我的case / data / data6 / soft / src_build / avr-gcc / gcc / as中,它从

ORIGINAL_AS_FOR_TARGET=""
ORIGINAL_LD_FOR_TARGET=""
ORIGINAL_PLUGIN_LD_FOR_TARGET=""
ORIGINAL_NM_FOR_TARGET=""

当它形成命令行调用时,我们有:

exec -o conftest.o conftest.s

其如上所述失败.

哪里有必要解决这个问题?要得到这样的电话:
exec as -o conftest.o conftest.s

哪里好的地方可以设置变量ORIGINAL_AS_FOR_TARGET?

解决方法

我有同样的问题交叉编译为mips.

第一步:交叉编译用于您的目标的binutils.把它们安装在某个地方.我使用/usr/local / [target] -gcc

确保使用–program-prefix = [target]配置 –

(未经测试):

configure --prefix=/usr/local/avr-gcc --program-prefix=avr- --target=avr

那么你需要设置一些环境变量,所以GCC可以找到它们:

export AR_FOR_TARGET=/usr/local/avr-gcc/bin/avr-ar
export LD_FOR_TARGET=/usr/local/avr-gcc/bin/avr-ld
export OBJDUMP_FOR_TARGET=/usr/local/avr-gcc/bin/avr-objdump
export NM_FOR_TARGET=/usr/local/avr-gcc/bin/avr-nm
export RANLIB_FOR_TARGET=/usr/local/avr-gcc/bin/avr-ranlib
export READELF_FOR_TARGET=/usr/local/avr-gcc/bin/avr-readelf
export STRIP_FOR_TARGET=/usr/local/avr-gcc/bin/avr-strip
export AS_FOR_TARGET=/usr/local/avr-gcc/bin/avr-as

现在您可以配置和编译GCC.确保从一个完全空的构建目录开始,否则不会重新创建gcc / as等.

原文链接:https://www.f2er.com/linux/400269.html

猜你在找的Linux相关文章