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

相关文章

1、安装Apache。 1)执行如下命令,安装Apache服务及其扩展包...
一、先说一下用ansible批量采集机器信息的实现办法: 1、先把...
安装配置 1. 安装vsftpd 检查是否安装了vsftpd # rpm -qa | ...
如何抑制stable_secret读取关键的“net.ipv6.conf.all.stabl...
1 删除0字节文件 find -type f -size 0 -exec rm -rf {} ...
## 步骤 1:安装必要的软件包 首先,需要确保系统已安装 `dh...