Re: Linking with a very specific library version
Re: Linking with a very specific library version
- Subject: Re: Linking with a very specific library version
- From: "Dave Geering" <email@hidden>
- Date: Fri, 14 Nov 2008 09:49:32 +1100
> Dave,
> I have had similar problems in the past with linking with libcrypto.
> My solution has been to set the "Other Linker Flags" to the path to the
> library I want and set the "Library Search Paths" to that same library.
> The resulting linker flags look like:
> "-L <RELATIVE PATH TO FOLDER CONTAINING LIBRARY>"
> ../../IKEngine/IKEngineOpenSSL/openssl-0.9.8d/build/static/libcrypto.a
> Technical Q&A AQ1393 covers this some, but never completely worked for me.
Hi Rich,
I've found out that Panther's SNMP dylib's "compatibility version" is
6.0.0 and on Tiger it is 8.0.0, this is different than the actual
source-code version. Leopard comes with the same compatibility version
as Tiger as well as the latest SNMP libraries (they sit side by side).
Since my Bundle was linked with the Tiger SNMP library, even though it
has the same file name on Panther, it wouldn't load the library on
Panther because the compatibility version of Tiger's SNMP library was
greater. So, I linked with Panther's library instead, and did a little
version detection to make some adjustments in my parameters to the
API, and it worked, but the Panther library is PPC only (I had to
remove i386 as a target architecture for it to link at all) and so my
Bundle wouldn't work on Intel.
So, I created a new Xcode project; a fake dylib called
libnetsnmp.5.dylib (the same name as the actual version), and it
contained dummy entries for all the APIs I called from the real
library. I compiled this fake library for both Intel and PPC, and made
the "compatibility version" 6.0.0 so it would load on Panther and
Tiger. When I linked this against my Bundle it would resolve all the
external links OK against this so-called "libnetsnmp.5.dylib", not
knowing that this wasn't the actual library it is going to be using.
My Bundle now also contained information that it requires the SNMP
library with a compatibility version of 6.0.0 or greater.
Keeping my version detection in play, I could now distribute my Bundle
across Panther, Tiger and Leopard and it worked perfectly on both PPC
and Intel, and I don't need to statically link against any libraries,
or distribute a static version of the library either! Huzzah!
It's a Mickey Mouse way to do things but it works. I never like doing
version detection.
Cheers,
Dave.
_______________________________________________
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