我在SUSE 11.4中没有root权限。我需要使用gcc
而不是系统附带的 (4.3)。我想使用的那个(6.2)在不同的文件夹中分开:/path/to/gcc-6.2.0
.
为了避免将来可能出现的问题,我做了以下操作:
export LD_LIBRARY_PATH=/lib:/lib64:/path/to/gcc-6.2.0/lib:/path/to/gcc-6.2.0/lib64:/usr/lib:/usr/lib64:$LD_LIBRARY_PATH
在~
文件夹中,我创建了一个hello_world.cpp
文件并运行了以下内容:
/path/to/gcc-6.2.0/bin/g++ hello_world.cpp -o hw
然后我得到这个错误:
/path/to/gcc-6.2.0/libexec/gcc/x86_64-pc-linux-gnu/6.2.0/cc1plus: error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directory
然后,我追libmpc.so.3
.我看到我依赖于libgmp.so.10
:我去了这个站点,下载了.rpm
文件,wget
~
文件夹并运行以下命令:
rpm -ivh -r /home/unix/me/foo libgmp10-32bit-6.1.2-2.11.x86_64.rpm
出现此错误:
error: Failed dependencies:
/bin/sh is needed by libgmp10-32bit-6.1.2-2.11.x86_64
libc.so.6 is needed by libgmp10-32bit-6.1.2-2.11.x86_64
libc.so.6(GLIBC_2.0) is needed by libgmp10-32bit-6.1.2-2.11.x86_64
libc.so.6(GLIBC_2.1.3) is needed by libgmp10-32bit-6.1.2-2.11.x86_64
libc.so.6(GLIBC_2.3) is needed by libgmp10-32bit-6.1.2-2.11.x86_64
libc.so.6(GLIBC_2.3.4) is needed by libgmp10-32bit-6.1.2-2.11.x86_64
libc.so.6(GLIBC_2.4) is needed by libgmp10-32bit-6.1.2-2.11.x86_64
libc.so.6(GLIBC_2.7) is needed by libgmp10-32bit-6.1.2-2.11.x86_64
我不知道为什么libc.so.6
错误,因为它位于/usr/lib
文件夹中(在我对 var 上执行的第一个导出命令中设置LD_LIBRARY_PATH
)。对于/bin/sh
错误,我运行了/bin/sh
,设置export SHELL=/bin/sh
并再次运行了这个(现在带有--nodeps
):
rpm -ivh --nodeps -r /home/unix/me/foo libgmp10-32bit-6.1.2-2.11.x86_64.rpm
现在收到此错误:
error: unpacking of archive failed on file /usr/lib/libgmp.so.10;5aa15ea0: cpio: symlink failed - Permission denied
请注意,那里有一个Permission denied
,我认为这是因为我无法/usr/lib
文件夹上写入。也许更改此文件夹,在其他地方解压缩...如果可能,如何?
好吧,我很迷茫...我是所有这些东西的新手。
问:如何使用此gcc-6.2.0
?
只是一个信息,ldd
命令在cc1plus
:
linux-vdso.so.1 => (0x00007fff987bc000)
libmpc.so.3 => not found
libmpfr.so.4 => not found
libgmp.so.10 => not found
libdl.so.2 => /lib64/libdl.so.2 (0x00002b782f503000)
libstdc++.so.6 => /path/to/gcc-6.2.0/lib64/libstdc++.so.6 (0x00002b782f708000)
libm.so.6 => /lib64/libm.so.6 (0x00002b782fa91000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00002b782fd0a000)
libc.so.6 => /lib64/libc.so.6 (0x00002b782ff22000)
/lib64/ld-linux-x86-64.so.2 (0x00002b782f2e1000)
la
命令gcc-6.2.0/bin
:
drwxr-xr-x 2 pbsadmin pbsusers 4096 Dec 15 2016 .
drwxr-xr-x 8 pbsadmin pbsusers 4096 Dec 15 2016 ..
-rwxr-xr-x 4 pbsadmin pbsusers 2868174 Dec 15 2016 c++
-rwxr-xr-x 1 pbsadmin pbsusers 2862280 Dec 15 2016 cpp
-rwxr-xr-x 4 pbsadmin pbsusers 2868174 Dec 15 2016 g++
-rwxr-xr-x 3 pbsadmin pbsusers 2859868 Dec 15 2016 gcc
-rwxr-xr-x 2 pbsadmin pbsusers 67083 Dec 15 2016 gcc-ar
-rwxr-xr-x 2 pbsadmin pbsusers 67067 Dec 15 2016 gcc-nm
-rwxr-xr-x 2 pbsadmin pbsusers 67087 Dec 15 2016 gcc-ranlib
-rwxr-xr-x 1 pbsadmin pbsusers 1666022 Dec 15 2016 gcov
-rwxr-xr-x 1 pbsadmin pbsusers 1673624 Dec 15 2016 gcov-tool
-rwxr-xr-x 4 pbsadmin pbsusers 2868174 Dec 15 2016 x86_64-pc-linux-gnu-c++
-rwxr-xr-x 4 pbsadmin pbsusers 2868174 Dec 15 2016 x86_64-pc-linux-gnu-g++
-rwxr-xr-x 3 pbsadmin pbsusers 2859868 Dec 15 2016 x86_64-pc-linux-gnu-gcc
-rwxr-xr-x 3 pbsadmin pbsusers 2859868 Dec 15 2016 x86_64-pc-linux-gnu-gcc-6.2.0
-rwxr-xr-x 2 pbsadmin pbsusers 67083 Dec 15 2016 x86_64-pc-linux-gnu-gcc-ar
-rwxr-xr-x 2 pbsadmin pbsusers 67067 Dec 15 2016 x86_64-pc-linux-gnu-gcc-nm
-rwxr-xr-x 2 pbsadmin pbsusers 67087 Dec 15 2016 x86_64-pc-linux-gnu-gcc-ranlib
我确实使用 OpenSUSE,但很少使用 RPM。也许这可以帮助您:
rpm -ivh -nodeps --prefix=/some/other/path/ libgmp10-32bit-6.1.2-2.11.x86_64.rpm