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

Re: NPTL and static linking



Josselin Mouette wrote:

> Le mercredi 09 mars 2005 à 11:23 -0800, Blunt Jackson a écrit :
>> I appreciate the clarification. What is desirable, then, is for the developer
>> to be able to statically link his or her own libraries, and third
>> party libraries,
>> but to dynamically pick up "system" libraries, of which I would number
>> libpthread. That would be adequate for my needs. I expect this is possible,
>> as *everything* is possible, somehow. Perhaps it is something as trivial
>> as a compiler or linker flag that I have missed?
> 
> Yup, just enclose the libraries you want to link statically against
> between -Wl,-Bstatic and -Wl,-Bdynamic:
> 
> gcc -o something foo.o bar.o -lsystemlib -Wl,-Bstatic -lownlib -lthirdpartylib -Wl,-Bdynamic -lpthread

-Wl,-static ... -Wl,-dy are equivalent and shorter :-)

-- 
Kevin B. McCarty <kmccarty@princeton.edu>   Physics Department
WWW: http://www.princeton.edu/~kmccarty/    Princeton University
GPG public key ID: 4F83C751                 Princeton, NJ 08544



Reply to: