-   Linux - General (
-   -   include path for multiple versions of gcc (

hydrogeek 11-16-2007 11:52 AM

include path for multiple versions of gcc
I am trying to compile some C++ code using gcc version 2.95.2 on my FC6 system. I didn't want to disturb the compiler already on here (4.1.2), so I build the older version from source into another location using the --prefix (essentially following the instructions at

Upon compiling, gcc now can't seem to find its include libraries (no such file or directory for things like iostream). I am using -v to verify that the compiler being run is indeed version 2.95.2, and have tried accomplishing that both by changing the make file and by adding the path-changing wrapper Gnashley describes in
I've tried linking explicitly to the libraries using -I. Does anybody know what I might be missing?

Thanks for helping me out!

ta0kira 11-16-2007 09:23 PM

It might be better to use --program-suffix to alter the actual name of the compiler (i.e. --program-suffix=-2.95.2 to give you gcc-2.95.2, etc.) and install in the normal location.

hydrogeek 11-18-2007 10:27 AM

--program-suffix doesn't build
Hmm...this is perhaps changing topics, but I can't seem to build gcc using the program-suffix option at all.

I tried to build using

/home/konings/software/gcc-2.95.2/configure --program-suffix=2.95.2
And then tried both make bootstrap and make followed by make install to actually build. In both cases, after a bunch of output, the last couple of lines of make are the following:

/home/konings/software/gcc-2.95.2/gcc/ch/decl.c: In function ‘start_struct’:
/home/konings/software/gcc-2.95.2/gcc/ch/decl.c:4451: error: argument ‘code’ doesn’t match prototype
/home/konings/software/gcc-2.95.2/gcc/ch/ch-tree.h:736: error: prototype declaration
make[2]: *** [decl.o] Error 1
make[2]: Leaving directory `/home/konings/software/gobj/gcc/ch'
make[1]: *** [cc1chill] Error 2
make[1]: Leaving directory `/home/konings/software/gobj/gcc'
make: *** [all-gcc] Error 2

(if anyone wants me to post the full output, let me know). Here again, the internet and the archives of this forum don't seem to be helping me find solutions. Anybody know what I am doing wrong?

ta0kira 11-18-2007 11:40 AM

You will have to make distclean first to get rid of all of the old configuration files and makefiles. Have you done that? Or just delete your entire build directory and start over.

jschiwal 11-18-2007 11:45 AM

The actual gcc compiler front end contains a version number in the filename so you can install more than one version of compiler. It is what would be called to perform the compiling if you use the "-V" option. The /usr/bin/gcc file will actually be a link to the most current version. gcc -> gcc-4.1.2 in your case.

hydrogeek 11-18-2007 02:08 PM

Yes, I've been doing make distclean between all my tries. I haven't tried deleting the entire build directory, though. I'll try that. Thanks!

Thanks for the info! I'm not sure how to apply that here, though. When I had installed the gcc using --prefix, I had edited my makefile to point specifically to that version of the compiler (hence it showed up as the -v output). Do I need to change anything else in /usr/bin on top of that (or create any symlinks)?

All times are GMT -5. The time now is 09:00 PM.