[C++-sig] Linking to libboost_python, on Ubuntu - I've forgotten something...

Simon Pickles sipickles at hotmail.com
Sun Nov 16 19:02:17 CET 2008


Hello,

I am setting up boost python on a new Ubuntu system. I thought I had 
everything configured correctly, but think I may have missed a vital step.

When I run the python program which attempts to use the library 
generated by bjam, I get this:

simon at urth-webserver:~/WorkingCopies/server/trunk/hybrid_test$ python 
hybridTest.py
Traceback (most recent call last):
  File "hybridTest.py", line 2, in <module>
    import Hybrid
ImportError: libboost_python-gcc42-d-1_37.so.1.37.0: cannot open shared 
object file: No such file or directory


I have built boost 1.37.0 from source using:

sudo bjam -sPYTHON_ROOT=/usr/local/lib/python25 -sPYTHON_VERSION=2.5 
--build-type=complete --toolset=gcc stage

(its a stackless python build in /usr/local/lib/python25)

I've set the config files I think:

#--------------------------------------------------
# user-config.jam in home directory

# Compiler configuration
using gcc ;

# Python configuration
using python : 2.5 : /usr/local/bin/python ;
#-----------------------------------------------------------------

# boost-build.jam in project folder
boost-build /home/simon/Source/boost_1_37_0/tools/build/v2 ;

#-----------------------------------------------------------------

# jamroot in project folder

use-project boost
  : /home/simon/Source/boost_1_37_0 ;


# Set up the project-wide requirements that everything uses the
# boost_python library defined in the project whose global ID is
# /boost/python.
project Hybrid
  : requirements     <library>/boost/python//boost_python
                    <include>/home/simon/Source/bullet-2.72/src
                    
<library>/home/simon/Source/boost_1_37_0/stage/lib/libboost_python-gcc42-d-1_37.so.1.37.0
    ;

## Make the definition of the python-extension rule available
import python ;

# Declare a Python extension
python-extension Hybrid : [ glob Log/*.cpp ] [ glob Object/*.cpp ] [ 
glob World/*.cpp ] HybridModule.cpp ;
install . : Hybrid ;

#---------------------------------------------------------------------

This build successfully with bjam, and I am left with the expected 
Hybrid.so in the project folder.

As you can see from the jamroot file, I've even tried directly 
specifying the library libboost_python-gcc42-d-1_37.so.1.37.0

Can anyone suggest where I have missed a trick?

Many thanks

Simon


-- 
Linux User# 424693 






More information about the Cplusplus-sig mailing list