Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ld: library not found for -lboost_python

I install boost using brew install --build-from-source --with-python --fresh -vd boost. Yet when I run make pycaffe in the Caffe project, I get this error: ld: library not found for -lboost_python. How can I install that library? find / -name libboost_python* turns up nothing.

like image 887
Rose Perrone Avatar asked Oct 04 '14 02:10

Rose Perrone


3 Answers

Run the command brew install boost-python This will download, compile, and install the boost package with boost-python support. boost-python is required for the graphicsmagick-engine pip package and I ran into the same issue. To give you an idea of what happens, this is the output from the command:

==> Downloading https://downloads.sourceforge.net/project/boost/boost/1.57.0/boost_1_57_0.tar.bz2
######################################################################## 100.0%
==> ./bootstrap.sh --prefix=/usr/local/Cellar/boost-python/1.57.0 --libdir=/usr/local/Cellar/boost-python/1.57.0/lib --with-libraries=python --with-python=python --with-python-root=/System/Library/Frameworks/Python.framework/Versions/2.7
==> ./b2 --build-dir=build-python --stagedir=stage-python python=2.7 --prefix=/usr/local/Cellar/boost-python/1.57.0 --libdir=/usr/local/Cellar/boost-python/1.57.0/lib -d2 -j8 --layout=tagged --user-config=user-config.jam threading=multi,s

You could alternatively download, compile, and symlink the boost package (which is what I did originally) but this is a whole lot simpler if the default paths work for you.

like image 182
John Reeder Avatar answered Oct 31 '22 12:10

John Reeder


It turns out boost 1.56 seems to have issues with NVCC, so the boost_python lib files don't get installed. Installing using boost 1.55 works. I used:

git checkout a252214 /usr/local/Library/Formula/boost.rb
brew install --build-from-source --with-python --fresh -vd boost

Thanks to this thread

like image 41
Rose Perrone Avatar answered Oct 31 '22 12:10

Rose Perrone


For me, there is no such libboost_python37.dylib in boost-python lib path

$ ls /usr/local/Cellar/boost-python3/1.67.0_1/lib
libboost_numpy37-mt.a      libboost_numpy37.a         libboost_python37-mt.dylib libboost_python37.dylib
libboost_numpy37-mt.dylib  libboost_numpy37.dylib     libboost_python37-mt.a     libboost_python37.a

So create a soft link

$ sudo ln -s libboost_python37.dylib libboost_python3.dylib

This problem is fixed.

Similar question: ld: library not found for -lboost_python on MacOS

like image 32
GoingMyWay Avatar answered Oct 31 '22 12:10

GoingMyWay