Caffe: problem to compile caffe with cmake

Created on 4 Oct 2016  Â·  8Comments  Â·  Source: BVLC/caffe

I have installed caffe using make. Now i want to install it with cmake, but i meet a problem hard for me to solve.

firstly, i type
make ..
got an error:
CMake Error at CMakeLists.txt:85 (add_dependencies):
The dependency target "pycaffe" of target "pytest" does not exist.
i ignored and type:
cmake . -DCMAKE_BUILD_TYPE=Debug
got the same result
then type:
make -j 4 && make install
got error:

Linking CXX shared library ../../lib/libcaffe-d.so
/usr/bin/ld: /usr/local/lib/libcblas.a(cblas_sgemv.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libcblas.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libcaffe-d.so.1.0.0-rc3] Error 1
make[1]: *** [src/caffe/CMakeFiles/caffe.dir/all] Error 2
make: *** [all] Error 2

please give me some help, thanks

Most helpful comment

In my case installing python-numpy solved this issue.

sudo apt-get install python-numpy

All 8 comments

I have solved this problem. I tried to edit CMakeCache.txt in the build file and changed

//Path to a library.
Atlas_CBLAS_LIBRARY:FILEPATH=<path to libcblas.a>

into

//Path to a library.
Atlas_CBLAS_LIBRARY:FILEPATH=/usr/lib/libcblas.so //<path to libcblas.so in my machine>

and it works.

@EmpireofQin Hi, even I got the same error but for me I didn't have to edit the CMakeCache.txt file as it was already correct. I'm not sure how to correct this error-
The dependency target "pycaffe" of target "pytest" does not exist.

I solved this error by reinstall my OS and caffe. I did not find out the exactly reason for this error. It is probably caused by wrongly installing some dependence. @kevgeo

I solved this by installing boost-python which was missing.

In this thread there is a solution for the same error but libgflags
https://code.google.com/archive/p/google-glog/issues/201

Posted on Jul 23, 2014 by Happy Dog

Same issue on Ubuntu 14.04, 64 bit, g++ 4.8.2, glibc 2.19 Solved by compiling gflags-2.1.1 with -fPIC:

$ tar -xvf gflags-2.1.1.tar.gz $ cd gflags-2.1.1 && mkdir build && cd build $ CXXFLAGS="-fPIC" cmake .. -DGFLAGS_NAMESPACE=google $ sudo make install

Then install glog-0.3.3 as usual.

and it works, hope this will help

In my case, I am using anaconda, and I have solved this issue defining the paths of glog, boost, gflags and python interpreter to the same conda environment.

I have created a new environment for caffe called "caffe", and I have installed glog, boost and gflags using the command "conda install [dependency name]".

I have redirected all the paths (using CMake gui) to the path "/home/user/anaconda3/envs/caffe/" instead of "/usr/local/" and "/usr/".

Good look.

In my case installing python-numpy solved this issue.

sudo apt-get install python-numpy

The dependency target "pycaffe" of target "pytest" does not exist.

Same problem occurs to my OSX Sierra when build caffe with cmake, but the solutions above does not solve...
Anyone have another solutions? Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dfotland picture dfotland  Â·  3Comments

greatgao picture greatgao  Â·  3Comments

kelvinxu picture kelvinxu  Â·  3Comments

malreddysid picture malreddysid  Â·  3Comments

erogol picture erogol  Â·  3Comments