cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: Static compilation

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 26 Mar 2003 12:30:50 +0100 (CET)

On Tue, 25 Mar 2003 Bryan_Kemp_at_Dell.com wrote:

> In order to get curl to compile as a static execuatable I had to grep all
> of the files in the source tree and look for any references to "gcc" and
> replace them with "gcc --static". Is there an easier way to do this?

You shouldn't need it for all the compiler lines, only for the link line so I
figure setting the LDFLAGS variable should be fine.

I tried just now, and I could make a completely static version this way (on
my linux box):

 $ ./configure --disable-shared --enable-static
 $ make

Then it builds and links curl with a static version of libcurl.

To then make the curl tool linked with everything static, I did this:

 $ rm src/curl
 $ make LDFLAGS=-all-static

Then the output src/curl tool is one single static file with no shared libs
at all.

I also tried to set the LDFLAGS already when running the configure script, to
avoid the extra rm + make, but that caused the configure script to fail...

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en
Received on 2003-03-26