[C++-sig] Can't import boost_python module in Mac OS X
Greg Smolyn
greg at smolyn.org
Tue Sep 11 14:34:41 CEST 2007
Hi, I'm having a problem with boost_python and Mac OS X.
I'm using the same build system (more or
less) and on Linux it works just fine.
I have a simple module:
BOOST_PYTHON_MODULE(pycov)
{
def("consensus", consensus, "Build a consensus tree");
}
where consensus is
std::string consensus(std::string in, double scale)
I build with:
/usr/bin/c++ -g -bundle -headerpad_max_install_names -o libpycov.so
"CMakeFiles/pycov.dir/wrappers/python.o"
-L/Users/smolyn/school/bio/libcov/build/src
-L/opt/local/lib -lboost_python -F/opt/local/Library/Frameworks
-framework Python -lcov
Which produces a proper bundle that links to all the right things:
]]] otool -L libpycov.so
libpycov.so:
/opt/local/lib/libboost_python-1_34.dylib (compatibility version 0.0.0,
current version 0.0.0)
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/Python
(compatibility version 2.4.0, current version 2.4.0)
/Users/smolyn/school/bio/libcov/build/src/libcov.dylib (compatibility
version 0.0.0, current version 0.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.9)
BUT, when I try to import it into python, I get the following!
Python 2.4.4 (#1, May 25 2007, 15:00:28)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
]]] import pycov
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: attribute name must be string
Does anyone have _any_ ideas? I'm stumped, I've tried everything!
What's weird is this works absolutely
fine in Linux.
Thanks.
-greg
More information about the Cplusplus-sig
mailing list