编译gcc 4.6.2(无法计算目标文件的后缀) [英] Compilation gcc 4.6.2 (cannot compute suffix of object files)

查看:421
本文介绍了编译gcc 4.6.2(无法计算目标文件的后缀)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编译gcc 4.6.2时出现问题:

 检查avr-gcc ... / data / data6 / src_build / gcc-4.6.2 / host-x86_64-unknown-linux-gnu / gcc / xgcc -b / data / data6 / soft / src_build / gcc-4.6.2 / -B / data / data6 / soft / programming / gcc-avr / avr / bin / -B / data / data6 / soft / programming / gcc-avr / avr / lib /-系统/ data / data6 /软/ -avr / avr / include -isystem / data / data6 / soft / programming / gcc-avr / avr / sys-include 
检查目标文件的后缀... configure:error:in`/ data / data6 /软/ src_build / gcc-4.6.2 / avr / libgcc':
configure:错误:无法计算目标文件的后缀:无法编译
更多详细信息,请参见`config.log'。



在我的gcc-4.6.2 / avr / libgcc / config.log中找到:

 配置: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 / -avr / avr / sys-include -c -g -O2 conftest.c>& 5 
exec:89:-o:not found
configure:3272:$? = 1
configure:失败的程序是:
| / * confdefs.h * /
| #define PACKAGE_NAMEGNU C Runtime Library
| #define PACKAGE_TARNAMElibgcc
| #define PACKAGE_VERSION1.0
| #define PACKAGE_STRINGGNU 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:无法计算目标文件的后缀:不能编译
更多细节参见`config.log'。如果此命令直接运行(创建conftest.c之后),则输出将是相同的。

如果此命令直接运行(在创建conftest.c之后),则



什么是exec:89:-o:not found?哪个程序写呢?在哪里89行?



解决方案如导出LD_CONFIG_PATH或在/etc/ld.so.conf中添加行和GMP,MPFR,MPC的路径不适用于我。 / p>

在哪里找到此问题的解决方案?



更新。 。 Gcc有非常好的选项-v :-)我看到的是从gcc汇编调用,失败。使用选项-save-temps保存了汇编器源代码,并运行汇编器,但它并不重要。



而不是调用真正的汇编器,它调用shell脚本包装器我的案例/ 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 =


$ b b

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

  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 etc。


Problem when compiling 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.

In my gcc-4.6.2/avr/libgcc/config.log I found:

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.

If this command run directly (after creating conftest.c) output will be same.

What is exec: 89: -o: not found? Which program write it? Where is 89 line?

Solutions like exporting LD_CONFIG_PATH or adding lines in /etc/ld.so.conf with path to GMP, MPFR, MPC not work for me.

Where find solution for this problem?

Update. It seems is configuration problem. Gcc has very good option -v :-) And i see that is assembler call from gcc, which fails. With option -save-temps i saved assembler source, and run assembler, but it doesnn't matter.

Instead of calling real assembler it calls shell-script wrapper, in my case /data/data6/soft/src_build/avr-gcc/gcc/as, which begins from:

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

And when it form command-line call, we have this:

exec -o conftest.o conftest.s

which fails as described above.

Where is necessary fix this? To get call like this: exec as -o conftest.o conftest.s

Where good place to set variable ORIGINAL_AS_FOR_TARGET?

解决方案

I had the same problem cross-compiling for mips.

Step one: Cross-compile the binutils for your target. Install them somewhere sane. I use /usr/local/[target]-gcc

Make sure you configure them with --program-prefix=[target]-

Something like (untested):

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

Then you need to set up some environment variables so GCC can find them:

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

Now you can configure and compile GCC. Ensure you start from a completely empty build directory, otherwise gcc/as etc won't get recreated.

这篇关于编译gcc 4.6.2(无法计算目标文件的后缀)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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