ld: library not found for -lboost_python
Asked Answered
W

3

8

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.

Whipping answered 4/10, 2014 at 2:33 Comment(0)
G
4

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.

Gordon answered 28/4, 2015 at 14:55 Comment(3)
For python3, you need to run brew install boost-python --with-python3, and then build using -lboost_python3Acarid
@ronen, but what if -lboost_python3 not found? How to fix it, I came across this issue.Softcover
Try using brew install boost-python3 – the syntax may have changed.Weakness
W
3

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

Whipping answered 4/10, 2014 at 19:16 Comment(4)
I'm having a lot of trouble installing caffe on OS X 10.9.5. Did you install it with the modified brew formulaes? It seems like I get a different error every time I try to compile caffe. I am getting not being able to find files or BLAS (even though Mac has it installed via Accelerate). Any tips?Chattanooga
Yes, make sure you do the brew edit step. Follow the Caffe instructions closely. I installed OpenBLAS.Whipping
Although Caffe compliation succeeds, I still get Fatal Python error: PyThreadState_Get: no current thread when I try to run Caffe. Please let me know if you do too! Homebrew's advice on this problem doesn't seem helpful: github.com/Homebrew/homebrew/wiki/Common-Issues. I'm working through brew doctor issues before posting an issue.Whipping
After using boost 1.55, it compiled but wouldn't execute, like you found out. What did you end up doing?Chattanooga
S
1

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

Softcover answered 18/8, 2018 at 6:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.