On 6 Feb, 2007, at 17:55, stephan nies wrote: > Hello, > > has anyone used boost.python on OSX > and can help me or point me > to "hello world"-style example of a > c++ - extension in boost.python > that works on OSX. > > I have used boost.python on linux and > am porting the app from linux to osx. > Since the app uses a > boost.python - extension module > its essential for me to get the extension > working. > > At the Moment everything compiles > but i cant import the extension in python. > > I already posted on C++-sig but didn't get response so far. > http://mail.python.org/pipermail/c++-sig/2007-February/011918.html > > > My Situation: > > OS: PPC Mac OS X 10.4.8 > Python: python-2.4.4-macosx2006-10-18.dmg > from http://pythonmac.org/packages/py24-fat/dmg/ > (this is a framework build) > Boost: 1.33.1 build from source (./configure && make) > > i am building my extension by invoking: > > g++ -dynamic myextension.cpp > -I/Library/Frameworks/Python.framework/Headers > -I/System/Library/Frameworks/GLUT.framework/Headers -I/usr/include > -I/Users/nies/src/boost_1_33_1 -c -o myextension.o > > and > > g++ -v -dynamiclib -framework Python -framework OpenGL -framework GLUT > -L/Users/nies/src/boost_1_33_1/bin/boost/libs/python/build/ > libboost_python.dylib/darwin/release/shared-linkable-true/ > -lboost_python-1_33_1 myextension.o -o myextension.dylib > > this compiles and when i try to import the extension in pythonw: > > Python 2.4.4 (#1, Oct 18 2006, 10:34:39) > [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin > Type "help", "copyright", "credits" or "license" for more information. >>>> import myextension > Traceback (most recent call last): > File "<stdin>", line 1, in ? > ImportError: No module named myextension > > as far as i understand this is because python searches for > .so files. when i symbolic-link myextension.so -> myextension.dylib > and than try to import: > > Python 2.4.4 (#1, Oct 18 2006, 10:34:39) > [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin > Type "help", "copyright", "credits" or "license" for more information. >>>> import myextension > Traceback (most recent call last): > File "<stdin>", line 1, in ? > ImportError: Inappropriate file type for dynamic loading > > so what am i doing wrong here? I would really > appreciate some hints at this point.
Why not use distutils for building the extension? Distutils knows how to build extensions correctly on a multitude of platforms. Ronald _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig