After installing boost with mpi support using brew I still get the error ld: "library not found for -lboost_mpi"
when I run clang++ -lboost_mpi
. What can I do to overcome this? I installed boost using brew:
$ brew install boost --with-mpi --without-single
==> Downloading https://downloads.sourceforge.net/project/boost/boost/1.58.0/boost_1_58_0.tar.bz2
Already downloaded: /Library/Caches/Homebrew/boost-1.58.0.tar.bz2
==> ./bootstrap.sh --prefix=/usr/local/Cellar/boost/1.58.0 --libdir=/usr/local/Cellar/boost/1.58.0/lib --without-icu --without-libraries=python
==> ./b2 --prefix=/usr/local/Cellar/boost/1.58.0 --libdir=/usr/local/Cellar/boost/1.58.0/lib -d2 -j4 --layout=tagged --user-config=user-config.jam install t
The default behaviour when you're building boost with brew on OSX is a tagged build - if you looked a the build output you would have seen something like:
and the
--layout=tagged
causes multi-threaded versions to be post-fixed with-mt
.This means your boost_mpi library is called:
boost_mpi-mt
, and that's what you should link to, so the library you're linking to islibboost_mpi-mt
, so the option is-lboost_mpi-mt
.You could also have looked in the
/usr/local/Cellar/boost/1.58.0/lib
directory for the library - it would have hinted at this as well.