cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: distributing a compiled program using libcurl

From: Mohun Biswas <m_biswas_at_mailinator.com>
Date: Tue, 02 Nov 2004 11:48:40 -0500

Bertrand Demiddelaer wrote:

> Yep. Don't use "--static", just add /path/to/your/own/libcurl.a in your
> compilation command line instead of -lcurl :-) After compilation, don't
> forget to strip your executable...

Better way #1 (assuming gcc): surround -lcurl with static/dynamic
clauses, e.g:

     -Wl,-Bstatic -lcurl -Wl,-Bdynamic

Better way #2: Configure libcurl with the "--enable-static
--disable-shared" flags. There will then be only a static libcurl to
link with. You might also find that --disable-debug shinks the code some
more.

In general, I link with my third-party libs (such as curl) statically
but *always* link with system libs dynamically. Thus your link line
might look like:

     ... -Wl,-Bstatic -lcurl -lz -lpcre -Wl,-Bdynamic -lsocket -lnsl

or similar.

MB
Received on 2004-11-02