Re: Trouble with static linking
Re: Trouble with static linking
- Subject: Re: Trouble with static linking
- From: Nick Zitzmann <email@hidden>
- Date: Thu, 28 Jun 2007 17:07:59 -0600
This is OT for this list, and in the future you need to take these
kinds of questions to the xcode-users list, but I'm going to reply
just this once...
On Jun 28, 2007, at 4:18 PM, Carter R. Harrison wrote:
2. Copied libcurl.a into my project, placing it in /Frameworks/
Other Frameworks (maybe I should be putting it under /Frameworks/
Linked Frameworks? is there a difference?).
No.
3. Added a "Copy Files" build phase to my project. Put libcurl.a
as a file to be copied in this phase. The destination for the copy
files phase is "Frameworks".
This is incorrect. Static libraries are linked directly into the
binary; they are not copied like shared libraries.
5. libcurl has a method that will spit out it's version (I need a
feature in one of the more recent builds of libcurl which is why
I'm trying to link statically since OS X uses an older version).
When I run my app libcurl spits out 7.13.1 which is NOT the version
that I've built and included in my project.
So my question is, what am I doing wrong?
Because ld is linking your binary to the dynamic version of libcurl,
installed in /usr/lib, instead of the static version. It is doing
this because ld always gives precedence to dynamic libraries, and
Apple just happens to have a dynamically buit libcurl as part of Mac
OS X.
You have two workarounds:
1. Rename libcurl.a to something else that doesn't conflict with the
name of a library in /usr/lib.
2. Unlink it from the project, and add the path to the static library
to the other linker flags build setting.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden