CMA-ES / libcmaes

libcmaes is a multithreaded C++11 library with Python bindings for high performance blackbox stochastic optimization using the CMA-ES algorithm for Covariance Matrix Adaptation Evolution Strategy
Other
321 stars 78 forks source link

doc building on Mac with Anaconda #118

Closed nikohansen closed 9 years ago

nikohansen commented 9 years ago

In the last .configure line at https://github.com/beniz/libcmaes/wiki/Building-libcmaes-on-Mac-OSX, don't we need something like --with-eigen3-include=/opt/local/include/eigen3?

beniz commented 9 years ago

Yes, if using port. I've differentiated the two cases now in the doc, https://github.com/beniz/libcmaes/wiki/Building-libcmaes-on-Mac-OSX

nikohansen commented 9 years ago

dev branch now fails to compile with the error

tpa-tests.cc:23:10: fatal error: 'gflags/gflags.h' file not found
#include <gflags/gflags.h>
beniz commented 9 years ago

Thanks for catching this, fixed.

nikohansen commented 9 years ago

Still doesn't compile:

/bin/sh ../libtool  --tag=CXX   --mode=link clang++ -g -Wall  -O2 -I/Users/hansen/anaconda/lib/python2.7/site-packages/numpy/core/include/ -I/Users/hansen/anaconda_boost_install/include -std=gnu++11 -L../src -L/Users/hansen/anaconda_boost_install/lib -o sample_code_surrogate1 surrogates/sample-code-surrogate1.o -lcmaes -lm   
libtool: link: clang++ -g -Wall -O2 -I/Users/hansen/anaconda/lib/python2.7/site-packages/numpy/core/include/ -I/Users/hansen/anaconda_boost_install/include -std=gnu++11 -o .libs/sample_code_surrogate1 surrogates/sample-code-surrogate1.o -Wl,-bind_at_load  -L../src -L/Users/hansen/anaconda_boost_install/lib /Users/hansen/git/libcmaes/src/.libs/libcmaes.dylib -lm
depbase=`echo surrogates/test-rsvm.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
    clang++ -DHAVE_CONFIG_H -I. -I..  -I../src/ -I/opt/local/include/eigen3  -I/Users/hansen/anaconda/include/python2.7 -g -Wall  -O2 -I/Users/hansen/anaconda/lib/python2.7/site-packages/numpy/core/include/ -I/Users/hansen/anaconda_boost_install/include -std=gnu++11 -MT surrogates/test-rsvm.o -MD -MP -MF $depbase.Tpo -c -o surrogates/test-rsvm.o surrogates/test-rsvm.cc &&\
    mv -f $depbase.Tpo $depbase.Po
In file included from surrogates/test-rsvm.cc:22:
../src/surrogates/rankingsvm.hpp:356:8: error: no type named 'mt19937' in namespace 'std'
  std::mt19937 _rng;
  ~~~~~^
../src/surrogates/rankingsvm.hpp:357:8: error: no template named 'uniform_real_distribution' in namespace 'std'; did
      you mean 'uniform_int_distribution'?
  std::uniform_real_distribution<> _udist;
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
       uniform_int_distribution
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:2892:7: note: 
      'uniform_int_distribution' declared here
class uniform_int_distribution
      ^
In file included from surrogates/test-rsvm.cc:22:
../src/surrogates/rankingsvm.hpp:125:19: error: no template named 'uniform_real_distribution' in namespace 'std'; did
      you mean 'uniform_int_distribution'?
    _udist = std::uniform_real_distribution<>(0,1);
             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
                  uniform_int_distribution
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:2892:7: note: 
      'uniform_int_distribution' declared here
class uniform_int_distribution
      ^
3 errors generated.
make[2]: *** [surrogates/test-rsvm.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
[18:09:10] 0 libcmaes$ 
beniz commented 9 years ago

Fixed it with https://github.com/beniz/libcmaes/commit/316dd11e32d482a0e1a7c8fc5a81ecf6035ebd47 (tested on OSX).

beniz commented 9 years ago

FYI, I am about to hook travis for continuous integration of the libcmaes, which may allow me to detect some of the building errors earlier. Not sure it has an OSX support though.