caffe icon indicating copy to clipboard operation
caffe copied to clipboard

Error: /usr/bin/ld: cannot find -lmkldnn (Build Intel Caffe using gcc)

Open donghn opened this issue 5 years ago • 3 comments

I followed https://github.com/intel/caffe/wiki/Install-Intel-Caffe to build intel-caffe. Using gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609

Command line: cd caffe scripts/prepare_env.sh --compiler gcc

I got the error: CXX examples/cpp_classification/classification.cpp AR -o .build_release/lib/libcaffe.a LD -o .build_release/lib/libcaffe.so.1.1.6 /usr/bin/ld: cannot find -lmkldnn collect2: error: ld returned 1 exit status Makefile:806: recipe for target '.build_release/lib/libcaffe.so.1.1.6' failed make: *** [.build_release/lib/libcaffe.so.1.1.6] Error 1 make: *** Waiting for unfinished jobs.... make: command: Command not found MKLDNN download is enabled by customized setting! weight grad compression disabled because intel compiler not found LD -o .build_release/lib/libcaffe.so.1.1.6 /usr/bin/ld: cannot find -lmkldnn collect2: error: ld returned 1 exit status Makefile:806: recipe for target '.build_release/lib/libcaffe.so.1.1.6' failed make: *** [.build_release/lib/libcaffe.so.1.1.6] Error 1 Done.

How can I resolve it?

donghn avatar Jul 14 '19 09:07 donghn

mkldnn has changed its .so location, which is under lib64 under centos, lib under ubuntu.

as you are using prepare_env.sh with gcc compiler, it will go to make path rather than cmake. so you have to manually update Makefile.mkldnn line 66/67/74 to use "lib" dir path rather than "lib64".

another way is to directly use cmake. the steps are:

mkdir build cd build cmake .. && make -j 8

ftian1 avatar Jul 15 '19 01:07 ftian1

thank you for your help.

donghn avatar Jul 15 '19 06:07 donghn

Also work for me.

hundanLi avatar Apr 08 '20 09:04 hundanLi