cURL / Mailing Lists / curl-library / Single Mail


Re: Adding static libcurl.a to xcode 7.2 example project adds libcurl.4.dylib dependency

From: Stephen Greenfield <>
Date: Tue, 23 Feb 2016 00:32:59 +0000


We have figured it out — but it kinda sucks from an Xcode environment

Indeed, Xcode's generated link command of -lcurl is telling the linker to,
by default, link with a DYNAMIC library. The linker will NOT accept
-static as a prefix to -l, because the CLANG driver doesn't support
turning on/off -static/-dynamic (if the linker does see -static, it
expects that EVERYTHING is static — Apple STRONGLY DISCOURAGES THIS).

Once we changed the -lcurl to explicitly "/usr/local/lib/libcurl.a", the
linked .app no longer showed a dependency on libcurl.4.dylib.

What sucks is that it appears there is no easy method to do this through
Xcode — unless I make a copy of libcurl.a with a DIFFERENT NAME.


On 2/22/16, 3:42 PM, "curl-library on behalf of Daniel Stenberg"
< on behalf of> wrote:
>On Mon, 22 Feb 2016, Stephen Greenfield wrote:
>>     /usr/local/lib has permissions for System = Read & Write, wheel =
>> Read only, and Everyone = Read only.
>Yes, that's why 'make install' needs sudo, not the other make commands.
>> This is Xcode's link command line from the copy of Apple's
>> "" OS X Cocoa example, which I added libcurl.a to:
>Wow, that's massive and I know far too little Mac OS X stuff to comment
>on all 
>that. But you're linking with -l and just adding the dir where the new
>is installed with -L. Is that really preventing the linker from finding
>shared default libcurl version you already have installed? I would guess
>doesn't and that is what happens.
>  /
>List admin:
List admin:
Received on 2016-02-23