boost: include conflict with boost versions > 1.72
Starting with boost-1.73 (2020-04-28), boost tries to infer the stdlib version by
boost/config/detail/select_stdlib_config.hpp:18:
#if defined(__cplusplus) && defined(__has_include)
# if __has_include(<version>)
// It should be safe to include `<version>` when it is present without checking
// the actual C++ language version as it consists solely of macro definitions.
// [version.syn] p1: The header <version> supplies implementation-dependent
// information about the C++ standard library (e.g., version number and release date).
# include <version>
Our waf configuration generates compile commands like:
[ 929/2808] Compiling ...
12:21:16 runner ['g++-9', '-O0', '-ggdb', '-g3', '-Wall', '-Werror',
'-std=c++11', '-fstrict-aliasing', '-Wstrict-aliasing', '-fPIC',
'-I.', '-I<ns-3 root directory>', ...
Notice that the root ns-3 directory is added to the include directory search path with -I
. Our root directory has a file named VERSION
.
MacOs typically uses a case-preserving but case-insensitive file system. (Some software (we're looking at you, Adobe and Steam) balks at the case-sensitive file system...)
So the trifecta is:
- boost includes
<version>
- waf adds
-I<ns-3 root directory>
- MacOs treats
version
andVERSION
as the same
and the compiler picks up the wrong file.
A few possible solutions immediately come to mind:
- Don't use newer boost.
- Move
VERSION
somewhere else, such asutils/
. It appears this file is referenced in just the top levelwscript
, andsrc/core/test.cc
to identify the top level directory. - Get waf not to add
-I<ns-3 root directory>
.
Solution 3 would be my preference (there is nothing to include there), but it has completely stumped me... Need help from someone with better waf skills to figure out where that path is added to the compile command.