libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shared library linking on Darwin


From: Chris Leishman
Subject: Re: shared library linking on Darwin
Date: Tue, 17 Apr 2001 18:40:47 +1000

On Tuesday, April 17, 2001, at 01:50  PM, Alexandre Oliva wrote:

On Apr 17, 2001, Chris Leishman <address@hidden> wrote:

*** Warning: This library needs some functionality provided by
extra/libextra.a.

Unfortunately I can't get the application to load the libshared.a file
as a dynamic module (not unsurprising).  Even if I specify -dlopen on
the command line it still barfs

How exactly are you specifying this flag, and what exactly happens?

I'm using automake, and I add it to the binary_LDFLAGS option, which adds it to the link line. Everything compiles ok, but the dlopen fails with the error "not a Mach-O MH_BUNDLE file type" (this error message is output by dlcompat when NSCreateObjectFileImageFromFile returns NSObjectFileImageInapproriateFile).


I'm just wondering why it can't just suck the object files out of the
archive when linking the shared library?

Because they're likely to be non-PIC, and several platforms don't
support non-PIC in shared libraries.  If Darwin does, all you have to
do is to post a patch that sets deplibs_check_method=pass_all.

Yeah....I thought the PIC might be an issue - I just wasn't sure...

That seems to be how it works on other platforms.

You haven't tested on enough other platforms :-)

Thats entirely reasonable! I've only tried this on Solaris/Linux/BSD which isn't exactly alot. I just hoped Darwin would have some similarities with BSD - but that was a huge long shot considering its shared library system appears to be totally different (weird Mach junk ;-) ).

Alternatively I can compile the subdir as a shared library, but that
means I need to use inter library dependencies when module loading -

Compile it as a libtool convenience archive.  That's exactly the
purpose of this feature.

I tried that, but I still get the error:

*** Warning: inter-library dependencies are not known to be supported.
*** All declared inter-library dependencies are being dropped.

*** Warning: libtool could not satisfy all declared inter-library
*** dependencies of module module.  Therefore, libtool will create
*** a static module, that should work as long as the dlopening
*** application is linked with the -dlopen flag.


And the result is a static archive library (as stated in the warning).

I'm sending you an example module in a separate mail (not CC'd to the list), which will show you how I've set up the build environment.

Thanks,

Chris



reply via email to

[Prev in Thread] Current Thread [Next in Thread]