help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linking only one library statically?


From: Colin S. Miller
Subject: Re: Linking only one library statically?
Date: Mon, 31 Jan 2005 10:22:36 +0000
User-agent: Mozilla Thunderbird 1.0 (X11/20041218)

Matthias wrote:
Hi,

I know that ld has a flag called static. But what if I don't want ALL libs to be statically linked, but only some? The problem is that I am using gtkmm and boost and I can't link gtkmm statically because there are only shared libs. But boost should be linked statically.


Try using GCC's partial link option, this will allow you
to link boost first (statically), and then link the rest
of the libs dynamically.


You want to do

gcc -o mypartialprog.o myobjects.o -lmylib -lboost -Xlinker -r
gcc -o myprog mypartialprog.o -lgtkmn


(See --relocatable in ld's man page)

I'm not sure if this will work if both boost
and another lib you use are in C++.

HTH,
Colin S. Miller

reply via email to

[Prev in Thread] Current Thread [Next in Thread]