On Thu, 27 May 2010, Axel Freyn wrote:
Hi Alex,
I would like to experiment with gcc 4.5 while keeping my current gcc
4.4.3 installed. I am happy for all the current binaries and libraries
(of 4.4.3) to be found by default. I only want to try compiling some
toy programs with gcc 4.5. I guess this will involve passing some
custom -prefix to ./configure when I compile gcc 4.5 and then perhaps
something like "/path/to/4.5/gcc --sysroot=/path/to/gcc myprog.c". Can
anyone help me with specifics here?
See http://gcc.gnu.org/faq.html#multiple
The easiest might be to use --prefix=/path/to/4.5 and --program-suffix=-4.5
Then it is sufficient to either include the installation path into your
PATH and to call the compiler as "gcc-4.5", or to call it as
"/path/to/4.5/bin/gcc-4.5".
It will find automatically the necesarry include paths and libraries -
"--sysroot" is NOT necessary.
Actually, there is still a subtlety: if you don't do anything, at runtime,
programs will use the libgcc_s, libstdc++ etc from 4.4. You will need
something like -Wl,-rpath,... or LD_LIBRARY_PATH or a specs file to let
them find the right library.
--
Marc Glisse