João Paulo
João Paulo

Reputation: 6670

Run GCC on SUSE from separated folder

I'm in SUSE 11.4 without root permissions. I need to use a gcc rather than the one that came with the system (4.3). The one I want to use (6.2) is separated in a different folder: /path/to/gcc-6.2.0.

Just to avoid possible future problems, I made the following:

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

At ~ folder, I made a hello_world.cpp file and ran the following:

/path/to/gcc-6.2.0/bin/g++ hello_world.cpp -o hw

Then I got this error:

/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

Then, I went after the libmpc.so.3. I saw that I depended on libgmp.so.10: I went to this site, downloaded the .rpm file with wget on ~ folder and ran this command:

rpm -ivh -r /home/unix/me/foo libgmp10-32bit-6.1.2-2.11.x86_64.rpm

Got this errors:

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

I don't know why libc.so.6 error, because it's in /usr/lib folder (set in the first export command I did on LD_LIBRARY_PATH var). For /bin/sh error, I ran /bin/sh, set export SHELL=/bin/sh and, again, ran this (now with --nodeps):

rpm -ivh --nodeps -r /home/unix/me/foo libgmp10-32bit-6.1.2-2.11.x86_64.rpm

Now getting this error:

error: unpacking of archive failed on file /usr/lib/libgmp.so.10;5aa15ea0: cpio: symlink failed - Permission denied

Notice that there's a Permission denied there, I think that's because I can't write on /usr/lib folder. Maybe changing this folder, unpack elsewhere... if possible, how?

Well, I'm quite lost... I'm newbie in all of this stuff.

Q: How can I use this gcc-6.2.0?


Just a info, ldd command at 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 command on 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

Upvotes: 0

Views: 272

Answers (1)

user5550963
user5550963

Reputation:

I do use OpenSUSE, but rarely do I use RPM. Maybe this could help you:

rpm  -ivh -nodeps --prefix=/some/other/path/ libgmp10-32bit-6.1.2-2.11.x86_64.rpm

Upvotes: 2

Related Questions