Boost logo

Boost-Build :

Subject: [Boost-build] Using bjam on OS X for Python extensions
From: aditya bhargava (bluemangroupie_at_[hidden])
Date: 2010-03-29 01:33:29


I'm trying learn how to create a Python extension using bjam, and I'm
walking through the basic "Hello World" tutorial on boost.org. Running bjam
compiles my code into an object file, but for some reason it is not able to
create a shared library. Here's what I see:

...patience...
...patience...
...found 1573 targets...
...updating 11 targets...
common.mkdir bin
common.mkdir bin/gcc-4.0.1
common.mkdir bin/gcc-4.0.1/debug
gcc.compile.c++ bin/gcc-4.0.1/debug/hello.o
gcc.link.dll
/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/libboost_python.dylib
*i686-apple-darwin8-g++-4.0.1: unrecognized option '-shared'*
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: unknown flag: -R
collect2: ld returned 1 exit status

    "g++"
-L"/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib"
-L"/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/config"
-Wl,-R -Wl,"/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib"
-Wl,-R
-Wl,"/opt/local/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/config"
-o
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/libboost_python.dylib"
-Wl,-h -Wl,libboost_python.dylib -shared -Wl,--start-group
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/numeric.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/list.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/long.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/dict.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/tuple.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/str.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/slice.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/converter/from_python.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/converter/registry.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/converter/type_id.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/object/enum.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/object/class.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/object/function.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/object/inheritance.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/object/life_support.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/object/pickle_support.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/errors.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/module.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/converter/builtin_converters.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/converter/arg_to_python_base.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/object/iterator.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/object/stl_iterator.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/object_protocol.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/object_operators.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/wrapper.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/import.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/exec.o"
"/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/object/function_doc_signature.o"
-Wl,-Bstatic -Wl,-Bdynamic -lpython2.5 -Wl,--end-group -g

...failed gcc.link.dll
/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug/libboost_python.dylib...
...skipped <pbin/gcc-4.0.1/debug>hello_ext.so for lack of
<p/usr/local/boost/bin.v2/libs/python/build/gcc-4.0.1/debug>libboost_python.dylib...
common.mkdir bin/hello.test
common.mkdir bin/hello.test/gcc-4.0.1
common.mkdir bin/hello.test/gcc-4.0.1/debug
...skipped <pbin/hello.test/gcc-4.0.1/debug>hello for lack of
<pbin/gcc-4.0.1/debug>hello_ext.so...
...failed updating 1 target...
...skipped 3 targets...
...updated 7 targets...

I'm not sure what is going wrong, but I know that the -dynamiclib flag is
needed instead of the -shared flag on OS X. Could this is what is going
wrong? I wouldn't know how to change bjam to use -dynamiclib instead of
-shared in any case.
Thanks for any help that anyone can provide.

Aditya



Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk