samcmill: @SimeonEhrig does this address the issues to your satisifcation?
SimeonEhrig: @samcmill I tested the code successful and it does what I expected. Thanks for the fix.
diff --git a/docs/building_blocks.md b/docs/building_blocks.md
index 8178a5a..c13ed81 100644
--- a/docs/building_blocks.md
+++ b/docs/building_blocks.md
@@ -209,6 +209,9 @@ The `boost` building block downloads and installs the
 __Parameters__
 
 
+- __b2_opts__: List of options to pass to `b2`.  The default is an empty
+list.
+
 - __bootstrap_opts__: List of options to pass to `bootstrap.sh`.  The
 default is an empty list.
 
@@ -233,7 +236,8 @@ is `/usr/local/boost`.
 - __python__: Boolean flag to specify whether Boost should be built with
 Python support.  If enabled, the Python C headers need to be
 installed (typically this can be done by adding `python-dev` or
-`python-devel` to the list of OS packages).  The default is False.
+`python-devel` to the list of OS packages).  This flag is ignored
+if `bootstrap_opts` is set.  The default is False.
 
 - __sourceforge__: Boolean flag to specify whether Boost should be
 downloaded from SourceForge rather than the current Boost
diff --git a/hpccm/building_blocks/boost.py b/hpccm/building_blocks/boost.py
index c1fc959..8bd1df2 100644
--- a/hpccm/building_blocks/boost.py
+++ b/hpccm/building_blocks/boost.py
@@ -46,6 +46,9 @@ class boost(bb_base, hpccm.templates.envvars, hpccm.templates.ldconfig,
 
     # Parameters
 
+    b2_opts: List of options to pass to `b2`.  The default is an empty
+    list.
+
     bootstrap_opts: List of options to pass to `bootstrap.sh`.  The
     default is an empty list.
 
@@ -70,7 +73,8 @@ class boost(bb_base, hpccm.templates.envvars, hpccm.templates.ldconfig,
     python: Boolean flag to specify whether Boost should be built with
     Python support.  If enabled, the Python C headers need to be
     installed (typically this can be done by adding `python-dev` or
-    `python-devel` to the list of OS packages).  The default is False.
+    `python-devel` to the list of OS packages).  This flag is ignored
+    if `bootstrap_opts` is set.  The default is False.
 
     sourceforge: Boolean flag to specify whether Boost should be
     downloaded from SourceForge rather than the current Boost
@@ -97,6 +101,7 @@ class boost(bb_base, hpccm.templates.envvars, hpccm.templates.ldconfig,
 
         super(boost, self).__init__(**kwargs)
 
+        self.__b2_opts = kwargs.get('b2_opts', [])
         self.__baseurl = kwargs.get('baseurl',
                                     'https://dl.bintray.com/boostorg/release/__version__/source')
         self.__bootstrap_opts = kwargs.get('bootstrap_opts', [])
@@ -166,7 +171,7 @@ class boost(bb_base, hpccm.templates.envvars, hpccm.templates.ldconfig,
         # standard Python install.  It requires the development
         # package, python-dev or python-devel.  So skip Python unless
         # it's specifically enabled.
-        if not self.__python:
+        if not self.__bootstrap_opts and not self.__python:
             self.__bootstrap_opts.append('--without-libraries=python')
 
         # Download source from web
@@ -182,7 +187,9 @@ class boost(bb_base, hpccm.templates.envvars, hpccm.templates.ldconfig,
                 ' '.join(self.__bootstrap_opts)))
 
         # Build and install
-        self.__commands.append('./b2 -j{} -q install'.format(self.__parallel))
+        self.__b2_opts.append('-j{}'.format(self.__parallel))
+        self.__b2_opts.append('-q install')
+        self.__commands.append('./b2 {0}'.format(' '.join(self.__b2_opts)))
 
         # Set library path
         libpath = posixpath.join(self.__prefix, 'lib')

Building block Boost: add possibility to pass args to ./b2
I want to build my boost with C++ 14, so I need to pass the flag `cxxflags="-std=c++14"` to the `./b2` build process: `./b2 cxxflags="-std=c++14" -j$(nproc) -q install`. There is currently no way to pass arguments to `./b2`: https://github.com/NVIDIA/hpc-container-maker/blob/5d7c29c4a16c59dbce7a21a51fed5d5e18e73763/hpccm/building_blocks/boost.py#L185
diff --git a/test/test_boost.py b/test/test_boost.py
index f417497..fa40659 100644
--- a/test/test_boost.py
+++ b/test/test_boost.py
@@ -141,6 +141,49 @@ RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp https://
     echo "/usr/local/boost/lib" >> /etc/ld.so.conf.d/hpccm.conf && ldconfig && \
     rm -rf /var/tmp/boost_1_68_0.tar.bz2 /var/tmp/boost_1_68_0''')
 
+    @ubuntu
+    @docker
+    def test_bootstrap_opts(self):
+        b = boost(bootstrap_opts=['--with-libraries=atomic,chrono'],
+                  version='1.72.0')
+        self.assertEqual(str(b),
+r'''# Boost version 1.72.0
+RUN apt-get update -y && \
+    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
+        bzip2 \
+        libbz2-dev \
+        tar \
+        wget \
+        zlib1g-dev && \
+    rm -rf /var/lib/apt/lists/*
+RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.bz2 && \
+    mkdir -p /var/tmp && tar -x -f /var/tmp/boost_1_72_0.tar.bz2 -C /var/tmp -j && \
+    cd /var/tmp/boost_1_72_0 && ./bootstrap.sh --prefix=/usr/local/boost --with-libraries=atomic,chrono && \
+    ./b2 -j$(nproc) -q install && \
+    rm -rf /var/tmp/boost_1_72_0.tar.bz2 /var/tmp/boost_1_72_0
+ENV LD_LIBRARY_PATH=/usr/local/boost/lib:$LD_LIBRARY_PATH''')
+
+    @ubuntu
+    @docker
+    def test_b2_opts(self):
+        b = boost(b2_opts=['cxxflags="-std=c++14"'], version='1.72.0')
+        self.assertEqual(str(b),
+r'''# Boost version 1.72.0
+RUN apt-get update -y && \
+    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
+        bzip2 \
+        libbz2-dev \
+        tar \
+        wget \
+        zlib1g-dev && \
+    rm -rf /var/lib/apt/lists/*
+RUN mkdir -p /var/tmp && wget -q -nc --no-check-certificate -P /var/tmp https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.bz2 && \
+    mkdir -p /var/tmp && tar -x -f /var/tmp/boost_1_72_0.tar.bz2 -C /var/tmp -j && \
+    cd /var/tmp/boost_1_72_0 && ./bootstrap.sh --prefix=/usr/local/boost --without-libraries=python && \
+    ./b2 cxxflags="-std=c++14" -j$(nproc) -q install && \
+    rm -rf /var/tmp/boost_1_72_0.tar.bz2 /var/tmp/boost_1_72_0
+ENV LD_LIBRARY_PATH=/usr/local/boost/lib:$LD_LIBRARY_PATH''')
+
     @ubuntu
     @docker
     def test_runtime(self):

pip install -e .
parse_log_pytest
pytest
enum34 six pytest
apt-get update apt-get install -y gcc
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
enum34==1.1.10
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
-e git+https://github.com/NVIDIA/hpc-container-maker.git@5d7c29c4a16c59dbce7a21a51fed5d5e18e73763#egg=hpccm
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
pytest @ file:///croot/pytest_1738938843180/work
six==1.17.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work

name: hpc-container-maker
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - exceptiongroup=1.2.0=py39h06a4308_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - packaging=24.2=py39h06a4308_0
  - pip=25.0=py39h06a4308_0
  - pluggy=1.5.0=py39h06a4308_0
  - pytest=8.3.4=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tomli=2.0.1=py39h06a4308_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - enum34==1.1.10
      - six==1.17.0
prefix: /opt/conda/envs/hpc-container-maker

test/test_boost.py::Test_boost::test_b2_opts test/test_boost.py::Test_boost::test_bootstrap_opts
test/test_boost.py::Test_boost::test_defaults_centos test/test_boost.py::Test_boost::test_defaults_ubuntu test/test_boost.py::Test_boost::test_ldconfig test/test_boost.py::Test_boost::test_python test/test_boost.py::Test_boost::test_runtime test/test_boost.py::Test_boost::test_sourceforge
hpccm/building_blocks/boost.py docs/building_blocks.md
hpccm/building_blocks/boost.py docs/building_blocks.md