• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Trouble with static linking
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Trouble with static linking (From: "Carter R. Harrison" <email@hidden>)

  • Prev by Date: Re: NSFileManager: no way to check a file meets a set of file types??
  • Next by Date: Re: Trouble with static linking
  • Previous by thread: Trouble with static linking
  • Next by thread: Re: Trouble with static linking
  • Index(es):
    • Date
    • Thread