Boost.Python sans Jam

Philip Austin paustin at eos.ubc.ca
Sat Nov 23 20:00:12 EST 2002


Mark <Hobbes2176 at yahoo.com> writes:

> Now, I realized I needed to do one thing before running [not necessarily 
> before compiling my "boostable" extension]:
> 
> export LD_LIBRARY_PATH=~/lib
> 
> To compile, I used the following command line [there may be some unnecessary 
> stuff in here]:
> 
> g++ hello.cpp -I/home/mfenner/include -I/usr/include/python2.2/ 
> -L/usr/lib/python2.2/config -L/home/mfenner/lib -lpython2.2 -lboost_python 
> -o hello.so -shared

1) If you want to remove the dependence on LD_LIBRARY_PATH, you
can pass the runpath to the loader directly like this:

 g++ hello.cpp -I/home/mfenner/include -I/usr/include/python2.2/ 
 -Wl,-rpath,/home/mfenner/lib 
  -L/usr/lib/python2.2/config -L/home/mfenner/lib -lpython2.2 -lboost_python 
 -o hello.so -shared

You can check to make sure this works with

ldd hello.so

which should find all of the relocatable
libraries linked by hello.so

2) If you want to see what bjam is really passing to g++,
invoke bjam during the boost build with the flags -and2

You'll see that boost recommends something 
like this for a typical compile:

g++ -c -Wall -ftemplate-depth-100 -DBOOST_PYTHON_DYNAMIC_LIB -DBOOST_PYTHON_V2 -g -O0 -fno-inline -fPIC -I/nfs/kite/common/python2.2.2/include/python2.2 -idirafter"/nfs/kite/common/boostv2_gcc3.2.1" -o num_util.o 

Regards, Phil



More information about the Python-list mailing list