Closed hermanbanken closed 10 years ago
Yes, this is a know bug, clang itself is crashing, see https://github.com/beniz/libcmaes/issues/19 I haven't heard from clang's devs for a while now, so I don't expect to see this fixed soon.
However, you should be able to more or less easily compile with gcc, see: https://github.com/beniz/libcmaes/wiki/Building-libcmaes-on-Mac-OSX
gcc-4.9 will do just fine, and you'll have support for openmp as well, something that clang is still lacking.
EDIT: note that you should be able to use Homebrew instead of macports. If you do so, please let me know the details if you can, as I will be able to update the doc for Homebrew.
Thanks for the quick reply @beniz. As the second part of my message states I tried gcc 4.9 but the C++11 features are not found by configure. I had already read that wiki page, converting it for the Homebrew tool.
(As some people consider Homebrew to be better than MacPorts I installed the first. But both create some sort of vendor lock-in, so I can't really switch now).
Do you know how to get the configure script to pick up the C++11 features?
Try to fix your configure line:
I think it was indeed the combination of the CXXFLAGS that broke things. This worked:
brew install gcc autoconf automake eigen gflags # currently installs gcc 4.9
git clone https://github.com/beniz/libcmaes.git
cd libcmaes
./autogen.sh
CCDIR=/usr/local/Cellar/gcc/4.9.1/bin # adjust to the installed version
CCVER=4.9
./configure CC="$CCDIR/gcc-$CCVER" CXX="$CCDIR/g++-$CCVER" --with-eigen3-include=/usr/local/Cellar/eigen/3.2.2/include/eigen3 CXXFLAGS="-lstdc++ -I/usr/local/include -O4" LDADD=-lgflags LDFLAGS=-L/usr/local/lib
make
./tests/test_functions
You should add this to the Mac OSX wiki page :+1:
By the way, I got the following warning a lot:
In file included from /usr/local/Cellar/eigen/3.2.2/include/eigen3/Eigen/Cholesky:24:0,
from /usr/local/Cellar/eigen/3.2.2/include/eigen3/Eigen/Eigenvalues:8,
from /usr/local/Cellar/eigen/3.2.2/include/eigen3/unsupported/Eigen/MatrixFunctions:21,
from eo_matrix.h:33,
from parameters.h:25,
from cmaparameters.h:25,
from covarianceupdate.h:25,
from covarianceupdate.cc:22:
/usr/local/Cellar/eigen/3.2.2/include/eigen3/Eigen/src/Cholesky/LDLT.h: In member function 'void Eigen::internal::solve_retval<Eigen::LDLT<MatrixType, _UpLo>, Rhs>::evalTo(Dest&) const':
/usr/local/Cellar/eigen/3.2.2/include/eigen3/Eigen/src/Cholesky/LDLT.h:505:39: warning: typedef 'Scalar' locally defined but not used [-Wunused-local-typedefs]
typedef typename LDLTType::Scalar Scalar;
When compiling on OSX with Homebrew I get a compile error:
After this compile error clang crashes:
I noticed that running ./configure with the provided parameters (adjusted to Homebrew) does not work. Configuring for clang++ works with `./configure CXX="clang++" CXXFLAGS="-std=gnu++11"``. These are the only parameters necessary with Homebrew. Eigen(3) is found automatically.
Originally I tried to install with a newer gcc (4.9 via Homebrew) and running configure as
but then it can't find c++11 extensions:
So I guess there are 2 issues here, a piece of c++ invalid with clang and something that crashes the compiler. Did you experience this too? Do you have a workaround?
I want to use CMA-ES for my Combinatorial Solvers course at the Delft University of Technology in the Netherlands, and this library looked most promising...