Re: bsd dynamic library dependencies help
Re: bsd dynamic library dependencies help
- Subject: Re: bsd dynamic library dependencies help
- From: Xochitl Lunde <email@hidden>
- Date: Tue, 29 Dec 2009 10:33:39 -0600
> > 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.
Ok, thanks. I don't remember having to do that
using the auto tools. I put the flag in on "foo" by going
to Get Info, using the Build tab, Linking header and I put them under "Other
Linker Flags". Is that where they are supposed to go?
Somebody long ago was kind enough to write circular
dependencies into some of these libraries I am working with. Any
thoughts on whether Xcode will handle that? I did add target dependencies
to my libraries, but it doesn't like it will let me make a circular target
dependency. I was able to get rid of one circular dependency already
by building some files into a different library, but I'm not sure they
will all be that fixable without touching source code. _______________________________________________
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