cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: static link

From: Richard Pickett <Richard.Pickett_at_csrtechnologies.com>
Date: Thu, 14 Sep 2006 12:31:34 -0500

> > Is there a way to link in libcurl static?
>
> ./configure --disable-shared will build only a static libcurl, which is
> all
> you should need as long as you don't have a dynamic libcurl lying around
> somewhere else on your system. Otherwise, include the path of libcurl.a
> (or
> libcurl.la if you're using libtool) when linking your app instead of using
> -lcurl

thanks for the quick reply. This is what I had in my makefile:

LINKCC = $(CC) -lstdc++ -L/usr/lib -lcurl -lz -lssl -lcrypto -ldl
-static-libgcc

and this is what I changed it to:

LINKCC = $(CC) -lstdc++ -L/usr/lib /usr/lib/libcurl.a -static-libgcc

And now make complains with:

gcc -lstdc++ -L/usr/lib /usr/lib/libcurl.a -static-libgcc -o logexe
license.o logexe.o
license.o(.text+0x3d): In function `LicenseExit()':
: undefined reference to `curl_easy_cleanup'
license.o(.text+0x1a0): In function `CheckLicense()':
: undefined reference to `curl_easy_init'
license.o(.text+0x391): In function `CheckLicense()':
: undefined reference to `curl_easy_setopt'
license.o(.text+0x3ac): In function `CheckLicense()':
: undefined reference to `curl_easy_setopt'
license.o(.text+0x3c1): In function `CheckLicense()':
: undefined reference to `curl_easy_setopt'
license.o(.text+0x3d2): In function `CheckLicense()':
: undefined reference to `curl_easy_perform'

it only goes away when I go back to the old -lcurl jumk. I've checked and my
libcurl.a is there so I'm at a loss to why gcc won't pull it in. Here's an
objdump on libcurl.a:

objdump -t /usr/lib/libcurl.a | grep curl_easy
000000e0 g F .text 0000003f curl_easy_init
00000120 g F .text 0000001e curl_easy_setopt
00000140 g F .text 00000098 curl_easy_perform
000001e0 g F .text 00000040 curl_easy_cleanup
00000220 g F .text 0000001b curl_easy_getinfo
00000240 g F .text 000001c5 curl_easy_duphandle

thanks again for your help!
Received on 2006-09-14