Boost logo

Boost-Build :

Subject: [Boost-build] question regarding "requires cxx11_hdr_array" clause in Jamfile
From: Robert Ramey (ramey_at_[hidden])
Date: 2016-12-06 14:03:27


In tests of the boost seriaization library here:

https://api.travis-ci.org/jobs/181492138/log.txt?deansi=true

I have a test failure with the test "test_array". The test includes
boost/serialization/array.hpp. This header file morphed from
implementing the serialization of native arrays (which was moved to the
core of the library) to implementing serialization of <array>. So the
test shouldn't be run if the <array> header doesn't exist and will fail
if it does.

To this end, boost/serialization/array.hpp contains the following:

#ifndef BOOST_NO_CXX11_HDR_ARRAY

#include <array>
#include <boost/serialization/nvp.hpp>

...

To implement the above I've included the following in my jamfile:

      [ test-bsl-run_files test_array : A : : [ requires
cxx11_hdr_array ] ] # BOOST_NO_CXX11_HDR_ARRAY

Which I understand should condition the invocation of the test on
config.hpp not defining BOOST_NO_CXX11_HDR_ARRAY. In general this
approach seems to work well. But I'm having a problem with this
specific case.

Interesting parts of the log file above are:

$ TOOLSET=gcc,clang

The command "TOOLSET=gcc,clang" exited with 0.
$ if [ $TRAVIS_OS_NAME == osx ]; then TOOLSET=clang; fi

The command "if [ $TRAVIS_OS_NAME == osx ]; then TOOLSET=clang; fi"
exited with 0.
$ ./b2 libs/serialization/test toolset=$TOOLSET
Performing configuration checks

     - 32-bit : no
     - 64-bit : yes
     - arm : no
     - mips1 : no
     - power : no
     - sparc : no
     - x86 : yes
     - symlinks supported : yes
     - Boost.Config Feature Check: cxx11_hdr_array : yes
     - Boost.Config Feature Check: cxx11_hdr_forward_list : yes
     - Boost.Config Feature Check: hash : no
     - Boost.Config Feature Check: cxx11_hdr_unordered_map : yes
     - Boost.Config Feature Check: cxx11_hdr_unordered_set : yes
     - Boost.Config Feature Check: slist : no
     - Boost.Config Feature Check: std_wstreambuf : yes
...patience...

So this shows that BOOST_NO_CXX11_HDR_ARRAY is not defined. So I would
expect test_array to run - which it does. BUT when the test is actually
run, it fails because the code in <array> is not included. This leads
me to believe that when the test is actually run
BOOST_NO_CXX11_HDR_ARRAY IS in fact defined.

In other words, it looks like boost build checks for the existence of
<array> while boost config checks for the C++ version to see if <array>
is supported. This would explain the behavior I'm seeing.

I would like someone else's informed opinion on this and what I might do
about it.

Note: I intend to change the name of test_array to test_std_array but I
don't want to do this until the current problem is sorted out.

Robert Ramey


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