n3wb question: Compiling boost::python "hello world" demo

I'm an experienced python developer, but unfortunately a ten-years out of practice C++ developer. For a future project I was hoping to play with Boost.python as a means of speeding up some calculations that were very tedious in python. For starters I wanted to get the "hello.cpp" demo compiling, but I am failing almost at step one. For starters in this file I am supposed to set the BOOST_ROOT: http://www.boost.org/libs/python/example/tutorial/Jamrules However I am not 100% sure that the operating system (Gentoo Linux) even installed the files in the right area. Is there a particular file that is allways going to be in the "BOOST ROOT", that way I will know for certain what to run. Next I am supposed to set up some environment variables. The instructions provided are for Windows only and say: " Make sure that the environment is set so that we can invoke the C++ compiler. With MSVC, that would mean running the Vcvars32.bat batch file. For instance:" Is there a Linux equivalent? Next I am told to use "bjam" to do the actual build. The instructions are once again very windows-centric: "bjam -sTOOLS=vc-7_1" What might be the corresponding syntax for users of GNU C++? Thanks! Sal

# salimfadhley@gmail.com / 2006-06-11 03:34:00 +0100:
I'm an experienced python developer, but unfortunately a ten-years out of practice C++ developer. For a future project I was hoping to play with Boost.python as a means of speeding up some calculations that were very tedious in python.
For starters I wanted to get the "hello.cpp" demo compiling, but I am failing almost at step one.
For starters in this file I am supposed to set the BOOST_ROOT: http://www.boost.org/libs/python/example/tutorial/Jamrules
However I am not 100% sure that the operating system (Gentoo Linux) even installed the files in the right area. Is there a particular file that is allways going to be in the "BOOST ROOT", that way I will know for certain what to run.
Next I am supposed to set up some environment variables. The instructions provided are for Windows only and say:
They're OS-specific notes, you have the functionality "for free" on Linux, so there's no advice.
" Make sure that the environment is set so that we can invoke the C++ compiler. With MSVC, that would mean running the Vcvars32.bat batch file. For instance:"
Is there a Linux equivalent?
No, you should be set "by default".
Next I am told to use "bjam" to do the actual build. The instructions are once again very windows-centric:
"bjam -sTOOLS=vc-7_1"
What might be the corresponding syntax for users of GNU C++?
Probably "bjam -sTOOLS=gcc", or "bjam -sTOOLS=gcc-stlport". http://www.boost.org/libs/python/doc/building.html could use some improvements. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991

Roman Neuhauser wrote:
Probably "bjam -sTOOLS=gcc", or "bjam -sTOOLS=gcc-stlport".
http://www.boost.org/libs/python/doc/building.html could use some improvements.
I tried both of the above, and "bjam" with no options at all and on each occasion the following error happened. It says that "no toolsets are configured" - so how does one cofigure a toolset? And which of the enormous quantity of boost documentation is it asking me to refer to? Could this mean that the Gentoo build of boost.python is flawed? If so, can anybody express the nature of this fault in such a way that I can raise it as a bug report on the gentoo bug tracker? Thanks ============= sal@pabstus /usr/share/boost-build/v2/example/hello $ bjam warning: no toolsets are configured. warning: you won't be able to build C++ programs. warning: please consult the documentation. /usr/share/boost-build/v2/build/targets.jam:1245: in construct from module object(typed-target)@1 error: unable to construct ./hello /usr/share/boost-build/v2/build/targets.jam:1128: in object(typed-target)@1.generate from module object(typed-target)@1 /usr/share/boost-build/v2/build/targets.jam:757: in generate-really from module object(main-target)@1 /usr/share/boost-build/v2/build/targets.jam:730: in object(main-target)@1.generate from module object(main-target)@1 /usr/share/boost-build/v2/build/targets.jam:252: in object(project-target)@3.generate from module object(project-target)@3 /usr/share/boost-build/v2/build-system.jam:276: in load from module build-system /usr/share/boost-build/v2/example/../kernel/modules.jam:259: in import from module modules /usr/share/boost-build/v2/example/../kernel/bootstrap.jam:153: in boost-build from module /usr/share/boost-build/v2/example/boost-build.jam:2: in module scope from module sal@pabstus /usr/share/boost-build/v2/example/hello $

Questions following on from the last response:
However I am not 100% sure that the operating system (Gentoo Linux) even installed the files in the right area. Is there a particular file that is allways going to be in the "BOOST ROOT", that way I will know for certain what to run.
So can somebody give me an example of one of the files that is likely to be in the BOOST_ROOT folder? If I look for this file then I can find it's containing directory, and then I know for certain what my linux distribution counts as boost-root.
PS. Are there any other users who are running Boost Python on Gentoo Linux? The documents do seem to be very windows-centric.

Salim Fadhley writes:
So can somebody give me an example of one of the files that is likely to be in the BOOST_ROOT folder? If I look for this file then I can find it's containing directory, and then I know for certain what my linux distribution counts as boost-root.
PS. Are there any other users who are running Boost Python on Gentoo Linux? The documents do seem to be very windows-centric.
(note that that there is a mailing list specifically for boost python: c++-sig@python.org which will generally give you faster response on bp questions) This worked for me in January (Linux FC3): 1) build jam: ~/install/boost_1_33_1/tools/build/jam_src phil@gull% sh ./build.sh 2) export python variables export PYTHON_VERSION=2.4 export PYTHON_ROOT=/home/phil/usr242 3) run all tests cd ~/install/boost_1_33_1/libs/python/test ~/install/boost_1_33_1/tools/build/jam_src/bin.linuxx86/bjam "-sTOOLS=gcc" test or a single test: ~/install/boost_1_33_1/tools/build/jam_src/bin.linuxx86/bjam -d2 "-sTOOLS=gcc" numpy (the -d2 lets you see the compile flags bjam is using) 4) move the library (for my own work I just use make and the flags I get from step 3) cp -a \ /home/phil/install/boost_1_33_1/bin/boost/libs/python/build/libboost_python.so/gcc/debug/shared-linkable-true \ /home/phil/lib/boost_lib_1_33_1/debug best, Phil Austin
participants (3)
-
Philip Austin
-
Roman Neuhauser
-
Salim Fadhley