构建boost-python示例

时间:2014-03-01 21:06:00

标签: c++ boost boost-python jam

我正在运行Ubuntu 13.10。我安装了libboost1.54-dev。

我做了一个关于Boost的Git结账,然后结帐了“boost-1.54.0”。

我在源代码中将目录更改为boost / libs / python / example / tutorial。

我跑了“bjam”。我明白了:

$ 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'.

示例目录中只有三个文件:

-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

指示说它应该很简单:http://www.boost.org/doc/libs/1_54_0/libs/python/doc/tutorial/doc/html/python/hello.html

最后几行是:

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

为什么要寻找boost-build.jam?我错过了什么?

2 个答案:

答案 0 :(得分:3)

您可以创建自己的boost-build.jam。对于quickstart示例(已损坏),只需创建一个名为boost-build.jam的文件,并确保它指向 src 目录。这里讨论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 ;

答案 1 :(得分:1)

本质上,bjam是一个解释器,Boost.Build是一个用bjam文件编写的构建系统。当bjam启动时,它将尝试找到Boost.Build的jam文件。在这种情况下,bjam试图找到相对于教程的boost-build.jam和错误时的错误。要构建教程,请:

  • 验证是否已从boost git存储库中初始化boost/tools/build子模块。 Boost.Python有其他依赖项,因此初始化所有子模块可能更容易。这将允许从libboost1.54-dev包安装的bjam解释器从存储库中找到Boost.Build,并构建教程及其依赖项。
  • 针对打包的库构建:

    • 安装libboost1.54包。这将安装Boost.Python共享库及其依赖项。
    • 修改教程的Jamroot文件。它应该不再尝试使用boost项目,并且应该明确列出Boost.Python共享库路径:

      -# 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 ;
      

      可能需要根据libboost-python1.54-dev打包安装Boost.Python库的位置更改库路径和名称。

    • BOOST_BUILD_PATH环境变量设置为/usr/share/boost-build/kernellibboost1.54-dev软件包安装boost-build.jam的任何位置。