E-K*_*ami 25 linux compiler-construction gcc linux-from-scratch
我实际上正在阅读LFS书籍(版本7.1),我在第53页被阻止.尝试编译gcc,我尝试了以下命令:
./configure --target=$LFS_TGT --prefix=$LFS/build/gcc-build --disable-nls\
--disable-shared --disable-multilib --disable-decimal-float --disable-threads\
--disable-libmudflap --disable-libssp --disable-libgomp --disable-libquadmath\
--disable-target-libiberty --disable-target-zlib\
--enable-languages=c\
--without-ppl --without-cloog\
--with-mpfr-include=$LFS/source/mpfr/src
--with-mpfr-lib=$LFS/source/mpfr/src/.libs\
--with-gmp-include=/mnt/LFS/source/gmp\
--with-gmp-lib=/mnt/LFS/source/gmp/.libs\
--with-mpc-include=/mnt/LFS/source/mpc/src\
--with-mpc-lib=/mnt/LFS/source/mpc/src/.libs
Run Code Online (Sandbox Code Playgroud)
运行gcc的配置脚本(当然我已经编译了mpfr,mpc和gmp).但是一旦我发布:
make -j4
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
checking for suffix of object files... configure: error: in `/mnt/LFS/source/gcc-4.6.2/x86_64-lfs-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
Run Code Online (Sandbox Code Playgroud)
我试图谷歌为它,并尝试了我找到的解决方案但没有任何效果.有谁知道我为什么会收到这个错误?
Fei*_*Fei 17
当测试程序尝试链接libmpc/libmpfr/libgmp时,此问题是由dyanmic链接库路径问题引起的.
在环境变量下面添加以允许ld链接到正确的so文件:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/mpc/lib/
Run Code Online (Sandbox Code Playgroud)
然后尝试再次构建gcc.
Axe*_*rja 12
"*构建GCC并非易事,但如果您仔细按照说明操作并不困难.许多人急于尝试构建它而不正确阅读安装文档并制造一个或多个常见错误:
1)不要从gcc src dir运行./configure(这是不支持的)=>你需要从gcc源目录外运行configure
2)注意:如果GCC动态链接到先决条件库(GMP/MPFR/MPC),则在构建gcc和使用已安装的编译器时,共享库必须位于动态链接器的路径(LD_LIBRARY_PATH)中.*"
简单示例(没有到GMP/MPFR/MPC的动态链接):
tar xzf gcc-4.8.0.tar.gz
cd gcc-4.8.0
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.8.0/configure --prefix=/opt/gcc-4.8.0
make
make install
Run Code Online (Sandbox Code Playgroud)
来源: Advogato Doc - GNU Doc
此错误消息可能由多种不同原因引起。找出哪一个的最佳方法是检查下面示例中的日志文件“/home/manu/gcc/gcc/i686-pc-linux-gnu/libgcc/config.log”。或者在原始海报案例 '/mnt/LFS/source/gcc-4.6.2/x86_64-lfs-linux-gnu/libgcc' 中查找最后一个错误行。
引用 GCC 常见问题解答:http : //gcc.gnu.org/wiki/FAQ#configure_suffix
像任何 GNU 项目一样,GCC 使用 GNU 自动工具来为构建系统的细节配置编译。因此,配置脚本使用小型测试程序——通常称为 conftest.c——来测试某些功能和/或特性是否可用。如果此类测试程序的编译失败,您将看到如下错误消息:
checking for suffix of object files... configure: error: in
`/home/manu/gcc/gcc/i686-pc-linux-gnu/libgcc': configure: error:
cannot compute suffix of object files: cannot compile See `config.log'
for more details. make[2]: *** [configure-stage1-target-libgcc] Error
1 make[2]: Leaving directory `/home/manu/gcc/gcc'
Run Code Online (Sandbox Code Playgroud)
此错误消息非常具有误导性,并且该问题通常与该消息无关。您必须检查发生错误的目录中的文件“config.log”。在上面的示例中,您必须检查目录“/home/manu/gcc/gcc/i686-pc-linux-gnu/libgcc”中的“config.log”文件。可能有几个测试程序在配置过程中失败,但其中一些失败并不严重。检查文件中的最后一个错误条目。
此错误消息的常见原因是:
缺少 GCC 构建所需的库,特别是 MPFR、GMP 和 MPC。如果安装为共享库,它们必须位于运行时链接程序的搜索路径中,以便可以找到它们。请按照为什么我的 ./configure 和 make 失败的答案中的说明进行操作?
编译器崩溃了。例如,如果出现诸如“conftest.c: internal compiler error:”之类的错误,则表明编译器存在错误。如果您使用的是未修改的 GCC 版本,请按照程序报告错误。
归档时间: |
|
查看次数: |
30661 次 |
最近记录: |