Boost logo

Boost-Build :

From: Jono (bitrat_at_[hidden])
Date: 2021-09-10 06:49:22


Hi all,

this is my first post to this list, so apologies for any departures from protocol.

This intro is also a bit rambling, but I want to illustrate the general area of my ignorance, in the hope somebody can direct me to the most helpful docs.

I'm setting up boost on an ubuntu machine (and later a raspberry-pi and a debian VPS) to write some network software. I've used boost in the past, but not for ten years or so..

Being lazy, I installed it with "sudo apt-get install libboost-all-dev" but found it was an old version, without Boost.Beast, which I'd like to try. Also, I was expecting the install would set up some environment variables for include and lib paths, etc, but I had to do this manually...

I uninstalled boost using "sudo apt-get remove libboost-all-dev", but found I had to remove the headers directory and shared libraries manually.

sudo rm -rf /usr/include/boost
sudo rm /usr/lib/x86_64-linux-gnu/libboost*

I then did what I should have done to begin with and cloned the repo into a local directory:

git clone --recursive https://github.com/boostorg/boost.git
cd boost
./bootstrap.sh
./b2
./b2 headers

When I tried using b2 from another directory, it produced errors unless I used the full path name. I realised the bjam binary and a softlink named b2 were still in /usr/bin, so I deleted them and made a soft link there to my new b2.

This builds the example code fine but, say I build the file in ./libs/beast/example/http/client/sync, the executable ends up in:
bin.v2/libs/beast/example/http/server/sync/gcc-7/debug/threading-multi/visibility-hidden/http-server-sync

This is the Jamfile text:

exe http-server-sync :
    http_server_sync.cpp
    :
    <variant>coverage:<build>no
    <variant>ubasan:<build>no
    ;

If I go to tools/build/example/hello and run b2, the binaries are found in a bin folder under the current directory. This is the jam file (here called 'jamroot.jam') text:

exe hello : hello.cpp ;

How are build variants organised and what dictates the binary output locations? Just a pointer to the relevant doc would be great! :)

My overall question is, what is the recommended procedure for installing boost and configuring the build environment? I'd like it to be easy to run build tools from inside VSCode etc, but also convenient to install and use on a raspberry pi or VPS via ssh.

I haven't decided what other build tools I need to meld with bjam, but probably make and scons. I like bjam, but I have mixed language projects that use other makes. Is there an accepted strategy for this? When I've used boost in the past, bjam has been the top level build tool.

I'd prefer to keep the entire installation local, as it is now. Btw, have I removed all remnants of the apt-get install?

I'll also likely write a script to clone and install a tagged boost release. What are the recommended ones?

Finally, turf wars aside, is there any inherent advantage in using clang++ instead of g++ for development with boost?

Sorry again if this is all too obvious or subjective. I don't have much time to experiment.

Cheers,
Jono

-- 
  Jono
  bitrat_at_[hidden]

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk