gcc 4.2

Need help with C, C++, perl, python, etc?

gcc 4.2

Postby kormuz » 2006-09-15 09:44

hi, i am newbie

my task is install gcc 4.2. i preferr to use gcc 4.2 as additional compiler, so i downlaoded tar file.
1. i succefully installed it. on /usr/tmp
2. made export PATH=/usr/tmp/gcc4.2/bin:${PATH}
3. but still my default gcc is old:
$which gcc

i need help to make gcc4.2 my default compiler
Posts: 3
Joined: 2006-06-30 11:35

Postby jjmac » 2006-09-15 10:40

Hi kormuz,

Your compiler symlinks (/usr/bin) are still pointing to the default and are likely higher in the path list.

Look at your 'gcc' package. That will contain the symlink. Along with package g++, and any other suite members.

You could try setting the CC and C++ environment variables in your '.profile or .bashrc' files to point to the required compiler(s).

Or you could just replace the existing symlinks with new ones.

I would do a ...

]# dpkg -S gcc

first to get the existing package name for any files your going to alter first. Then do a

]# dpkg-repack <package_name>

Just to get a repacked package of your existing state. And stashing it somewhere. Makes restoring the situation easier.

You could also consider putting


at the top of your path list. Either in your '.profile' or '.bashrc' files. And then just add the appropriate symlinks in /usr/local/bin

You could also expand the repacked gcc/g++/etc package(s). Replacing the files/links that point to the defaults with the ones for gcc4. And installing that. Then you would have some management support.

There is a bit of fiddling there, but the packages concerned aren't big, so it should be manageable.

Even using the 'equiv' facility might work there.

If your compiling policy sets from the ftp site you can add a direct reference to the compiler in the debian/rules file. Usually, some of them make it difficult :).

There are a few ways to do it. I tend to use manual techniques myself, thus the change the links directly suggestion. But i'm aware that that doesn't sit well with everyone.

The repack/edit technique and the path adjustment, .profile and .bashrc edit/inclusion suggestions should be quite safe though.

Good luck with gcc4

Posts: 387
Joined: 2005-12-28 23:34
Location: Australia

Return to Programming

Who is online

Users browsing this forum: No registered users and 8 guests