cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Cannot Create Truly Static Program With cURL

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 6 Jul 2011 23:21:37 -0700

On Wed, Jul 06, 2011 at 08:13:21PM -0400, brandonshw_at_aol.com wrote:
> I'm writing a program using curl to be run on Linux PCs which will be used by a
> number of different users. I cannot have the users all install curl on their
> individual machines, so I have tried to link curl in statically, rather than
> using libcurl.so. I downloaded the source and created a libcurl.a static
> library. However, when I tried to link it in with my program, it showed a lot
> of disparate undefined references, in other words it had dependencies on other
> libraries. It would be hard to figure out all the things it's calling for and
> link in static versions of those libraries too.

"curl-config --static-libs" will tell you all the libraries you need to link
with libcurl statically. It assumes, however, that the non-libcurl libraries
are either dynamic or have no further dependencies of their own.

> How do people use curl for
> programs that are to be distributed to several users, most of whom don't have
> curl libraries on their PCs? How can I use curl in my program completely
> statically.

Since libcurl used in this fashion will be used exclusively in one
application, you will know exactly which features you'll need. Then you
can build a custom libcurl yourself with only those features. That will
reduce the number of extra libraries you'll need to link with your
application to satisfy libcurl, perhaps even reducing it to none.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-07-07