bayesmix-dev / bayesmix

Flexible Bayesian nonparametric mixture models in C++
https://bayesmix.rtfd.io
BSD 3-Clause "New" or "Revised" License
22 stars 18 forks source link

Compilation fails with `clang` >= 15 #155

Closed TeoGiane closed 4 months ago

TeoGiane commented 4 months ago

Summary

On MacOS, with clang >=15, compilation fails with the following error:

[  0%] Building CXX object CMakeFiles/bayesmix.dir/src/algorithms/base_algorithm.cc.o
[  1%] Building CXX object CMakeFiles/bayesmix.dir/src/algorithms/blocked_gibbs_algorithm.cc.o
[  3%] Building CXX object CMakeFiles/bayesmix.dir/src/algorithms/conditional_algorithm.cc.o
[  5%] Building CXX object CMakeFiles/bayesmix.dir/src/algorithms/marginal_algorithm.cc.o
In file included from /Users/user/bayesmix/src/algorithms/base_algorithm.cc:1:
In file included from /Users/user/bayesmix/src/algorithms/base_algorithm.h:7:
In file included from /Users/user/bayesmix/lib/_deps/math-src/stan/math/rev.hpp:10:
In file included from /Users/user/bayesmix/lib/_deps/math-src/stan/math/rev/fun.hpp:198:
In file included from /Users/user/bayesmix/lib/_deps/math-src/stan/math/prim/functor.hpp:15:
In file included from /Users/user/bayesmix/lib/_deps/math-src/stan/math/prim/functor/integrate_ode_rk45.hpp:6:
In file included from /Users/user/bayesmix/lib/_deps/math-src/stan/math/prim/functor/ode_rk45.hpp:9:
In file included from /Users/user/bayesmix/lib/_deps/math-src/lib/boost_1.78.0/boost/numeric/odeint.hpp:63:
In file included from /Users/user/bayesmix/lib/_deps/math-src/lib/boost_1.78.0/boost/numeric/odeint/algebra/multi_array_algebra.hpp:22:
In file included from /Users/user/bayesmix/lib/_deps/math-src/lib/boost_1.78.0/boost/multi_array.hpp:34:
In file included from /Users/user/bayesmix/lib/_deps/math-src/lib/boost_1.78.0/boost/multi_array/multi_array_ref.hpp:32:
/Users/user/bayesmix/lib/_deps/math-src/lib/boost_1.78.0/boost/functional.hpp:45:24: error: no member named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
            using std::unary_function;
                  ~~~~~^~~~~~~~~~~~~~
                       __unary_function
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__functional/unary_function.h:46:1: note: '__unary_function' declared here
using __unary_function = __unary_function_keep_layout_base<_Arg, _Result>;
^

With clang >=15 the usage of std::unary_function and std::binary_function are suppressed under C++17. We may need an update of boost soon.

Temporary Workaround

Use an older version of clang, e.g., via brew install llvm@14.