Thanks! At least on my Mac installation, conda's gcc package seems to be broken. Let me report that I was able to build IMP with conda & clang using the following workaround: * adding -DCMAKE_CXX_FLAGS="-std=c++17"  as you
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
 
ZjQcmQRYFpfptBannerEnd
Thanks! At least on my Mac installation, conda's gcc package seems to be broken. Let me report that I was able to build IMP with conda & clang using the following workaround:
* adding -DCMAKE_CXX_FLAGS="-std=c++17"  as you suggested
* switching IMP's random number generator from boost to std  in IMP/kernel/include/random.h due to some weird constexpr issue, due to a conflict between conda's boost::mt19337::min()/max() functions and llvm's std::shuffle(), which requires them to return a constexpr (this was fixed in the latest boost versions)

I tested for speed, and std::mt19337 is as fast or even faster on my mac. This is the change, l did not dare to check it in. Let me know if you think we should stick with the boost version or try to add this change - it doesn't break anything but could affect speed on some systems, perhaps for better but not necessarily. It required C11.

// 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 Tue, Dec 13, 2022 at 8:39 PM Ben Webb <ben@salilab.org> wrote:
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


--
Barak