Deep-Image-Analogy
Deep-Image-Analogy copied to clipboard
cannot find -lcaffe when run make_deep_image_analogy.sh
I already have preinstalled caffe docker bvlc/caffe and trying to make the project, but get this error:
deep_image_analogy/source/lbfgs.cu:17:9: warning: #pragma once in main file
#pragma once
^
/usr/bin/ld: cannot find -lcaffe
collect2: error: ld returned 1 exit status
How can I fix it? I have caffe path exported to LD.
When I change the line:
-lcaffe \
in make_deep_image_analogy.sh to:
-L/opt/caffe/python \
it returns:
/tmp/tmpxft_000005d7_00000000-29_Classifier.o: In function `Classifier::Classifier(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
Classifier.cpp:(.text+0xa8): undefined reference to `caffe::Net<float>::Net(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, caffe::Phase, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const*, caffe::Net<float> const*)'
Classifier.cpp:(.text+0xe1): undefined reference to `caffe::Net<float>::CopyTrainedLayersFrom(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
/tmp/tmpxft_000005d7_00000000-29_Classifier.o: In function `Classifier::Predict(cv::Mat const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::vector<float*, std::allocator<float*> >&, std::vector<float*, std::allocator<float*> >&, std::vector<Dim, std::allocator<Dim> >&)':
Classifier.cpp:(.text+0x50d): undefined reference to `caffe::Blob<float>::Reshape(int, int, int, int)'
Classifier.cpp:(.text+0x51f): undefined reference to `caffe::Net<float>::Reshape()'
Classifier.cpp:(.text+0x575): undefined reference to `caffe::Net<float>::Forward(float*)'
Classifier.cpp:(.text+0x5d3): undefined reference to `caffe::Net<float>::blob_by_name(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
Classifier.cpp:(.text+0x6e1): undefined reference to `caffe::Blob<float>::gpu_data() const'
Classifier.cpp:(.text+0x741): undefined reference to `caffe::Blob<float>::mutable_gpu_data()'
/tmp/tmpxft_000005d7_00000000-29_Classifier.o: In function `Classifier::WrapInputLayer(std::vector<cv::Mat, std::allocator<cv::Mat> >*)':
Classifier.cpp:(.text+0x83f): undefined reference to `caffe::Blob<float>::mutable_cpu_data()'
/tmp/tmpxft_000005d7_00000000-29_Classifier.o: In function `Classifier::Preprocess(cv::Mat const&, std::vector<cv::Mat, std::allocator<cv::Mat> >*)':
Classifier.cpp:(.text+0xd2c): undefined reference to `caffe::Blob<float>::cpu_data() const'
/tmp/tmpxft_000005d7_00000000-29_Classifier.o: In function `caffe::Caffe::set_mode(caffe::Caffe::Brew)':
Classifier.cpp:(.text._ZN5caffe5Caffe8set_modeENS0_4BrewE[_ZN5caffe5Caffe8set_modeENS0_4BrewE]+0xc): undefined reference to `caffe::Caffe::Get()'
/tmp/tmpxft_000005d7_00000000-30_Deconv.o: In function `my_cost_function::f_gradf(float const*, float*, float*)':
Deconv.cpp:(.text+0x5c): undefined reference to `caffe::Net<float>::ForwardFromTo(int, int)'
Deconv.cpp:(.text+0x7e): undefined reference to `caffe::Net<float>::blob_by_name(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
Deconv.cpp:(.text+0x92): undefined reference to `caffe::Blob<float>::gpu_data() const'
Deconv.cpp:(.text+0xc4): undefined reference to `caffe::Net<float>::blob_by_name(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
Deconv.cpp:(.text+0xd8): undefined reference to `caffe::Blob<float>::mutable_gpu_diff()'
Deconv.cpp:(.text+0x106): undefined reference to `void caffe::caffe_gpu_sub<float>(int, float const*, float const*, float*)'
Deconv.cpp:(.text+0x140): undefined reference to `void caffe::caffe_gpu_mul<float>(int, float const*, float const*, float*)'
Deconv.cpp:(.text+0x159): undefined reference to `void caffe::caffe_gpu_asum<float>(int, float const*, float*)'
Deconv.cpp:(.text+0x17f): undefined reference to `caffe::Net<float>::BackwardFromTo(int, int)'
Deconv.cpp:(.text+0x1b2): undefined reference to `caffe::Net<float>::blob_by_name(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
Deconv.cpp:(.text+0x1c6): undefined reference to `caffe::Blob<float>::gpu_diff() const'
/tmp/tmpxft_000005d7_00000000-30_Deconv.o: In function `deconv(Classifier*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, float*, Dim, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, float*, Dim)':
Deconv.cpp:(.text+0x803): undefined reference to `caffe::Net<float>::ForwardFromTo(int, int)'
/tmp/tmpxft_000005d7_00000000-30_Deconv.o: In function `caffe::Caffe::cublas_handle()':
Deconv.cpp:(.text._ZN5caffe5Caffe13cublas_handleEv[_ZN5caffe5Caffe13cublas_handleEv]+0x5): undefined reference to `caffe::Caffe::Get()'
/tmp/tmpxft_000005d7_00000000-41_DeepAnalogy.o: In function `norm(float*&, float*, float*, Dim)':
tmpxft_000005d7_00000000-4_DeepAnalogy.cudafe1.cpp:(.text+0x93): undefined reference to `void caffe::caffe_gpu_mul<float>(int, float const*, float const*, float*)'
tmpxft_000005d7_00000000-4_DeepAnalogy.cudafe1.cpp:(.text+0xf8): undefined reference to `void caffe::caffe_gpu_set<float>(int, float, float*)'
tmpxft_000005d7_00000000-4_DeepAnalogy.cudafe1.cpp:(.text+0x139): undefined reference to `void caffe::caffe_gpu_gemv<float>(CBLAS_TRANSPOSE, int, int, float, float const*, float const*, float, float*)'
tmpxft_000005d7_00000000-4_DeepAnalogy.cudafe1.cpp:(.text+0x18e): undefined reference to `void caffe::caffe_gpu_powx<float>(int, float const*, float, float*)'
tmpxft_000005d7_00000000-4_DeepAnalogy.cudafe1.cpp:(.text+0x2ba): undefined reference to `void caffe::caffe_gpu_add_scalar<float>(int, float, float*)'
tmpxft_000005d7_00000000-4_DeepAnalogy.cudafe1.cpp:(.text+0x2f6): undefined reference to `void caffe::caffe_gpu_scal<float>(int, float, float*)'
tmpxft_000005d7_00000000-4_DeepAnalogy.cudafe1.cpp:(.text+0x343): undefined reference to `void caffe::caffe_gpu_gemm<float>(CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, int, int, int, float, float const*, float const*, float, float*)'
tmpxft_000005d7_00000000-4_DeepAnalogy.cudafe1.cpp:(.text+0x360): undefined reference to `void caffe::caffe_gpu_div<float>(int, float const*, float const*, float*)'
collect2: error: ld returned 1 exit status
ln -s /caffe/build/lib/libcaffe.so /usr/lib/libcaffe.so
It works for me
@zhengziqiang
Linking the library failed to work for me. I no longer get the /usr/bin/ld: cannot find -lcaffe error message, but now this is returned:
/tmp/tmpxft_00001281_00000000-29_Classifier.o: In function `Classifier::Classifier(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': Classifier.cpp:(.text+0xa8): undefined reference to `caffe::Net<float>::Net(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, caffe::Phase, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const*, caffe::Net<float> const*)' collect2: error: ld returned 1 exit status
I do not know how to comprehend that. What I can tell you is that I did not make Caffe from the build provided in this repository since its an older build without compatibility for CUDNN > v5.1, rather I compiled Caffe from BVLC's master repository. Also, I do have a previous build of Deep Image Analogy, which runs successfully on this same machine, but it is from otrimegistro's fork (https://github.com/otrimegistro/Deep-Image-Analogy#deep-image-analogy) for Linux support. I also built Caffe from that fork when I only had CUDNN v5.1 installed, which is supported in that build of Caffe.
Are there dependencies for this project included in this repository that is not included in BVLS's master repository of Caffe?
I successfully made the project by installing the master branch of Caffe and copying the specific files for this project into my directory of Caffe's master branch. Added '~/caffe/build/lib' to my 'LD_LIBRARY_PATH' and edited the scripts documented in the readme to work with my environment. Then I ran 'config_deep_image_analogy.sh' and 'make_deep_image_analogy.sh', and a working executable was made.
Hi I have the same issue I downloaded and compiled caffe successfully No when I try to compile the project I got the following error /usr/bin/ld: cannot find -lcaffe as you mentioned LD_LIBRARY_PATH my source path is /root/deeplearnng/Deep-Image-Analogy-linux and my caffe path is /root/deeplearning/caffe-rc5/.build_release/lib how can I set LD_LIBRARY_PATH thanks and regards
@tisawe I tried your copy methods and build deep-image-analogy in the master branch of Caffe. However, I still got the same error as before.
/tmp/tmpxft_00005a96_00000000-29_Classifier.o:In function ‘Classifier::Classifier(std::string const&, std::string const&)’:
Classifier.cpp:(.text+0xa2):undefined reference to ‘caffe::Net
Could you give me more suggestions or details about how you solved this problem? Thanks a lot!
@taneta Have you solved your problems now?And how do you solve it?I meet the same problem with you.Could you help me?Thank you!