C++11, and C++11 Random on macOS
I'm trying to compile Armadillo with C++11 on macOS and I'm facing some troubles. I dig into the config.hpp
and even the CMakeLists.txt
and I cannot figure out what's going wrong and why I cannot get it to work. You mentioned that Armadillo will detect C++11 and activate appropriate flags for it. But I think there are some exceptions, if I understood correctly.
So, my first question is, am I right that you decided not to add the std=c++11
to CMAKE_CXX_FLAGS
if the system is using Clang
? If this is the case, I've tried to manually edit the CMakeLists.txt
and add the flag to the list of flags and I think I at least manage to compile Armadillo with C++11 standard but I'm not sure. If that's the case, is there a reason for it?
My second question is, even though I can see that ARMA_USE_CXX11
is defined — after me adding the flag manually — for some reason the ARMA_USE_EXTERN_CXX11_RNG
is not defined.
This is all because I want to use <random>
on C++11 to build something on top of Armadillo but I cannot convince Armadillo to use C++11 at the first place. For testing purposes, I've made a test project and using Cmake to build everything. Cmake is being set to C++11 and I link the local copy of armadillo to my program.
Update: If I force the build with C++11 by defining ARMA_USE_EXTERN_CXX_RNG
, then I get further but not far. I found your comment about thread_local
and I assume that's the reason this is disabled, right? If that's the case, do you think there is a way to work around it. I'm willing to investigate and test further.
Update 2: So, I figured out the error I was getting, and it was about not having the arma_rng_cxx11_instance
in the namespace. So, I uncommented the namespace { thread_local arma_rng_cxx11 arma_rng_cxx11_instance; }
and now I can successfully compile it. I guess you had a good reason for disabling this, which is probably beyond my knowledge, but since I have access to macOS, if there is any tests that I can run and make sure things are working, I'd be happy to help.