LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   install gcc 3.4 along side gcc 4 problem on ubuntu 11.10 (http://www.linuxquestions.org/questions/linux-general-1/install-gcc-3-4-along-side-gcc-4-problem-on-ubuntu-11-10-a-4175413751/)

lilmike 06-27-2012 09:54 PM

install gcc 3.4 along side gcc 4 problem on ubuntu 11.10
 
Hi all,
I have an ubuntu 11.10 server which I mainly use for text game development. I was considering using a text game codebase which is no longer supported but I have been told is easily maintainable. For that reason, I tried compiling it... but lots of errors occurred when doing so. I was told by the same people that it compiled fine under gcc 3.x, so I installed gcc 3.4 from the hardey repos. Now gcc is installed, but it can't create executibles because (so I've been told) binutils is not installed or something similar. I would just do apt-get install build-essential, but I already have that package with gcc 4, I need all the other things that work with gcc 3.4. So that leads me to my question: How to install binutils and other required software for gcc 3.4 along side all the required software for gcc 4?
Thanks,
-Michael.

knudfl 06-28-2012 05:39 AM

First : You can have as many versions of gcc as you want,
installed at the same time.

But : No old Ubuntu compilers will work in Ubuntu 11.04, 11.10 etc.
It's not about binutils or any other package :
The gcc binary is hard coded with certain search path's.
And the later Ubuntu's have got new hideaway locations for :
libgcc_s.so.1, { crt1.o crti.o crtn.o },
"/usr/include/": asm/: bits/: gnu/: sys/ .

"gcc" has search path's for finding files in it's own directories.
The missing files can be copied or linked into "old gcc" :
Then the modifications will not alter your system files.
Example : A "gcc41-compat 11.04" modified for 11.10 ..
Code:

sudo cp -a /usr/include/i386-linux-gnu/asm/ /usr/gcc41/lib/gcc/i386-linux-gnu/4.1.2/include/
sudo cp -a /usr/include/i386-linux-gnu/bits/ /usr/gcc41/lib/gcc/i386-linux-gnu/4.1.2/include/
sudo cp -a /usr/include/i386-linux-gnu/gnu/ /usr/gcc41/lib/gcc/i386-linux-gnu/4.1.2/include/
sudo cp -a /usr/include/i386-linux-gnu/sys/ /usr/gcc41/lib/gcc/i386-linux-gnu/4.1.2/include/

## crt1.o  crti.o  crtn.o :
sudo cp /usr/lib/i386-linux-gnu/crt* /usr/gcc41/lib/gcc/i386-linux-gnu/4.1.2/

## /usr/gcc41/lib/ :
sudo rm libgcc_s.so*
sudo cp /lib/i386-linux-gnu/libgcc_s.so.1 /usr/gcc41/lib/
## /usr/gcc41/lib/ :
sudo ln -s libgcc_s.so.1 libgcc_s.so

Links :
gcc41-compat 11.10 https://docs.google.com/open?id=0B7S...NjZmMHkyaE9Odw
g++41-compat https://docs.google.com/open?id=0B7S...hjMjljN2M2MGU4
gcc34-compat 11.04 https://docs.google.com/open?id=0B7S...gxNGI0MTQ4YTY4
g++34-compat https://docs.google.com/open?id=0B7S...RkMWIxMzIyNDEz

.


All times are GMT -5. The time now is 11:47 PM.