Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems building universal binaries using -isysroot



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:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >Problems building universal binaries using -isysroot (From: Tron Thomas <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.