[Distutils] building a wrapper on OSX

Bob Ippolito bob at redivi.com
Thu Jan 29 18:47:20 EST 2004


On Jan 29, 2004, at 6:41 PM, Simon Burton wrote:

>
> I'm having trouble linking my wrapper on OSX.
> It works fine on linux. The linker complains about undefined symbols 
> from the wrapped library.
> If I use "-undefined suppress" the link happens, but then python 
> stumbles with the same complaint
> when I do the import.
>
> ZMA:~/dsp$ python2.3 setup.py build
> running build
> running build_py
> copying test_sndfile.py -> build/lib.darwin-6.8-Power_Macintosh-2.3
> running build_ext
> building 'sndfile' extension
> gcc -Wl,-F. -bundle -framework Python 
> build/temp.darwin-6.8-Power_Macintosh-2.3/sndfile.o -L/usr/local/lib 
> -lsndfile -o build/lib.darwin-6.8-Power_Macintosh-2.3/sndfile.so
> ld: Undefined symbols:
> _sf_open_fd
> error: command 'gcc' failed with exit status 1
> ZMA:~/dsp$
>
> Somehow the info on the original libsndfile is lost.
> Any ideas?

First off: never, ever, do -undefined suppress.  Its use is only 
applicable to OS X 10.0 -> 10.1, later versions of OS X have better 
mechanisms for dealing with this.

Chances are, either the symbol is static (not exported), or it's 
external to libsndfile.  You can run nm on libsndfile.dylib (or .a, 
whatever it is) and see if it's actually defined.  If it's not defined, 
it's probably in one of the frameworks or dylibs it links to, you can 
check that with otool -L libsndfile.dylib.  On OS X, you need to 
directly link to anything that you use symbols from.

If you still have trouble, point me to libsndfile and I will take a 
look at it.

-bob

BTW: the best mailing list for this sort of inquiry is pythonmac-sig




More information about the Distutils-SIG mailing list