Skip to content

Commit

Permalink
Add in "-DBOOST_NO_CXX98_FUNCTION_BASE" to b2 cxxflags command line a…
Browse files Browse the repository at this point in the history
…rguments when using

c++17 or newer standard. This is to handle the removal of std::unary_function in c++17.
  • Loading branch information
srherbener committed Oct 3, 2023
1 parent 5669802 commit 8cc0267
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion var/spack/repos/builtin/packages/boost/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,10 @@ def determine_b2_options(self, spec, options):
cxxflags = []

# Deal with C++ standard.
cxxstd = spec.variants["cxxstd"].value
if spec.satisfies("@1.66:"):
options.append("cxxstd={0}".format(spec.variants["cxxstd"].value))
else: # Add to cxxflags for older Boost.
cxxstd = spec.variants["cxxstd"].value
flag = getattr(self.compiler, "cxx{0}_flag".format(cxxstd))
if flag:
cxxflags.append(flag)
Expand All @@ -604,6 +604,11 @@ def determine_b2_options(self, spec, options):
if not spec.satisfies("@:1.70 %intel"):
cxxflags.append("-DBOOST_PARAMETER_DISABLE_PERFECT_FORWARDING")

# std::unary_function was removed in C++17 so need to set the following
# flag for building boost
if cxxstd == "17" or cxxstd == "2a":
cxxflags.append("-DBOOST_NO_CXX98_FUNCTION_BASE")

# clang is not officially supported for pre-compiled headers
# and at least in clang 3.9 still fails to build
# https://www.boost.org/build/doc/html/bbv2/reference/precompiled_headers.html
Expand Down

0 comments on commit 8cc0267

Please sign in to comment.