Boost Libraries Debug and Release Build on Linux
Asked Answered
S

2

3

I am having issues while building the Boost Library on Ubuntu 16.04 LTS with gcc-8.

Currently I need to build both the Debug and Release built libraries.

Here are the commands I have used to build the library for debug build:

$ ./bootstrap.sh --with-libraries=all --with-python-version=3.5 --with-icu="/usr/include/x86_64-linux-gnu/"
###################
# For Debug build #
###################
$ ./b2 toolset=gcc-8 cxxflags="-std=c++17" variant=debug
#####################
# For Release build #
#####################
$ ./b2 toolset=gcc-8 cxxflags="-std=c++17" variant=release

The issue is that even with variant specified as debug or release, the build builds the libraries with the same names.

Each build step overwrites the libraries built by the previous command.

How can I get the Debug libraries with probable suffix -d as per the documentation mentioned here?

I also tried to look into the boost-build reference mentioned here. But I am getting a Error 404 page is not found.

The old reference for Boost Build as found here also does not seems to have the necessary details of building the boost libraries in both debug and release modes.

Thanks in advance.

Scalise answered 22/1, 2019 at 11:5 Comment(0)
G
2

As mentioned in the --help information, on Unix type systems the default for --layout is system which doesn't add the tagging that allows for multiple build variations to coexist:

--layout=<layout>       Determine whether to choose library names and header
                        locations such that multiple versions of Boost or
                        multiple compilers can be used on the same system.

                          -- versioned -- Names of boost binaries include
                          the Boost version number, name and version of
                          the compiler and encoded build properties. Boost
                          headers are installed in a subdirectory of
                          <HDRDIR> whose name contains the Boost version
                          number.

                          -- tagged -- Names of boost binaries include the
                          encoded build properties such as variant and
                          threading, but do not including compiler name
                          and version, or Boost version. This option is
                          useful if you build several variants of Boost,
                          using the same compiler.

                          -- system -- Binaries names do not include the
                          Boost version number or the name and version
                          number of the compiler. Boost headers are
                          installed directly into <HDRDIR>. This option is
                          intended for system integrators building
                          distribution packages.

                        The default value is 'versioned' on Windows, and
                        'system' on Unix.

You can use either the --layout=tagged or --layout=versioned options to allow the multiple variants when you build.

There is also a --buildid=ID option, also listed in the --help output, that will let you put a custom tag on the results. Useful in the cases where you want a shorter name or to keep things as simple as possible. But beware that since it's custom consumers, i.e. build systems, will not likely know how to deal with the names.

Gowan answered 18/3, 2019 at 2:56 Comment(1)
I was looking for something similar to cmake option: CMAKE_DEBUG_POSTFIX, I tried this solution earlier but it involves changing the library name dependencies in all of the repositories which have dependencies on boost libraries instead of just specifying the base-names of the libraries. And this quickly becomes difficult when one wants to have cross-platform support also.Scalise
F
0

https://www.boost.org/doc/libs/1_62_0/tools/build/tutorial.html

debug-symbols=on variant=debug options set builds debug configuration:

<debug-symbols> on, off - Create debug symbols.

<variant>   debug, release, profile - Build debug, release or profile version.

-a option also useful beacuse it builds all possible configuration combinations.

This way b2 -a install cover all possible needs in boost.

Fitch answered 15/1, 2021 at 5:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.