Re: Problems building universal binaries using -isysroot
Re: Problems building universal binaries using -isysroot
- Subject: Re: Problems building universal binaries using -isysroot
- From: Eric Albert <email@hidden>
- Date: Thu, 13 Apr 2006 20:45:40 -0700
On Apr 13, 2006, at 7:45 PM, Tron Thomas wrote:
I am trying to convert a project that uses make files so that it
can build universal binaries for Mac OS X. The project relies on
some 3rd party software libraries. These libraries have been
compiled so they are universal binaries, and they work when
building explicitly for the native architecture of the system.
I have been able to get one the dynamic libraries for the project
to compile as a universal binary. In order to do this, I needed to
include the following when linking for the Intel platform:
-isysroot /Developer/SDKs/MacOSX10.4u.sdk
When I don't include this during linking I will get errors like the
following:
ld: Undefined symbols:
__Unwind_Resume
__ZNKSs5c_strEv
That's because you need the SDK path, as you found. :)
After getting the library to compile, I tried compiling a second
library that links to this first one. When I do this I encounter
errors like the following:
/usr/bin/ld: warning can't open dynamic library: /Developer/SDKs/
MacOSX10.4u.sdk/usr/local/lib/lib3rdparty.dylib referenced from:
libMyLibrary.dylib (checking for undefined symbols may be
affected) (No such file or directory, errno = 2)
…
/usr/bin/ld: Undefined symbols:
_some_method referenced from libMyLibrary expected to be defined
in /usr/local/lib/lib3rdparty.dylib
It seems pretty obvious that using -isysroot /Developer/SDKs/
MacOSX10.4u.sdk is causing this problem as the path to the 3rd
party library should just be /usr/local/lib/lib3rdparty.dylib
instead of /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/
lib3rdparty.dylib. Yet if I don't use this option, I will get
undefined symbol errors like those listed above.
How am I supposed to fix this problem?
The problem is that the compiler's treating /usr/local/lib as an SDK-
relative path, not a system-relative path. There are some
differences of opinion about whether that's a bug, but in my opinion
it is. :) Please write it up at <http://bugreport.apple.com/>.
The workaround is to symlink /Developer/SDKs/MacOSX10.4u.sdk/usr/
local/lib to /usr/local/lib. Since there's nothing at all in /usr/
local in the SDKs, this should do the trick:
sudo ln -s /usr/local /Developer/SDKs/MacOSX10.4u.sdk/usr/local
Hope this helps,
Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden