Installing gcc in a local directory

Brendon Costa brendon@christian.net
Fri Mar 23 20:31:00 GMT 2007


Jose Luis García Pallero wrote:
> Hi,
> Only LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH?
> What about include files? For example, if I want to compile a tipycal hello world program in C, what stdio.h use the compiler, the new 4.2.0 or the old 4.1.2? If I want to compile a program with gcc-4.1.2 instead of 4.2.0, what about the new LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH order?
> Need add LD_LIBRARY_PATH=/home/user/gcc-4.2.0/lib:$LD_LIBRARY_PATH order if I compile, for example, gcc/g77 too?
> 

I just asked almost the same question in another thread: "Two Versions
of GCC"

I am doing the PATH export and the LD_LIBRARY_PATH export, however upon
linking some things i get link errors because it is trying to link using
the old system installed GCC libstdc++ libraries, not the ones in my
home directory. I dont see why thought because the link command looks like:

g++ -g -O2 -o .libs/library_user library_user-main.o
.libs/library_userS.o
-L/home/bcosta/build/edoc/gcc-4.0.1/i386-unknown-netbsdelf3.0/libstdc++-v3/src
-L/home/bcosta/build/edoc/gcc-4.0.1/i386-unknown-netbsdelf3.0/libstdc++-v3/src/.libs
-L/home/bcosta/build/edoc/gcc-4.0.1/gcc
../../../src/plugins/myplugin/.libs/myplugin.a
/home/bcosta/build/example/src/libs/mystatic/.libs/libmystatic.a -lm
../../../src/libs/myshared/.libs/libmyshared.so
../../../src/libs/mystatic/.libs/libmystatic.a
/home/bcosta/build/install/edoc_gcc/lib/libstdc++.so
../../../libltdl/.libs/libltdlc.a -Wl,--rpath
-Wl,/home/bcosta/build/install_example/lib -Wl,--rpath
-Wl,/home/bcosta/build/install/edoc_gcc/lib

Notice the: /home/bcosta/build/install/edoc_gcc/lib/libstdc++.so line
which says its linking the libstdc++ from the home directory NOT the
user one. For some reason, libstdc++ from /usr/lib is being used
instead... Or so it seems. The other thread has more details.

Any thoughts?


Just as an additional note to the original question, i dont know if it
is necessary but my configuration options include:
--with-local-prefix=/home/user/gcc-4.2.0 as well as the standard
--prefix. I dont remember where i got this from as i have been doing it
for a while now.

Brendon.



More information about the Gcc-help mailing list