LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Co-existing gcc (https://www.linuxquestions.org/questions/linux-software-2/co-existing-gcc-668035/)

David570 09-06-2008 06:45 PM

Co-existing gcc
 
I would like to know if anyone can tell me how I can co-exist gcc-4.x.x with gcc-3.x.x I have software I use (paid for!). which was compiled under
gcc-3.2.3. It will NOT compile on any thing over that version. So
since I have upgraded to Slackware 12.1 (GREAT!) I need to have gcc-3.x.x co-exist with gcc-4.x.x. Help!!

whansard 09-07-2008 12:16 AM

compile each with different prefixes.
configure --prefix=/usr/local/gcc-3.x.x

David570 09-07-2008 09:40 AM

Co-exist
 
Well yes , i could but gcc-4.x.x is the resident compiler and when i try
to compile backwards (gcc-3.x.x) it barfs bad and crashes. I guess I could
use slackpkg remove 4 and install three then rebuild 4......??? Do u think that would work ??? I guess i'll give it a try.... Thanks for the reply.

brianL 09-07-2008 11:17 AM

Try this package, it's for 12.0, but it might do:
http://www.slackware.com/~alien/slackbuilds/gcc34/

whansard 09-07-2008 05:45 PM

I've got all these in one directory, /usr/gcc/, and I use a script to change between them when I want to.
0 gcc-2.95.3 0 gcc-3.2.3 0 gcc-3.4.4
0 gcc-3.0.4 0 gcc-3.3.6 0 gcc-4.0.0

When I compiled and installed each, I renamed the gcc, cc, c++, g++, files to gcc-3.3.6, cc-3.3.6, c++-3.3.6, etc ..., in the /usr/bin directory. I have a script for each version that makes symlinks from the version I am switching to, to the proper names.


/usr/local/bin# cat gcc3.3.6
GCCOPTS="-O2 -Wall -march=i686 -fPIC"
export CC="/usr/gcc/gcc-3.3.6/bin/gcc $GCCOPTS"
export CXX="/usr/gcc/gcc-3.3.6/bin/g++ $GCCOPTS"
export CFLAGS=$GCCOPTS
export CXXFLAGS=$GCCOPTS
rm /usr/bin/gcc /usr/bin/g++ /usr/bin/c++
ln -s /usr/gcc/gcc-3.3.6/bin/gcc /usr/bin/gcc
ln -s /usr/gcc/gcc-3.3.6/bin/g++ /usr/bin/g++
ln -s /usr/gcc/gcc-3.3.6/bin/c++ /usr/bin/c++

I'm sure this is a sloppy way to do this, but it's been working for years, so I just left it.

David570 09-08-2008 03:32 PM

Co-Exist
 
Ok, guys thanks a heap. I'll try ur script. Anything to save my money.


All times are GMT -5. The time now is 04:07 PM.