Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to compile using boost.python?
    primarykey
    data
    text
    <p>I am trying to compile a project using boost.python as documented <a href="http://www.boost.org/doc/libs/1_55_0/libs/python/doc/tutorial/doc/html/python/hello.html" rel="nofollow">on this page</a>. My platform is MacOS X, i386 architecture. I am using the current version of boost, v1.55. The example provided in <code>${BOOST}/libs/python/example/tutorial/</code> compiles and works properly. However, when setting up my own project in a different directory outside of the <code>boost</code> root directory, I run into the following problem: when I type <code>${BOOST}/bjam toolset=darwin architecture=x86 address-model=32</code> I get the following error message:</p> <pre><code>Unable to load Boost.Build: could not find "boost-build.jam" --------------------------------------------------------------- Attempted search from ${CURRENT_PATH} up to the root at ${SOME_OTHER_PATH} and in these directories from BOOST_BUILD_PATH and BOOST_ROOT: /usr/share/boost-build. Please consult the documentation at 'http://www.boost.org'. make: *** [all] Error 1 </code></pre> <p>The documentation of the <code>bjam</code> tool is not referenced, <code>bjam --help</code> only returns an error message and Googling only finds <a href="http://www.boost.org/boost-build2/doc/html/bbv2/jam.html" rel="nofollow">this page</a> (which doesn't talk about the problem at all) and <a href="http://www.boost.org/doc/libs/1_42_0/doc/html/jam/usage.html" rel="nofollow">this page</a> (which seems to be outdated as indicated by the link at the top of the page).</p> <p><strong>Question:</strong> How do I specify the path of the <code>boost-build.jam</code> file? Or, alternatively, is there any other way to use boost.python with standard tools?</p> <p><strong>Update 3:</strong> The option <code>-d4</code> lets <code>bjam</code> print verbose debugging output. If the name of the compiler is known, the output can be <code>grep</code>ped for the compiler invocation. This can then be used to construct a "regular" <code>Makefile</code>. See e.g. <a href="http://www.shocksolution.com/python-basics-tutorials-and-examples/linking-python-and-c-with-boostpython/" rel="nofollow">this post</a> for an example of how to do so (albeit it assumes that the compile and linker commands are known).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COMost boost libraries are header-only (i.e. you only have to provide the include path to use them), but boost.python is not one of them. It has two parts: the headers and the .so. `bjam`'s only task is to build the .so files, after that you don't need it anymore. Just link to the .so like you would to any other library.
      singulars
    2. CO@Adam: I had a situation where "just linking to the .so" did not work. The library was not usable in Python unless I used the correct options when linking the file. These turned out to be compiler and platform-specific and they are not identical to the naive expectations. The boost.python tutorial page explicitly recommends to use `bjam` to also build my own artifacts, presumably for the very reasons I have encountered.
      singulars
    3. COAre you married to boost.python for any particular reason? I like some of the design of boost.python, but the build requirements is exactly why I chose SWIG instead. In my opinion if you want to distribute code to others then these build requirements make boost.python a non-starter. Python can be very picky about build flags and some extensions simply won't link. SWIG emits a .cpp file that is compiled along with the rest of your extension. You can, for example, use distutils which will give you all the flags for the particular Python installation you're building for.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload