how to install old gcc
I have slackware 10 installed right now with gcc-3.3 installed. I have some programs that require to be compiled with gcc-2.95, and was wondering how to install an older version of gcc on slackware 10? Is it possible to install to another location so it doesn't replace gcc-3.3, maybe placing it in /opt or /usr/local ? Thanks for the help guys.
|
easily.
download and extract the gcc-2.95 (I use 2.95.3 (it's the most bug free of the series)) configure and build it. The way I do it is: ( I should point out that it is recommended to use a build directory instead of building in the top source directory. to do this, cd to the gcc-2.95 directory, do mkdir build, cd build, then execute the configure command below like this: ../configure etc... (notice the two .. before the / in the command)). ./configure --prefix=/opt/gcc-2.95.3 --enable-shared --with-languages=c,c++ --enable-threads=posix --enable-__cxa_atexit make make install one thing you might want is to disable shared (--disable-shared) libraries if you don't want to have to put the libstdc++ libraries and such in your library path (and to build static executables, which are easier to manage if they have to be run on another computer with a different distro or something) but it will make the size of the binary a little bigger. to use the new compiler, just modify your path to point to the new one first: Code:
export PATH=/opt/gcc-2.95.3/bin:$PATH Code:
gcc -v or Code:
unset CC Code:
export CC=/opt/gcc-2.95.3/bin/gcc Code:
ln -s /opt/gcc-2.95.3/bin/gcc /opt/gcc-2.95.3/bin/cc |
thanks, I'll get started on this right away.
|
Hey, this works awsome. The only other thing I need to figure out is how to switch between both 3.3 and 2.95 ? I would like to keep 3.3 as the default compiler, and be able to choose the 2.95 compiler when I need it.
|
thats where the PATH and CC come in. you can use either one, doesn't matter. unless you specifically do:
Code:
export PATH=/opt/gcc-2.95.3/bin:$PATH |
Hi there,
I tried the above suggestion, but I get the following error when compiling. Code:
gcc -c -DIN_GCC -g -O2 -I. -I.. -I../../../gcc/ch -I../../../gcc/ch/.. -I../../../gcc/ch/../config -I../../../gcc/ch/../../include ../../../gcc/ch/expr.c Figa |
I'd suggest creating a symlink to gcc-2.95.3 and use that when you want to use it instead of the native version.
Code:
ln -s /opt/gcc-2.95.3/bin/gcc /usr/bin/gcc-2.95.3 Code:
export CC=gcc-2.95.3 Also, if you compiled gcc-2.95.3 with shared library support, then you can add it's library location to /etc/ld.so.conf. Code:
echo "/opt/gcc-2.95.3/lib" >> /etc/ld.so.conf |
Quote:
|
All times are GMT -5. The time now is 12:14 PM. |