How can I create a Boost.Python example on Ubuntu 9.10?

I am using Ubuntu 9.10 beta whose repositories contain boost 1.38. I would like to build an hello-world example. I followed the instructions here ( http://www.boost.org/doc/libs/1_40_0/libs/python/doc/tutorial/doc/html/python/hello.html ), found an example project and issued the "bjam" command. I installed bjam and boost-build.

I get the following output:

Jamroot:18: in modules.load rule python-extension unknown in module Jamfile</usr/share/doc/libboost1.38-doc/examples/libs/python/example>. /usr/share/boost-build/build/project.jam:312: in load-jamfile /usr/share/boost-build/build/project.jam:68: in load /usr/share/boost-build/build/project.jam:170: in project.find /usr/share/boost-build/build-system.jam:248: in load /usr/share/boost-build/kernel/modules.jam:261: in import /usr/share/boost-build/kernel/bootstrap.jam:132: in boost-build /usr/share/doc/libboost1.38-doc/examples/libs/python/example/boost-build.jam:7: in module scope 

I don’t know enough about Boost (this is a study for myself) to understand why the python extension macro in Jamroot included is not valid. I run this example from the installation directory, so I have not changed the setting for using the Jamroot project.

As a side question, if I just willy-nilly started a project in an arbitrary directory, how would I write my jam?

+4
source share
1 answer

The problem arises from using the Ubuntu package instead of boost compiled from the source code. You should edit Jamroot for you to say that it uses the global libboost-python, instead of looking for lib in the relative boost source tree.

In general, you should have these lines at the beginning of your Jamroot:

 using python ; lib libboost_python : : <name>boost_python ; project : requirements <library>libboost_python ; 

A bug was reported in Debian and fixed at least on lenny with libboost-python1.40 ... basically. The example in libboost_python still applies to boost_python-mt instead of boost_python, but / usr / lib / libboost _python.so exists but not / usr / lib / libboost _python-mt.so.

I hope Ubuntu will soon have the same fix, and the next user will not stumble on this ... I know the answer to your question because I did the same problem not so long ago.

+4
source

All Articles