[C++-sig] Re: Boost Python on Mac OS X

Jonathan Brandmeyer jbrandmeyer at earthlink.net
Wed Mar 31 03:52:25 CEST 2004


On Tue, 2004-03-30 at 19:30, David Abrahams wrote:
> James Mastro <jmastro at rochester.rr.com> writes:
> 
> > Hello all,
> >
> > I'm trying to use Boost Python on Mac OS X 10.3. I'm following along
> > with what is at  http://www.boost.org/libs/python/doc/tutorial/doc/
> > building_hello_world.html. After using bjam like this:
> >
> > bjam -sTOOLS=darwin
> >
> > the following are built:
> >
> > libboost_python.dylib
> > hello.so
> >
> > This seems to be correct. I'm not totally sure where they are supposed
> > to go, so I put them in next to Python in the Python framework so
> > Python could find them to import. It found them, but an "import hello"
> > in Python resulted in:
> >
> > ImportError: Failure linking new module:
> > ../../../../bin/boost/libs/python/build/libboost_python.dylib/darwin/
> > debug/shared-linkable-true/libboost_python.dylib: dyld:
> > /Applications/MacPython-2.3/PythonIDE.app/Contents/MacOS/PythonIDE
> > can't open library:
> > ../../../../bin/boost/libs/python/build/libboost_python.dylib/darwin/
> > debug/shared-linkable-true/libboost_python.dylib  (No such file or
> > directory, errno = 2)

What are the output of running `otool -L /path/to/hello.so` and `otool
-D /path/to/libboost_python.dylib`?  

The first command lists all of the libraries that hello.so depends on
(similar to ldd on Linux) and the second reports the install name of the
dylib (similar to the 'soname' concept for shared libs on Linux).

> > Before putting the 2 libs in, "import hello" found nothing. So I
> > assume  Python is finding the hello module now, but not liking it.
> > Can anyone  show me where I've gone wrong? Many thanks.
> 
> I don't know much about MacOS X, but I'm guessing there's an
> LD_LIBRARY_PATH or some such that tells it where to look for
> dynamically linked libraries?  If so, you need to modify it to point
> at libboost_python.dylib, or move the library to a location already in
> that path.

-Jonathan Brandmeyer





More information about the Cplusplus-sig mailing list