Atinesh
Atinesh

Reputation: 1910

Trouble building caffe from source

I am trying to install caffe by building it from source

After issuing the following command from the caffe root directory

$ make all -j4

I am getting an error

...
CXX src/caffe/layer_factory.cpp
CXX src/caffe/blob.cpp
AR -o .build_release/lib/libcaffe.a
LD -o .build_release/lib/libcaffe.so.1.0.0
/usr/bin/x86_64-linux-gnu-ld: cannot find -lpython3.6
collect2: error: ld returned 1 exit status
Makefile:582: recipe for target '.build_release/lib/libcaffe.so.1.0.0' failed
make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1

Dependencies installed

$ sudo apt install python3-opencv
$ sudo apt-get install libatlas-base-dev
$ sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
$ sudo apt-get install --no-install-recommends libboost-all-dev
$ sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
$ sudo apt-get install the python3-dev

CUDA: CUDA 9 CuDnn 7.4

Ubuntu: Ubuntu 18.04

Makefile.config

I have looked at all the issues in the source Github repository but couldn't find anything useful.

Upvotes: 0

Views: 182

Answers (2)

Atinesh
Atinesh

Reputation: 1910

The issue is resolved, I had to make the following changes in Makefile.config file

From

PYTHON_LIBRARIES := boost_python3 python3.6
PYTHON_INCLUDE := /usr/include/python3.6 \
/usr/lib/python3.6/dist-packages/numpy/core/include

To

PYTHON_LIBRARIES := boost_python3 python3.6m
PYTHON_INCLUDE := /usr/include/python3.6m \
/usr/lib/python3.6/dist-packages/numpy/core/include

Upvotes: 0

Tom Mekken
Tom Mekken

Reputation: 1039

Therefore that your error states cannot find -lpython3.6 you are missing the libpython3.6.so on your system.

Try to:
sudo apt-get install libpython3.6-dev

Upvotes: 1

Related Questions