linux - Gcc编译 "cannot compute suffix of object files: cannot compile"

标签 linux gcc compiler-construction 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

运行gcc的配置脚本(当然我已经编译了mpfr、mpc和gmp)。 但是一旦我启动:

make -j4

我收到以下错误:

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

我试着用谷歌搜索它并尝试了我找到的解决方案,但没有任何效果。有谁知道我为什么会收到此错误?

最佳答案

此问题是由于测试程序尝试链接 libmpc/libmpfr/libgmp 时动态链接库路径问题引起的。

在环境变量下方附加以允许 ld 链接到正确的 so 文件:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/mpc/lib/

然后再次尝试构建 gcc。

关于linux - Gcc编译 "cannot compute suffix of object files: cannot compile",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11502045/

相关文章:

c - gcc 和警告中的希腊字符

c++ - 在 GCC 中编译 C++ 文件时出错

JavaCC 和 Unicode 问题。为什么\u696d属于 "\u4e00"-"\u9fff"范围,但在JavaCC中无法管理

python - 探戈与 Django ModuleNotFoundError : No module named 'registration'

linux - QMessageBox里面有链接,无法点击

c - gcc 不会编译 SDL C 程序(对 SDL 函数的 undefined reference )

linux - .exe 文件如何与 Windows 内核交互? Linux .bin 文件相同

使用结构时出现编译器错误

c# - 使用 mono 项目在 linux 上运行 c# 代码有哪些优势和局限性?

c - Linux 内核互斥量