Re: dynamic libraries prpoblem
Re: dynamic libraries prpoblem
- Subject: Re: dynamic libraries prpoblem
- From: Michael McCracken <email@hidden>
- Date: Tue, 21 Jun 2005 16:52:47 -0700
Hi, The short answer is that linux and darwin diverge a good bit when
it comes to linking, and you may indeed need to do different things
for OS X. Your best bet is to read some manpages, keeping the
following in mind:
For apple's gcc, -dynamiclib tells it to create a dynamic library
using darwin libtool, which is not the same as gnu libtool. gnu
libtool is available on darwin as 'glibtool'.
Also, ld is the mach link editor, and is not the same as linux's ld.
>From the manpages, it looks like calling 'g++ -dynamiclib' will end up
calling 'libtool -dynamic', which calls 'ld -dylib'.
Since the command you mentioned is operating on preexisting object
files, how were they built?
Also, for further reference - Apple has some docs for porting from
unix [1] and another mailing list that might be of more help called
unix-porting [2]
[1]:http://developer.apple.com/documentation/Porting/Conceptual/PortingUNIX/intro/chapter_1_section_1.html
[2]:http://lists.apple.com/archives/Unix-porting/
On 6/21/05, Ivan S. Kourtev <email@hidden> wrote:
> This may be perhaps a bit off topic but I am having problems
> subscribing to the Darwin-dev list so I thought I'd start by asking
> here.
>
> I am having problems compiling and using Linux code that involves
> building some shared libraries. I am trying to build a shared
> dynamic library from some foo*.o files with a line like this:
>
> g++ -dynamiclib foo1.o foo2.o -o libBar.so
>
> But the above line fails with an "ld: Undefined symbols:" error
> followed by a long list of symbols. All of the missing symbols are
> defined in another dynamic library libExtra.so located in the folder /
> location
>
> So if I try the following line
>
> g++ -dynamiclib foo1.o foo2.o -L/location -lExtra -o libBar.so
>
> everything works fine, no complaints.
>
> Why is that? I was under the impression that it is not necessary for
> the linker to be able to resolve the references at the time of
> building the dynamic library? I am not a big expert on this and it
> seems dynamic libraries on Mac OS X are somewhat different but I am
> having trouble figuring out what's going on. Is the first version of
> the command (above) never going to work on Mac OS X and I just have
> to stick to the second? Thanks in advance for any help,
>
> Cheers,
>
> -- ivan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden