我最近安装了最后一个 64 位 trisquel 发行版,我从源代码构建了 gcc 5.2.0。我使用的安装技术与我在 ubuntu 15.04 64 位上使用的安装技术完全相同(并且有效),如下所示,并对 gcc 使用 isl 和 cloog 优化:
wget https://ftp.gnu.org/gnu/gmp/gmp-6.0.0a.tar.xz
tar -Jxf gmp-6.0.0a.tar.xz
cd gmp-6.0.0/
mkdir build && cd build
../configure --prefix=/usr/local/lvm/gmp-6.0.0 --enable-cxx
make -j 4
sudo make install
sudo make check
cd ..
cd ..
wget http://www.mpfr.org/mpfr-3.1.2/mpfr-3.1.2.tar.gz
tar xvzf mpfr-3.1.2.tar.gz
cd mpfr-3.1.2
mkdir build && cd build
../configure --prefix=/usr/local/lvm/mpfr-3.1.2 --with-gmp=/usr/local/lvm/gmp-6.0.0
make -j 4
sudo make install
cd ..
cd ..
wget http://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
tar xvzf mpc-1.0.3.tar.gz
cd mpc-1.0.3
mkdir build && cd build
LD_LIBRARY_PATH=/usr/local/lvm/gmp-6.0.0/lib:/usr/local/lvm/mpfr-3.1.2/lib ../configure --prefix=/usr/local/lvm/mpc-1.0.3 --with-gmp=/usr/local/lvm/gmp-6.0.0 --with-mpfr=/usr/local/lvm/mpfr-3.1.2
LD_LIBRARY_PATH=/usr/local/lvm/gmp-6.0.0/lib:/usr/local/lvm/mpfr-3.1.2/lib make -j 4
sudo make install
cd ..
cd ..
wget http://isl.gforge.inria.fr/isl-0.14.tar.gz
tar xvzf isl-0.14.tar.gz
cd isl-0.14/
mkdir build && cd build
LD_LIBRARY_PATH=/usr/local/lvm/gmp-6.0.0/lib ../configure --prefix=/usr/local/lvm/isl-0.14 --with-gmp-prefix=/usr/local/lvm/gmp-6.0.0
LD_LIBRARY_PATH=/usr/local/lvm/gmp-6.0.0/lib make -j 4
sudo make install
cd ..
cd ..
wget "http://www.bastoul.net/cloog/pages/download/cloog-0.18.4.tar.gz"
tar xvzf cloog-0.18.4.tar.gz
cd cloog-0.18.4
mkdir build && cd build
LD_LIBRARY_PATH=/usr/local/lvm/isl-0.14/lib:/usr/local/lvm/gmp-6.0.0/lib ../configure -prefix=/usr/local/lvm/cloog-0.18.4 --with-isl-prefix=/usr/local/lvm/isl-0.14 --with-gmp-prefix=/usr/local/lvm/gmp-6.0.0
LD_LIBRARY_PATH=/usr/local/lvm/isl-0.14/lib:/usr/local/lvm/gmp-6.0.0/lib make -j 4
sudo make install
cd ..
cd ..
wget ftp://ftp.irisa.fr/pub/mirrors/gcc.gnu.org/gcc/releases/gcc-5.2.0/gcc-5.2.0.tar.gz
tar xvzf gcc-5.2.0.tar.gz
cd gcc-5.2.0
mkdir build && cd build
# I DON'T PASS --disable-multilib
LD_LIBRARY_PATH=/usr/local/lvm/gmp-6.0.0/lib:/usr/local/lvm/mpfr-3.1.2/lib:/usr/local/lvm/mpc-1.0.3/lib:/usr/local/lvm/isl-0.14/lib:/usr/local/lvm/cloog-0.18.4/lib ../configure --prefix=/usr/local/lvm/gcc-5.2.0 --enable-checking=release --with-gmp=/usr/local/lvm/gmp-6.0.0 --with-mpfr=/usr/local/lvm/mpfr-3.1.2 --with-mpc=/usr/local/lvm/mpc-1.0.3 --enable-languages=c,c++,fortran,objc,obj-c++ --with-isl=/usr/local/lvm/isl-0.14 --with-cloog=/usr/local/lvm/cloog-0.18.4 --program-suffix=-5.2.0
LD_LIBRARY_PATH=/usr/local/lvm/gmp-6.0.0/lib:/usr/local/lvm/mpfr-3.1.2/lib:/usr/local/lvm/mpc-1.0.3/lib:/usr/local/lvm/isl-0.14/lib:/usr/local/lvm/cloog-0.18.4/lib make -j 4
sudo make install
之后,我想测试一些 c++11 功能,因此我创建了一个包含以下内容的 tst_lambda.cpp 文件:
#include <iostream>
#include <vector>
using namespace std;
int main()
{
cout << [](int m, int n) { return m + n;} (2,4) << endl;
vector<int> V({1,2,3});
cout << "V =" << endl;
for(auto e : V)
{
cout << e << endl;
}
return 0;
}
并使用以下命令构建可执行文件:
export LD_LIBRARY_PATH=/usr/local/lvm/gmp-6.0.0:/usr/local/lvm/mpfr-3.1.2:/usr/local/lvm/mpc-1.0.3:/usr/local/lvm/cloog-0.18.4:/usr/local/lvm/isl-0.14:/usr/local/lvm/gcc-5.2.0/lib64
export PATH=/usr/local/lvm/gcc-5.2.0/bin/:$PATH
g++-5.2.0 -std=c++11 tst_lambda.cpp -o tst_lambda
在 Trisquel 7.0 LTS Belenos 64 位上触发以下错误:
/usr/local/lvm/gcc-5.2.0/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/cc1plus: error while loading shared libraries: libisl.so.13: cannot open shared object file: No such file or directory
我去看了/usr/local/lvm/gcc-5.2.0/libexec/gcc/x86_64-unknown-linux-gnu/5.2.0/cc1plus
并做了一个ldd
,结果如下:
cc1plus:
linux-vdso.so.1 => (0x00007fffc5df8000)
libisl.so.13 => not found
libmpc.so.3 => /usr/lib/x86_64-linux-gnu/libmpc.so.3 (0x00007f1ec32fb000)
libmpfr.so.4 => /usr/lib/x86_64-linux-gnu/libmpfr.so.4 (0x00007f1ec309f000)
libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f1ec2e2b000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1ec2c26000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f1ec2920000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1ec255b000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1ec352d000)
于是我进去查看/usr/local/lvm/isl-0.14/lib
,发现了以下内容:
total 4912
-rw-r--r-- 1 root root 3263234 août 11 14:38 libisl.a
-rwxr-xr-x 1 root root 1000 août 11 14:38 libisl.la
lrwxrwxrwx 1 root root 16 août 11 14:38 libisl.so -> libisl.so.13.1.0
lrwxrwxrwx 1 root root 16 août 11 14:38 libisl.so.13 -> libisl.so.13.1.0
-rwxr-xr-x 1 root root 1750046 août 11 14:38 libisl.so.13.1.0
-rw-r--r-- 1 root root 3939 août 11 14:38 libisl.so.13.1.0-gdb.py
drwxr-xr-x 2 root root 4096 août 11 14:38 pkgconfig
我不明白:libisl.so.13 指向 libisl.so.13.1.0 ,它与它所指向的符号链接位于同一目录...
在Ubuntu 15.04 64位下或在Mac OS X 10.10.5下,我没有这样的链接问题,链接完成,找到libisl.so.13.1.0。在Trisquel之下,显然不是……问题出在哪里?