Friday, February 29, 2008

Symbol Variants - MacOSX

Up until now it has been impossible to run kinterbasdb against SuperServer builds of Firebird for MacOSX on Tiger (10.4). When you try and import kinterbasdb into Python the following error occurs:
Symbol not found fputs$UNIX2003
This is a bit of a problem.
Reading around the issue indicates that symbol usage between MacOSX 10.4 and 10.5 has changed because of the introduction of
UNIX cconformance.
This article on developer.apple.com explains why we might see UNIX2003 symbols.
Basically anything compiled on 10.5 will use the new conforming UNIX2003 sysmbols where appropriate.
However we shouldn't be seeing these symbols if we compile everything with
--mmacosx-version-min=10.4 and/or set MACOSX_DEPLOYMENT_TARGET=10.4
So why when we try and run kinterbasdb on 10.4 we have a problem?
A nm -a libfbclient.dylib shows that there are 4 UNIX2003 symbols in the library...
and I had no idea where they were coming from.
It seems that we have a link problem, and the only way to make sure that they do not get pulled in to the libfbclient library is to insist that the linker links against the 10.4 sdk.
A small change to prefix.darwin_i386 seems to solve the problem
Add LD_FLAGS+=-isysroot /Developer/SDKs/MacOSX10.4u.sdk
Why the linker ignores the flag/environment variable is a mystery to solve another day.

No comments: