This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: egcs links wrong libstdc++ and unwanted libgcc.a
- To: manfred at s-direktnet dot de, Manfred dot Hollstein at ks dot sel dot alcatel dot de
- Subject: Re: egcs links wrong libstdc++ and unwanted libgcc.a
- From: Carlo Wood <carlo at runaway dot xs4all dot nl>
- Date: Sun, 21 Jun 1998 18:11:15 +0200 (CEST)
- Cc: law at cygnus dot com, carlo at runaway dot xs4all dot nl, egcs at cygnus dot com
| On Sat, 20 June 1998, 21:15:35, carlo@runaway.xs4all.nl wrote:
|
| > I still have g++-2.8.1 installed, and egcs uses the stdc++ library
| > from that distribution - isn't that a bug?
|
| Another reason for installing libstdc++ in $(libsubdir)?!?!?
|
| manfred
I investigated the problem a bit further, and found the following:
1) If there is no other C++ compiler installed (thus no g++-2.8.1),
but egcs was configured with --prefix=/usr/local/egcs, it
silently links statically with /usr/local/egcs/lib/libstdc++.a.
When /usr/local/egcs/lib/libstdc++.a is removed, it links
but trying to run the resulting binary fails on not being
able to find the libstdc++ -- UNLESS you add "/usr/local/egcs/lib"
to LD_RUN_PATH or to /etc/ld.so.conf.
2) The FAQ (http://egcs.cygnus.com/faq.html#rpath) is unclear
(I read it before, but did not realise the following).
It should explicitly give the solution, in case that someone
configured with a non-standard --prefix like /usr/local/egcs,
to add "/usr/local/egcs/lib" to /etc/ld.so.conf. Note that
"/usr/local/lib" is normally in there already, which might be
the reason that this problem has gone by unnoticed before.
3) The same remark should be added to "How to install both egcs
and gcc2" (http://egcs.cygnus.com/faq.html#multiple) which
explicitly suggests to use --prefix=/usr/local/egcs.
4) When /usr/local/egcs/lib is added to /etc/ld.so.conf, egcs
works under all circumstances - but g++-2.8.1 starts to link
with /usr/local/egcs/lib/libstdc++.so.2.8 now (because
ld.so gives priority to the files in /etc/ld.so.conf over
/usr/lib). I can't think of a solution for that. I am not
an expert of dynamic linking, but I understood that it is
possible to include the full path of a shared library in
the excutable - this has disadvantages (?), and I can't find
a way to do this on a linux/ELF system.
Summarizing, I can't think of a way to have two compilers
that use two different shared libraries with the same name,
co-exist on the same machine. If someone can help me with
this please? I'd like to have both compilers for now.
I appologise if I am being stupid :/
Carlo
--
carlo@runaway.xs4all.nl