|gnu linker and static/dynamic mix firstname.lastname@example.org (Robert Kerr) (2000-05-10)|
|Re: gnu linker and static/dynamic mix email@example.com (Arthur H. Gold) (2000-05-12)|
|From:||"Arthur H. Gold" <firstname.lastname@example.org>|
|Date:||12 May 2000 22:29:13 -0400|
|Organization:||UTCS OOPS Group|
Robert Kerr wrote:
> I'm having a problem with the gnu linker. Here's my situation: I'm
> compiling on linux, using g++ (egcs 2.91.66) and letting it call ld
> (2.9.1). I need to link with all static libraries, with one
> exception. That exception is a set of commercial libraries that I
> only have dynamic versions of.
> If I needed all static, I'd just add -static to the g++ flags, and
> everything would be hunky-dory. But, when I do that, the linker
> complains about not finding the static versions of the commercial
> libraries. So, I thought "Why don't I use the -static flag to g++,
> then surround my commercial libraries with -Wl,-Bdynamic and
> -Wl,-Bstatic?" Well, I did that, and the linker finished much too
> rapidly (the fully-dynamic linked executable is about 55 MB, the
> partially dynamic one from the above method is only about 16 MB) and
> it doesn't execute correctly. When I try to run it it acts as if it
> isn't there (I get the (No such file or directory) error message).
> So, I tried adding -Wl,-aarchive to the link flags, then doing the
> -Bdynamic,-Bstatic pair around the dynamic libraries. It links too
> fast, and then when I try to run it I get a segfault. Running ldd on
> this executable shows that it's still linking dynamically to libm,
> libc, and libstdc++2.8.0.
> So, am I approaching this wrong? Is there some reason this isn't
> working for me? Thanks for any advice you might have.
Have you looked at the actual invocation of ld? (add '-Wl,-v' to your
g++ invocation to get this). It may not be producing the ld invocation
I've used -Xlinker -Bstatic <static libs> -Xlinker -Bdynamic <dynamic
libs> with appropriate results.
Artie Gold, Austin, TX (finger the cs.utexas.edu account for more info)
mailto:email@example.com or mailto:firstname.lastname@example.org
Return to the
Search the comp.compilers archives again.