I'm new to creating python extension modules with distutils. I'm trying to create a module that uses the fmodEx audio library on OS X, and I'm running into some trouble. The needed library file is called fmodexlib.dylib. My setup.py looks like this:

from distutils.core import setup, Extension
setup(name='test',
	  version='1.0',
	  ext_modules=[Extension('test', ['test.c'], \
include_dirs=['/Developer/FMOD Programmers API/api/inc'], \
runtime_library_dirs=['/Developer/FMOD Programmers API/api/lib'], \
libraries=['libfmodex'])],
	  )

However, when I try to install, I get the following error:

building 'test' extension
gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup build/temp.macosx-10.3-fat-2.5/test.o -L/fmodapi/api/lib -llibfmodex -o build/lib.macosx-10.3-fat-2.5/test.so
/usr/bin/ld: for architecture i386
/usr/bin/ld: can't locate file for: -llibfmodex

Has anyone here successfully linked a .dylib into a python extension module? Any help would be appreciated.

Are you on a Mac or Linux? Libfmodex if available for both. It appears that you don't have it installed although it could be installed someplace that is not in the path. Try searching/installing fmodex or libfmodex.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.