cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: static link

From: Jason Pump <jpump_at_mindspring.com>
Date: Thu, 14 Sep 2006 15:14:10 -0700

I remember this being somewhat difficult. There's additional problems if
you're using openSSL, I never worked that out. Here's what works for me.

LIBIDN=$(shell if [ -f /usr/lib/libidn.a ]; then ls /usr/lib/libidn.a ; fi)

ifeq ("", "$(LIBIDN)")
LIBS= ../../../lib/libcurl.a -L../../../lib/ -L/pkg/zlib/lib -lnsl
-L/usr/lib/g++.so.2.7.2.8 -lpthread -L/usr/lib64 -ldl -L../../../lib -lz
-lares -lcares
else
LIBS= ../../../lib/libcurl.a -L../../../lib/ -L/pkg/zlib/lib -lnsl
-L/usr/lib/g++.so.2.7.2.8 -lpthread -L/usr/lib64 -ldl -L../../../lib -lz
-lares -lcares -lidn
endif

Dan Fandrich wrote:
> On Thu, Sep 14, 2006 at 02:05:52PM -0500, Richard Pickett wrote:
>
>> That gets me further down the road. But what a ball of ear wax it turns
>> into. I link, it spits out errors about some lib missing a function, I have
>> to figure out which lib.a has that function in it, add that to the end of
>> the link command, re-run the link. Next missing function... I've added 7
>> more libraries doing this and it seems like there's no end in site. Is there
>> an easy way to tell gcc "pick all appropriate libraries looking in
>> /usr/lib"?
>>
>
> I really doubt there's such a function. If all the dependent libraries
> were compiled with libtool as well as your app, you can simply pass in
> /usr/lib/libcurl.la to the libtoolified link command instead of
> /usr/lib/libcurl.a and libtool will take care of all the dependencies
> for you. Alternatively, you can manually run ldd on the dynamic versions
> of the libraries to see what each depends on and add the static versions
> to your link command. Or, for each dependent library, you could use
> the pkg-config --libs-only-l option or equivalent PKGNAME-config option
> (e.g. curl-config --libs) to do the same, assuming that each dependent
> library supports one of those methods.
>
>
>>>> Dan
>>>>
Received on 2006-09-15