Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

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

Open
donghn opened this issue Jul 14, 2019 · 3 comments
Open

Comments

@donghn
Copy link

donghn commented Jul 14, 2019

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?

@ftian1
Copy link
Contributor

ftian1 commented Jul 15, 2019

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

@donghn
Copy link
Author

donghn commented Jul 15, 2019

thank you for your help.

@hundanLi
Copy link

hundanLi commented Apr 8, 2020

Also work for me.

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

No branches or pull requests

3 participants