cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Building a static version of the library

From: Zachary Page <ZPage_at_nemetschek.net>
Date: Tue, 26 Aug 2008 16:45:24 -0400

Thanks all for the help!

-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se
[mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Daniel Johnson
Sent: Tuesday, August 26, 2008 4:42 PM
To: libcurl development
Subject: Re: Building a static version of the library

On Aug 26, 2008, at 12:36 PM, Zachary Page wrote:

> I have just been grabbing the libcurl.a file after running 'make
> install'. I added
> that to my XCode project and use '-lcurl'. Like I said, everything
> built fine, it
> just still looks to the system for other .dylibs. What all do I
> need to
> add to my
> project in order to make everything static? I had assumed that the
> c-ares library
> got encapsulated in the libcurl.a, but I must be wrong.

Don't use -lcurl. If you do, the linker will always try to use a
dynamic library if it finds one, in preference to a static library.
Simply adding libcurl.a to your Xcode project should do what you want.
Also make sure the matching header files are included as well. It may
also be necessary to add the c-ares static library as well, but I'm
not sure. Mac OS X doesn't really "like" static libs and it can get
complicated trying to use them.

> Another issue I have is that I need both ppc and i386 support. I've
> been using lipo
> to make common libs from different builds.

This should work, but it isn't hard to build libcurl Universal. See
http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/
compiling/chapter_4_section_3.html
for instructions.

Daniel
Received on 2008-08-26