This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: exes can't find libstdc++.so without help


On Thu, Jul 05, 2001 at 09:12:08AM +0100, Neil Bird wrote:
> Neil Bird wrote:
> >   Has something gone wrong, or this this actually the case??
> 
>   I think this is something to do with
> '--enable-version-specific-runtime-libs' ... so I guess I got
> exactly what I was asking for :-/

Yep.  :-)

>   I've asked this on 'help' but not had any reply - is there an
> easy way to do a *static* link of libstdc++ when the .so version
> is kicking about, *without* having to do a fully '-static' link
> (of all libraries)?

Depends on your linker.  I noticed that you're using Solaris 2.6, but it
depends on whether you used the native Sun linker or the GNU binutils linker.

Anyhow, you can pass arbitrary linker flags to the linker with -Wl,-foo,
so you can choose which libraries fall under the 'static' link with
something like

    -lfoo -lbar -Wl,-Bstatic -lstdc++ -lbaz -Wl,-Bdynamic -lcheese

on the link line.  (Untested, from memory.)  Here, libfoo, libbar,
libcheese, and any other libraries automatically tacked onto the end by
the driver will be linked dynamically (as usual).  libstdc++ and libbaz
will be linked statically.

Alternatively, you can pass -R /blah/blah/blah on the command line to add
the library search path to the executable.[*] Usually -R isn't accepted
by GCC, but under Solaris it is.  The generic portable way to do it is
with -Wl again.

Or set LD_RUN_PATH when you link, and the linker will embed the path
automatically; same as with -Wl,-R.


[*]  Making this sort of thing happen automatically has been discussed many
many times on the gcc list; you can search the archives if you're curious.
There are serious pros and cons either way.

Phil

-- 
Would I had phrases that are not known, utterances that are strange, in
new language that has not been used, free from repetition, not an utterance
which has grown stale, which men of old have spoken.
                                     - anonymous Egyptian scribe, c.1700 BC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]