Dustin Oprea
Dustin Oprea

Reputation: 10276

Building boost-python example

I'm running Ubuntu 13.10 . I installed libboost1.54-dev.

I did a Git checkout of Boost, and did a checkout to "boost-1.54.0".

I changed directories to boost/libs/python/example/tutorial in the source.

I ran "bjam". I get:

$ bjam
Unable to load Boost.Build: could not find build system.
---------------------------------------------------------
/home/dustin/build/boost/libs/python/example/boost-build.jam attempted to load the build system by invoking

   'boost-build ../../../tools/build/v2 ;'

but we were unable to find "bootstrap.jam" in the specified directory
or in BOOST_BUILD_PATH (searching /home/dustin/build/boost/libs/python/example/../../../tools/build/v2, /usr/share/boost-build).

Please consult the documentation at 'http://www.boost.org'.

There are only three files in the example directory:

-rw-r--r-- 1 dustin dustin  484 Mar  1 12:59 hello.cpp
-rwxr-xr-x 1 dustin dustin  275 Mar  1 12:59 hello.py
-rw-r--r-- 1 dustin dustin 1445 Mar  1 15:43 Jamroot

The directions say that it should be just that easy: http://www.boost.org/doc/libs/1_54_0/libs/python/doc/tutorial/doc/html/python/hello.html

The last few lines of the strace is:

openat(AT_FDCWD, "/home/dustin/build/boost/libs/python/example/tutorial", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/home/dustin/build/boost/libs/python/example", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/usr/share/boost-build", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
open("/home/dustin/build/boost/libs/python/example/boost-build.jam", O_RDONLY) = 3

Why is it looking for boost-build.jam? What am I missing?

Upvotes: 0

Views: 2549

Answers (2)

Rhombus
Rhombus

Reputation: 101

You can create your own boost-build.jam. For quickstart example (which is broke) just create a file called boost-build.jam with this in it and make sure it points to the src directory. It is discussed here http://lists.boost.org/boost-build/2014/11/27738.php

# Edit this path to point at the tools/build/v2 subdirectory of your
# Boost installation.  Absolute paths work, too.
boost-build ../../../../tools/build/src ;

Upvotes: 3

Tanner Sansbury
Tanner Sansbury

Reputation: 51971

In essence, bjam is an interpreter, and Boost.Build is a build system written in bjam files. When bjam starts, it will attempt to locate the jam files for Boost.Build. In this case, bjam attempted to locate boost-build.jam relative to the tutorial and errors when it is missing. To build the tutorial, either:

  • Verify that the boost/tools/build submodule has been initialized from within the boost git repository. Boost.Python has other dependencies, so it may be easier to initialize all submodules. This will allow the bjam interpreter installed from the libboost1.54-dev package to locate Boost.Build from within the repository, and build the tutorial and its dependencies.
  • To build against packaged libraries:

    • Install the libboost1.54 package. This will install the Boost.Python shared library and its dependencies.
    • Modify the tutorial's Jamroot file. It should no longer attempt to use the boost project, and should explicitly list the Boost.Python shared library path:

      -# Specify the path to the Boost project.  If you move this project,
      -# adjust this path to refer to the Boost root directory.
      -use-project boost
      -  : ../../../.. ;
      -
       # Set up the project-wide requirements that everything uses the
      -# boost_python library from the project whose global ID is
      -# /boost/python.
      +# boost_python library.
       project
      -  : requirements <library>/boost/python//boost_python ;
      +  : requirements <library>/usr/lib/libboost_python-py27.so ;
      

      The library path and name may need to be changed based on where the libboost-python1.54-dev packaged installed the Boost.Python library.

    • Set the BOOST_BUILD_PATH environment variable to /usr/share/boost-build/kernel or wherever the libboost1.54-dev package installed boost-build.jam.

Upvotes: 1

Related Questions