I am on a cluster and do not have root permission, I am new to linux. I wish to run a tool with a gcc 5 version or less. My default gcc version is 6.3.0. But there is another version of gcc (gcc 4:6.3.0-4) on the system. I am trying to find its location so that I can set CC and CXX variable value to that location (e.g. export CC="/usr/bin/gcc"). I tried which gcc (it is pointing to my default gcc location) and whereis gcc. I am not able to find the location of other gcc. It would be really helpful if someone can share the way to do it.
dpkg --list | grep compiler
Name Version Architecture Description
gcc 4:6.3.0-4 amd64 GNU C compiler
gcc-6 6.3.0-18+deb9u1 amd64 GNU C compiler
My system description is as follows:
Linux b03 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux
Running dpkg -L gcc 4:6.3.0-4 will give you a list of all files installed by that package. You should be able to find the executable path in there.
I work with a Linuxs server:
> cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.7 (Santiago)
(from wikipedia:
Red Hat Enterprise Linux 6 was forked from Fedora 12
6.7, also termed Update 7, 22 July 2015 (kernel 2.6.32-573)
6.8, also termed Update 8, 10 May 2016 (kernel 2.6.32-642))
The kernel
> uname -r
2.6.32-642.11.1.el6.x86_64
> uname -s
Linux
> uname -v
#1 SMP Tue Nov 15 22:57:18 EST 2016
> cat /proc/version
Linux version 2.6.32-642.11.1.el6.x86_64 (sandman#node3res7) (gcc version 4.4.7 20120313 (SuSE 4.4.7-17) (GCC) )
#1 SMP Tue Nov 15 22:57:18 EST 2016
gcc version
> gcc --version
gcc (GCC) 4.4.7 20120313 (SuSE 4.4.7-17)
when trying to install Tensdorflow, I have some issue with a missing library:
ImportError: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.19' not found (required by /opt/ccda/anaconda2/envs/tensorflow35/lib/python3.5/site-packages/tensorflow/python/_pywrap_tensorflow.so)
As you can see in my lib64/libstdc++.so.6 I don't have GLIBCXX_3.4.19
strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
....
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH
I look with the following command:
yum whatprovides */libstdc++.so.6
...
libstdc++-4.4.7-17.el6.x86_64 : GNU Standard C++ Library
Repo : installed
Matched from:
Filename : /usr/lib64/libstdc++.so.6
so my question where can I find the libstdc++-4.x.y-z.el6.x86_64 that contain GLIBCXX_3.4.19 and that I could install on my server RHEL 6 with my gcc version ?
I am a little bit confuse of which version to use from this page
https://www.rpmfind.net/linux/rpm2html/search.php?query=libstdc%2B%2B.so.6%28GLIBCXX_3.4.19%29&submit=Search+...&system=&arch=
I don't see a version for Fedora 12 or RHEL6
I need arch x86_64
I need I guess something gcc (GCC) 4.4.7
I guess I need 64bit
I the following a good macth ? I am quite confuse by the name and info:
libstdc++6-gcc48-32bit-4.8.5-21.1.x86_64.html The standard C++ shared library OpenSuSE leap updates for 42.1 libstdc++6-gcc48-32bit-4.8.5-21.1.x86_64.rpm
I don't have Internet access on the server so I need to download the file locally copy it on the server and do the intsallion.
Thanks for your help
Cheers
Fabien
ps: bonus question
SuSE 4.4.7-17 (GCC), I am confuse, I understood that Suse was a Linux distribution like Redhat!
I found a solution here:
https://www.linuxquestions.org/questions/red-hat-31/lib-libstdc-so-6-version-%60glibcxx_3-4-15'-not-found-4175419985/
Replacing libstdc++-so.6 with a later version that works in EL6:
Unpack libstdc++6_4.7.1-2_i386.deb
http://ftp.de.debian.org/debian/pool...7.1-2_i386.deb
with : ar -x libstdc++6_4.7.1-2_i386.deb && tar xvf data.tar.gz
Next : 1) su ; 2) cp libstdc++.so.6.0.17 /usr/lib/
3) cd /usr/lib/ && rm libstdc++.so.6
4) ln -s libstdc++.so.6.17 libstdc++.so.6
Reason for suggesting the Debian package :
It's a ( gcc ) libstdc++ version that's compiled with a glibc
old enough to be used in EL6 / CentOS 6.
Updated steps (because it seems the file has been moved):
curl -O http://ftp.de.debian.org/debian/pool/main/g/gcc-4.7/libstdc++6-4.7-dbg_4.7.2-5_i386.deb
tar -x libstdc++6-4.7-dbg_4.7.2-5_i386.deb && tar xvf data.tar.gz
mkdir backup
cp /usr/lib/libstdc++.so* backup/
cp ./usr/lib/i386-linux-gnu/debug/libstdc++.so.6.0.17 /usr/lib
ln -s libstdc++.so.6.0.17 libstdc++.so.6
Previous link is dead now as well, you can use this one
http://ftp.de.debian.org/debian/pool/main/g/gcc-4.8/libstdc++6-4.8-dbg_4.8.4-1_i386.deb
In previous comment from Serge, there's a cd missing
cd /usr/lib/
Or like in my case
cd /usr/lib64
For RHEL6, this is in the Software Collections.
I think (without citation) the devtoolsets are numbered according to what version gcc is included. devtoolset 8 will give you gcc 8. Much higher than 4.7 or 4.8.
subscription-manager repos --enable rhel-server-dts-6-rpms
yum install devtoolset-8-gcc-c++
source scl_source enable devtoolset-8
This question already has an answer here:
Installing gfortran in Linux as a user
(1 answer)
Closed 6 years ago.
Here is my question.
The linux cluster which I can use(not a sudo-user) has installed gcc 4.2.1.
>which gcc
>/usr/bin/gcc
For some reason, I need a newer version of gcc. So, I have install gcc 5.1.0 on /disk3/lly/lib/gcc-5.1.0(I can't install it in /usr/bin due to the limits of authority)
I still want the older version gcc 4.2.1, and sometimes I want to use gcc 5.1.0. So, I want to find a safe way switching them easily.
I have read some post, and summarized one simple method here:
## Overlay the older one
## Newer gcc at /disk3/lly/lib/gcc-5.1.0--> For simplification, take $NEW for insted
cd /usr/bin
sudo rm gcc
sudo ln -s $NEW/bin/gcc gcc
## Change back to gcc 4.2.1
sudo ln -sf /usr/bin/gcc gcc
But I don't have enough permission, are there some alternative way to achieve my target?
Short answer: gcc is built against a hard-coded installation path. Just copying somewhere else will not make it work. You will need to re-compile gcc (and, possibly binutils and maybe even the matching libc if it's not the same as the installed version) from scratch.
Your main problem at the moment is that $NEW/bin/gccis not in your PATH. once you add it like
export PATH=${NEW}/bin/gcc:${PATH}
it will start your version of the compiler frontend, but you will soon run into a bunch of other problems that are not that easy to solve.
This is part of some instructions that I was given from a website helping me install CUDA on a hybrid system. I'm using ubuntu 12.04 LTS dual booted as well as having a hybrid graphics card system of Intel Integrated Graphics and NVIDIA GEForce GT 540M.
--external instructions--
The last thing that might cause issues is the version of gcc and g++. Long story short, make sure the pointers gcc and g++ in /usr/bin (and subsequently /usr/local/cuda/bin) are pointing to gcc-4.5 and g++-4.5 (can get these with apt-get) since they are the most recent versions supported by nvcc. Use the soft-link command to achieve this.
--back to me--
Assuming that downloading them with
apt-get install gcc-4.5 g++-4.5
will suffice for that part.
However, how do I make sure that the 'pointers' (how do I identify those?) are linked to the recently downloaded versions. I know the soft link command is
ln -s "target" "symbol" (one for gcc)
ln -s "target" "symbol" (one for g++)
I don't want to do this wrong and I'm quite new to linux so please help me with what 'target' should look like as well as 'symbol' and I'll be on my way.
Alex
It's better to use update alternatives for managing default gcc for your system. For example, you have two versions 4.4 and 4.5. For CUDA you need 4.4.x version of gcc/ Lets set it system default:
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-4.5 40 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.5
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-4.4 60 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.4
Soft links might be work, but I think, update alternatives is the easiest way.
I need to determine which version of GTK+ is installed on Ubuntu
Man does not seem to help
This suggestion will tell you which minor version of 2.0 is installed. Different major versions will have different package names because they can co-exist on the system (in order to support applications built with older versions).
Even for development files, which normally would only let you have one version on the system, you can have a version of gtk 1.x and a version of gtk 2.0 on the same system (the include files are in directories called gtk-1.2 or gtk-2.0).
So in short there isn't a simple answer to "what version of GTK is on the system". But...
Try something like:
dpkg -l libgtk* | grep -e '^i' | grep -e 'libgtk-*[0-9]'
to list all the libgtk packages, including -dev ones, that are on your system. dpkg -l will list all the packages that dpkg knows about, including ones that aren't currently installed, so I've used grep to list only ones that are installed (line starts with i).
Alternatively, and probably better if it's the version of the headers etc that you're interested in, use pkg-config:
pkg-config --modversion gtk+
will tell you what version of GTK 1.x development files are installed, and
pkg-config --modversion gtk+-2.0
will tell you what version of GTK 2.0. The old 1.x version also has its own gtk-config program that does the same thing. Similarly, for GTK+ 3:
pkg-config --modversion gtk+-3.0
This isn't so difficult.
Just check your gtk+ toolkit utilities version from terminal:
gtk-launch --version
get GTK3 version:
dpkg -s libgtk-3-0|grep '^Version'
or just version number
dpkg -s libgtk-3-0|grep '^Version' | cut -d' ' -f2-
You can use this command:
$ dpkg -s libgtk2.0-0|grep '^Version'
You could also just compile the following program and run it on your machine.
#include <gtk/gtk.h>
#include <glib/gprintf.h>
int main(int argc, char *argv[])
{
/* Initialize GTK */
gtk_init (&argc, &argv);
g_printf("%d.%d.%d\n", gtk_major_version, gtk_minor_version, gtk_micro_version);
return(0);
}
compile with ( assuming above source file is named version.c):
gcc version.c -o version `pkg-config --cflags --libs gtk+-2.0`
When you run this you will get some output. On my old embedded device I get the following:
[root#n00E04B3730DF n2]# ./version
2.10.4
[root#n00E04B3730DF n2]#
Try,
apt-cache policy libgtk2.0-0 libgtk-3-0
or,
dpkg -l libgtk2.0-0 libgtk-3-0
I think a distribution-independent way is:
gtk-config --version
You can also just open synaptic and search for libgtk, it will show you exactly which lib is installed.
Try:
dpkg-query -W libgtk-3-bin
Because apt-cache policy will list all the matches available, even if not installed, I would suggest using this command for a more manageable shortlist of GTK-related packages installed on your system:
apt list --installed libgtk*
This will get the version of the GTK libraries for GTK 2, 3, and 4.
dpkg -l | egrep "libgtk(2.0-0|-3-0|-4)"
As major versions are parallel installable, you may have several of them on your system, which is my case, so the above command returns this on my Ubuntu Trusty system:
ii libgtk-3-0:amd64 3.10.8-0ubuntu1.6 amd64 GTK+ graphical user interface library
ii libgtk2.0-0:amd64 2.24.23-0ubuntu1.4 amd64 GTK+ graphical user interface library
This means I have GTK+ 2.24.23 and 3.10.8 installed.
If what you want is the version of the development files, use:
pkg-config --modversion gtk+-2.0 for GTK 2
pkg-config --modversion gtk+-3.0 for GTK 3
pkg-config --modversion gtk4 for GTK 4
(This changed because the + from GTK+ was dropped a while ago.)
To make the answer more general than Ubuntu (I have Redhat):
gtk is usually installed under /usr, but possibly in other locations. This should be visible in environment variables. Check with
env | grep gtk
Then try to find where your gtk files are stored. For example, use locate and grep.
locate gtk | grep /usr/lib
In this way, I found /usr/lib64/gtk-2.0, which contains the subdirectory 2.10.0, which contains many .so library files. My conclusion is that I have gtk+ version 2.10. This is rather consistent with the rpm command on Redhat: rpm -qa | grep gtk2, so I think my conclusion is right.
To compile and link a GTK program with pkg-config, we need the library name instead of the actual version number. For example, the following command compiles and links a GTK program that uses the GTK4 library:
gcc -o program program.c `pkg-config --cflags --libs gtk`
To obtain the library name for GTK, use the following command:
pkg-config --list-all | grep gtk