编译libgcc xgcc错误 [英] Compilng libgcc xgcc error

查看:607
本文介绍了编译libgcc xgcc错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图安装交叉编译器,本教程,并且当我想创建libgcc时,我只是将在我的终端中创建all-target-libgcc
。这使得抛出错误

 检查ln -s是否工作...是
检查i586-elf-gcc。 ../usr/src/build-gcc/./gcc/xgcc -B / usr / src / build-gcc /./ gcc / -B / usr / local / cross / i586-elf / bin / -B / usr / local / cross / i586-elf / lib / -isystem / usr / local / cross / i586-elf / include -isystem / usr / local / cross / i586-elf / sys-include
检查对象的后缀文件... configure:error:在`/ usr / src / build-gcc / i586-elf / libgcc'中:
configure:error:无法计算目标文件的后缀:无法编译
请参阅config .log'了解更多详情。
make:*** [configure-target-libgcc]错误1

日志我发现

 目标:i586-elf 
配置:../gcc-4.8.0/configure - -target = i586-elf --prefix = / usr / local / cross - disable-nls --enable-languages = c,c ++ --without-headers:(reconfigured)../gcc-4.8.0/configure - -target = i586-elf --prefix = / usr / local / cross --disable-nls --enable-languages = c,c ++ --without-headers:(reconfigured)../gcc-4.8.0/configure - -target = i586-elf --prefix = / usr / local / cross --disable-nls --enable-languages = c,c ++ --without-headers
线程模型:single
gcc version 4.8 .0(GCC)
configure:3358:$? = 0
configure:3347:/usr/src/build-gcc/./gcc/xgcc -B / usr / src / build-gcc /./ gcc / - B / usr / local / cross / i586- elf / bin / -B / usr / local / cross / i586-elf / lib / -isystem / usr / local / cross / i586-elf / include -isystem / usr / local / cross / i586-elf / sys-include - V& 5
xgcc:error:无法识别的命令行选项'-V'
xgcc:致命错误:无输入文件

实际上,xgcc没有'-V'选项。我在寻找如何编译libgcc的方法。



在此先感谢

解决方案 libgcc 之前,你建立了一个极其简单的交叉编译器。现在,配置脚本运行的一部分标准测试是测试编译器,看它是否会在正常情况下生成可用的可执行文件。你的裸骨头编译器不能。幸运的是,对于 libgcc ,您不需要生成可执行文件,只需要一个静态库 libgcc.a 。问题在于,愚蠢的GNU autoconf 生成的脚本没有意识到这一点。

我遇到了同样的问题,并设计了一个非常丑陋的解决方法。您需要注释掉gcc源代码目录中libgcc / configure文件的一部分。以下是我为我的版本注释的部分;

在第3484行:

  { $ as_echo$ as_me:$ {as_lineno- $ LINENO}:result:$ ac_file>& 5 
$ as_echo$ ac_file>& 6; }
#BEGIN PHILLIP编辑
#if test -z$ ac_file;然后:
#$ as_echo$ as_me:failed program was:>& 5
#sed's / ^ / | /'conftest。$ ac_ext>& 5

#{{$ as_echo$ as_me:$ {as_lineno- $ LINENO}:error:in \` $ ac_pwd':>& amp ; 5
#$ as_echo$ as_me:error:in \`$ ac_pwd':>& 2;}
#{as_fn_set_status 77
#as_fn_errorC编译器无法创建可执行文件
#请参阅\config.log以获取更多详细信息。 $ LINENO5; }; }
#fi
ac_file ='a.out'
#END PHILLIP EDIT
ac_exeext = $ ac_cv_exeext

希望这有助于。


I'm trying to install cross compiler, this tutorial, and when I want to make libgcc I just put make all-target-libgcc in my terminal. This make throws error

checking whether ln -s works... yes
checking for i586-elf-gcc...  /usr/src/build-gcc/./gcc/xgcc -B/usr/src/build-gcc/./gcc/         -B/usr/local/cross/i586-elf/bin/ -B/usr/local/cross/i586-elf/lib/ -isystem /usr/local/cross/i586-elf/include -isystem /usr/local/cross/i586-elf/sys-include   
checking for suffix of object files... configure: error: in `/usr/src/build-gcc/i586-elf/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make: *** [configure-target-libgcc] Error 1

In config.log I found

Target: i586-elf
Configured with: ../gcc-4.8.0/configure --target=i586-elf --prefix=/usr/local/cross --        disable-nls --enable-languages=c,c++ --without-headers : (reconfigured) ../gcc-4.8.0/configure --target=i586-elf --prefix=/usr/local/cross --disable-nls --enable-languages=c,c++ --without-headers : (reconfigured) ../gcc-4.8.0/configure --target=i586-elf --prefix=/usr/local/cross --disable-nls --enable-languages=c,c++ --without-headers
Thread model: single
gcc version 4.8.0 (GCC) 
configure:3358: $? = 0
configure:3347:  /usr/src/build-gcc/./gcc/xgcc -B/usr/src/build-gcc/./gcc/ -    B/usr/local/cross/i586-elf/bin/ -B/usr/local/cross/i586-elf/lib/ -isystem /usr/local/cross/i586-elf/include -isystem /usr/local/cross/i586-elf/sys-include    -V >&5
xgcc: error: unrecognized command line option '-V'
xgcc: fatal error: no input files

In fact xgcc don't have '-V' option. I'm searching the way how to compile libgcc.

Thanks in advance

解决方案

Here's the problem: Before you attempted to build libgcc as you described, you built an extreme bare-bones cross compiler. Now, part of the standard tests that the configure script runs is to test the compiler to see if it will produce a working executable file under normal conditions. Your bare bones compiler can't. Fortunately, for libgcc, you don't need to produce an executable, just a static library libgcc.a . The problem is that the stupid GNU autoconf-generated script doesn't realize that.

I encountered this same problem and devised a very ugly workaround. You need to comment out a section of the libgcc/configure file in your gcc source directory. Here's the section I commented out for my version; do something similar to yours:

At line 3484:

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
$as_echo "$ac_file" >&6; }
# BEGIN PHILLIP EDIT
# if test -z "$ac_file"; then :
  # $as_echo "$as_me: failed program was:" >&5
# sed 's/^/| /' conftest.$ac_ext >&5

# { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
# $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
# { as_fn_set_status 77
# as_fn_error "C compiler cannot create executables
# See \`config.log' for more details." "$LINENO" 5; }; }
# fi
ac_file='a.out'
# END PHILLIP EDIT
ac_exeext=$ac_cv_exeext

Hope this helps.

这篇关于编译libgcc xgcc错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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