由于libgmp.so.3,无法安装本地构建的gcc-4.9.0

Can't install local-build gcc-4.9.0 because of libgmp.so.3

本文关键字:构建 gcc-4 安装 so libgmp 由于      更新时间:2023-10-16

我正试图在linux上的本地构建中安装gcc-4.9.0,以及gmp-4.3.2mpfr-3.1.4mpc-1.0.3(我正在遵循本教程)。

但是当我在gcc构建目录中运行make install时,我会得到以下错误:

test -z "/home/k.masson/gcc-4.9.0/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0" || /usr/bin/mkdir -p "/home/k.masson/gcc-4.9.0/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0"
Installing dummy lib libgcj_bc.so.1.0.0
/home/k.masson/build/gcc-4.9.0/host-x86_64-unknown-linux-gnu/gcc/cc1: 

主要是:

error while loading shared libraries: libgmp.so.3: cannot open shared object file: No such file or directory

看起来libgmp.so.3没有正确安装,但它是('make-install'didn not failed for gmp),我检查了很多次链接是否正确,但没有做任何事情,我不知道为什么make文件找不到它。

在运行make install之前,我按以下顺序运行这些命令:

LD_LIBRARY_PATH=/home/k.masson/gmp-4.3.2/lib:/home/k.masson/mpfr-2.4.2/lib:/home/k.masson/mpc-0.8.1/lib ./configure --prefix=/home/k.masson/gcc-4.9.0 --with-gmp=/home/k.masson/gmp-4.3.2 --with-mpfr=/home/k.masson/mpfr-2.4.2 --with-mpc=/home/k.masson/mpc-0.8.1 --disable-multilib

这个(我不知道为什么,但这在教程中):

LD_LIBRARY_PATH=/home/k.masson/gmp-4.3.2/lib:/home/k.masson/mpfr-2.4.2/lib:/home/k.masson/mpc-0.8.1/lib nice -n 19 time make -j8

libgmp.so.3位于/home/k.masson/gmp-4.3.2/lib以及librgmp.so.3.5.2中。我甚至试图自己用ln -s libgmp.so.3.5.2 libgmp.so.3创建链接,但它并没有解决问题。

为了在本地构建中安装gmp,我使用了以下命令:

./configure --prefix=/home/k.masson/gmp-4.3.2 --enable-cxx
nice -n 19 time make -j8
make install
make check
echo $?  # Returns 2

但是一个测试失败

====================================
1 of 58 tests failed
Please report to gmp-bugs@gmplib.org
====================================
make[4]: *** [check-TESTS] Error 1
make[4]: Leaving directory `/home/k.masson/build/gmp-4.3.2/tests/mpz'
make[3]: *** [check-am] Error 2
make[3]: Leaving directory `/home/k.masson/build/gmp-4.3.2/tests/mpz'
make[2]: *** [check-recursive] Error 1
make[2]: Leaving directory `/home/k.masson/build/gmp-4.3.2/tests'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/home/k.masson/build/gmp-4.3.2'
make: *** [check] Error 2

此外,当我运行测试时,我得到了上面的几行:

/bin/sh: line 4: 20956 Segmentation fault      (core dumped) ${dir}$tst

所以我尝试安装gmp-6.1.0来避免这个测试问题,它是有效的,所有测试都可以,但现在,这是一个gcc问题,我不能再运行make install了,因为make文件不存在。。我应该保留新的gmp吗?改变我的gcc?或者根本没有?

感谢您的帮助

捷径

为了解决安装gmp时的测试问题,我只选择了较新版本进行安装,这看起来是一个兼容性问题。因此,我选择了gmp-6.1.0,安装和测试过程都很成功。

但这在安装gcc-4.9.0时带来了一个新问题,./configure无法通过安装过程生成make文件。所以我不得不得到一个新的版本,我选择了gcc-4.9.3而不是gcc-4.90,一切都很完美。

干净的方式

正如@piyush让我注意到的那样,根本不建议走捷径。请参阅安装GCC

如果你想进行本地构建,最好是在这里下载你想要的gcc版本,在安装它之前,在gcc源代码中运行./contrib/download_prerequisites脚本。

如果没有,您可以使用包管理器,这会更好。