// For some constexpr related reason, clang + C11 don't work
// well with the boost random number generator
#if defined(__clang__) && __cplusplus >= 201103
#include <random>
#else
#include <boost/random/mersenne_twister.hpp>
#endif
IMPKERNEL_BEGIN_NAMESPACE
#ifndef SWIG // the RNG is defined explicitly in pyext/IMP_kernel.random.i
#if defined(__clang__) && __cplusplus >= 201103
class RandomNumberGenerator : public std::mt19937 {
typedef std::mt19937 T;
#else
class RandomNumberGenerator : public ::boost::mt19937 {
typedef ::boost::mt19937 T;
#endif
On 12/13/22 3:48 AM, Barak Raveh wrote:
> I have been trying to build IMP from source on Conda on my mac. It
> mostly goes well except in one file it gets flustered by a for-range
> loop (see *Build output *below). If I build using the same cmd-line just
> with /--std=c++11/, or /std=c++14/, or /std=c++17/, it works just fine.
> Moreover, cmake does detect that it should work with C++11 (see *CMake
> output* below). Any ideas?
If you're in a conda environment, you should probably use the conda
compilers so you're building IMP with the same compiler as its
dependencies - looks like you're using the system-provided compiler
here. This is done by "conda install gxx_linux-64" on Linux followed by
"source ${CONDA_PREFIX}/etc/conda/activate.d/activate-gxx_linux-64.sh"
(it'll be a little different on a Mac though).
Otherwise, I would just force a C++ standard by passing
-DCMAKE_CXX_FLAGS="-std=c++17" or similar to your CMake invocation.
Modern clang is supposed to compile for recent C++ (I think C++14) by
default, but maybe it is getting confused by one of your other compile
flags somewhere.
Ben
--
ben@salilab.org https://salilab.org/~ben/
"It is a capital mistake to theorize before one has data."
- Sir Arthur Conan Doyle