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

David Abrahams dave at boost-consulting.com
Wed Mar 31 02:30:15 CEST 2004

Hi James,

It's best to post Boost.Python questions to the c++-sig:


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)
> 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.

Dave Abrahams
Boost Consulting

More information about the Cplusplus-sig mailing list