• 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: bsd dynamic library dependencies help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bsd dynamic library dependencies help


  • Subject: Re: bsd dynamic library dependencies help
  • From: Peter O'Gorman <email@hidden>
  • Date: Tue, 29 Dec 2009 10:01:09 -0600

On 12/29/2009 09:45 AM, Xochitl Lunde wrote:

I created a new Xcode project and added targets for two of my BSD dynamic libraries, "foo" and "bar". The code in "foo" depends on the code in "bar". "bar" compiles just fine and creates in build/Resources two things: libbar.dylib and a folder, libbar.dylib.dSYM. "foo" won't build. The compile looks fine, "bar" headers are found, but then it goes to a linking phase and complains that all symbols from "bar" are missing. If I change "foo" to a BSD Static library, then there is no problem and the archive is created. Why is my "foo" library trying to link in symbols from "bar"? I don't have an executable created yet at all, just these two BSD dynamic library targets. How do I fix this?

Mac OS X, by default, requires that dynamic shared libraries have no undefined symbols, by not adding -lbar when creating foo, your libfoo.dylib has undefined symbols (it sounds like these symbols will be defined at runtime because your application will link with -lfoo -lbar ?). The reason that no undefined is the default is that the linkers can optimize run time behavior, and the libraries will load and bind faster.


The static archive case works because static archives are just a collection of objects with a table of contents, nothing really cares if symbols are undefined or not until the archive is used again as linker input.

I suggest simply adding -lbar when creating libfoo.

Peter
--
Peter O'Gorman
http://pogma.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: bsd dynamic library dependencies help
      • From: Xochitl Lunde <email@hidden>
References: 
 >bsd dynamic library dependencies help (From: Xochitl Lunde <email@hidden>)

  • Prev by Date: bsd dynamic library dependencies help
  • Next by Date: Re: bsd dynamic library dependencies help
  • Previous by thread: bsd dynamic library dependencies help
  • Next by thread: Re: bsd dynamic library dependencies help
  • Index(es):
    • Date
    • Thread