Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solve the problem: "cannot find -lboost_python3" when using Python3 Ubuntu16.04 #4843

Closed
H-xie opened this issue Oct 14, 2016 · 15 comments
Closed

Comments

@H-xie
Copy link

H-xie commented Oct 14, 2016

When

make all

cannot find -lboost_python3

occurred.

Then I went to

/usr/lib/x86_64-linux-gnu

search and found that the library file is in different name as

libboost_python-py35.so

so I made a link by following command

sudo ln -s libboost_python-py35.so libboost_python3.so 

which solved my problem.

Suggest that this step could add to Installation Guide

@WeiCheng14159
Copy link

solved my problem thx !

@MarcosPieras
Copy link

MarcosPieras commented Nov 16, 2016

Hi, I am in similar situation, which version of python and libboost did you use ?
Could you upload your Makefile.config file, please ?
thanks

@varunagrawal
Copy link

This solution did not work for me, unfortunately. Any reason why?
I changed the boost_python3 in the Makefile.config to boost_python3-py35 and it worked perfectly.

@MarcosPieras
Copy link

I solved using cmake. I modified the cmakelist.txt, I changed the interpreter line : set(python_version "3.5.2" CACHE STRING "Specify which Python version to use"). And It worked!

@wujun
Copy link

wujun commented Aug 16, 2017

Great solution!@H-adorable

@xnming
Copy link

xnming commented Aug 23, 2017

I am building caffe under Ubuntu 16.04. The solution for me is to change boost_python3 to boost_python-py35.

@zwx19961130
Copy link

Thank you. This has solved my question.

@minhaj3
Copy link

minhaj3 commented Mar 16, 2018

I am building caffe in Ubuntu 16.04. For me changing boost_python3 to boost_python-py35 worked. "boost_python3-py35" did not work for me.

@edrozenberg
Copy link

For my Python 3.6 setup, something similar worked, ln -s libboost_python36.so libboost_python3.so

@JFishLover
Copy link

thanks @minhaj3

@tailongnguyen
Copy link

tailongnguyen commented Sep 7, 2019

For those who tried all methods mentioned above and still got the error, check if you have already installed libboost by running: sudo apt-get install -y --no-install-recommends libboost-all-dev.

@rsingh2083
Copy link

rsingh2083 commented Dec 26, 2020

Ive got multiple python versions using pyenv (3.8 and 3.7).
I started the build on python3.7 and since on my system i had boost_python38 hence in the makefile i edited to look for boost_python38 instead of boost_python37
PYTHON_LIBRARIES := boost_python38 python3.7m
I did that because sudo apt-get install -y --no-install-recommends libboost-all-dev says requirement already satisfied.

But now when I do make -j4 Im getting this error :-


CXX/LD -o .build_release/tools/extract_features.bin
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/9/../../../arm-linux-gnueabihf/libboost_python38.so: undefined reference to `_Py_tracemalloc_config'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/9/../../../arm-linux-gnueabihf/libboost_python38.so: undefined reference to `_PyTraceMalloc_NewReference'
collect2: error: ld returned 1 exit status
make: *** [Makefile:630: .build_release/tools/get_image_size.bin] Error 1
make: *** Waiting for unfinished jobs....
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/9/../../../arm-linux-gnueabihf/libboost_python38.so: undefined reference to `_Py_tracemalloc_config'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/9/../../../arm-linux-gnueabihf/libboost_python38.so: undefined reference to `_PyTraceMalloc_NewReference'
collect2: error: ld returned 1 exit status
make: *** [Makefile:630: .build_release/tools/convert_imageset.bin] Error 1
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/9/../../../arm-linux-gnueabihf/libboost_python38.so: undefined reference to `_Py_tracemalloc_config'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/9/../../../arm-linux-gnueabihf/libboost_python38.so: undefined reference to `_PyTraceMalloc_NewReference'
collect2: error: ld returned 1 exit status
make: *** [Makefile:630: .build_release/tools/convert_annoset.bin] Error 1
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/9/../../../arm-linux-gnueabihf/libboost_python38.so: undefined reference to `_Py_tracemalloc_config'
/usr/bin/ld: /usr/lib/gcc/arm-linux-gnueabihf/9/../../../arm-linux-gnueabihf/libboost_python38.so: undefined reference to `_PyTraceMalloc_NewReference'
collect2: error: ld returned 1 exit status
make: *** [Makefile:630: .build_release/tools/extract_features.bin] Error 1

@amoazeni75
Copy link

I wanted to build Caffe and faced the same issue. Unfortunately, none of the answers work in my case. I checked the location of lboost_python by the following command:


find /usr/lib -name libboost_python-py

I found the lboost_python libraries and here are some of them:

  • libboost_python37.a
  • libboost_python37-mt.a
  • libboost_python37-mt.so
  • libboost_python37-mt.so.1.68.0

Then in the Makefile.config file I changed the following line:

PYTHON_LIBRARIES := boost_python python3.7m
to

PYTHON_LIBRARIES := boost_python37-mt python3.7m

@kivoimusa
Copy link

Thank you so much for this! you are adorable love for everyone. God bless you

@JFishLover
Copy link

JFishLover commented Feb 18, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests