0
votes

I am trying to execute linking of C++ and Python with BOOST.

Using the example from https://www.boost.org/doc/libs/1_63_0/libs/python/doc/html/tutorial/tutorial/hello.html#tutorial.hello.let_s_jam, and issuing bjam at ~/libs/python/example/tutorial/ which contains these files:

hello.cpp  hello.py  Jamfile

The read-out from the console error is:

/home/benjamin/boost/boost_1_71_0/tools/build/src/tools/types/xml.jam:12: 
in load ERROR: rule "Copyright" unknown in module "xml".

Here is what I undertook to solve this problem:

  1. I built boost from boost_1_71_0.tar.bz2 using the ./b2 file in the directory /boost/boost_1_71_0/ which is dated November 14, 2019.

  2. My Ubuntu 18.04 system has a b2 link at /usr/bin/b2 -> bjam, which is older (March 6, 2018) and the bjam file (March 6, 2018).

  3. No other bjam files exist on the system.

  4. From bjam for boost 1.54, I tried:

    sudo-apt install bjam

    error: E: Package 'bjam' has no installation candidate.

  5. All the programs in the user-config.jam file (e.g., c++, msvc/code, python3) are correct, which is located in my /home/benjamin/boost/boost_1_71_0/tools/build/example/.

For pity's sake and to help me (newbie), please advise.

1
Why don't you install the packages from the OS? Also, apt-get build-dep .. allows you to install all build dependencies for a package, which should be sufficient for building from raw sources as well.Ulrich Eckhardt
Danke, Ulrich. I didn't know that Ubuntu 18.04 'shipped' with a ready-to-install Boost program; no searching of the internet for information on using Boost was apparent. I did try, tho'. So, you are telling me: 1) remove the version of boost that I have, 2) install it from some directory in the OS (/usr/bin/), and take it from there? I can do that, but I would like to know if there is an answer to my question (even if not useful ultimately).Benjamin Levy
Nono, use Ubuntu's package manager. Since it's based on Debian, apt search libboost should give you an overview of available packages. I'm not a Ubuntu user though, so I can't say if it offers other frontends than apt, too. As I said, this may well be more suitable to e.g. superuser.com or a Ubuntu-specific forum.Ulrich Eckhardt

1 Answers

0
votes

Looking at error message it seems that error is with file /home/benjamin/boost/boost_1_71_0/tools/build/src/tools/types/xml.jam

I checked with my local installation (which is boost 1.65.1), but I am not able to locate any file with name xml.jam. But I have few other .jam file at location /usr/share/boost-build/src/tools/types/. As example

asm.jam

# Copyright Craig Rodrigues 2005. Distributed under the Boost
# Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
type ASM : s S asm ;

So it seems that your xml.jam either invalid OR few lines should be commented (as in above file).

Try below options.

  1. Check your xml.jam, if there are any content which are not related jam then you should comment out information.
  2. Rename your xml.jam to xml.jam.bkp. This file may not be needed.(Not needed in my case with boost 1.65.1)
  3. Try to install everything from Ubuntu package manager and use that. You can install all boost module by sudo apt install libboost-all-dev. I tried https://github.com/boostorg/python/tree/develop/example code with my local installed boost (1.65.1) from package manager and it work fine.