BVLC / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
33.97k stars 18.72k forks source link

caffe Mattest error #3934

Open bcd33bcd opened 8 years ago

bcd33bcd commented 8 years ago

when I make mattest, some error happened:


`cd matlab; /usr/local/MATLAB/R2014a/bin/matlab -nodisplay -r 'caffe.run_tests(), exit()'`

                            < M A T L A B (R) >
                  Copyright 1984-2014 The MathWorks, Inc.
                    R2014a (8.3.0.532) 64-bit (glnxa64)
                             February 11, 2014

To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.
Invalid MEX-file
'/home/xw/caffeBuild/caffe-master/matlab/+caffe/private/caffe_.mexa64':
/home/xw/caffeBuild/caffe-master/matlab/+caffe/private/caffe_.mexa64: undefined
symbol:
_ZN2cv8imencodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_11_InputArrayERSt6vectorIhSaIhEERKSB_IiSaIiEE

Error in caffe.set_mode_cpu (line 5)
caffe_('set_mode_cpu');

Error in caffe.run_tests (line 6)
caffe.set_mode_cpu();

And when I copy caffe_mexa64 to other path and run code "caffe('get_init_key')" ,it also show the same error ,except

Error in caffe.set_mode_cpu (line 5)
caffe_('set_mode_cpu');

Error in caffe.run_tests (line 6)
caffe.set_mode_cpu();

And my OS is Ubuntu 15.10, so the version of g++ and gcc is 5.2.1. what should I do? Thanks~

shekharRavi commented 8 years ago

I am also facing the same problem. My Matlab version is 2015b. I tried to put default version of gcc as gcc-4.7 since Maltab mex support that and explicitly give gcc version gcc-5 in Makefile configuration for Caffe.

Anyone able to fix this issue?

kevjshih commented 8 years ago

The problem here seems to be that caffe is compiled against the system version of opencv, but linking to the matlab version when running matcaffe. I was able to fix the problem by replacing the symbolic links for libopencv_[imgproc,core,highgui].so.2.4 in MATLAB/R2015a/bin/glnxa64 with a link for the versions in /usr/lib, as those were the three used by caffe. This fix probably breaks all the other opencv library files that were not replaced, so you might want to be careful or just replace them all.

duchengyao commented 7 years ago

@kevjshih

Followed your instruction, I changed some symbolic link in /bin/glnxa64 and matcaffe works well. ^_^

libopencv_core.so.2.4 -> /usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4.9
libopencv_highgui.so.2.4 -> /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9
libopencv_imgproc.so.2.4 -> /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4.9

root@test222:/matlab/r2016a/bin/glnxa64# mv libopencv_imgproc.so.2.4 libopencv_imgproc.so.2.4.bak
root@test222:/matlab/r2016a/bin/glnxa64# mv libopencv_highgui.so.2.4 libopencv_highgui.so.2.4.bak
root@test222:/matlab/r2016a/bin/glnxa64# mv libopencv_core.so.2.4 libopencv_core.so.2.4.bak

root@test222:/matlab/r2016a/bin/glnxa64# ln /usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4.9 libopencv_core.so.2.4
root@test222:/matlab/r2016a/bin/glnxa64# ln /usr/lib/x86_64-linux-gnu/libopencv_highgui.so.2.4.9 libopencv_highgui.so.2.4
root@test222:/matlab/r2016a/bin/glnxa64# ln /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4.9 libopencv_imgproc.so.2.4
lld533 commented 7 years ago

@duchengyao I'm new to linux and I'm facing the same problem. How did you change the symbolic links? Could you please add some details? Much thanks.

kevjshih commented 7 years ago

You can see the links when you run ls -alh. If file B is a symlink of some file A elsewhere, you'll see B -> A in the output. To create a symlink that creates a proxy for A at location B, run ln -s A B.

lld533 commented 7 years ago

@kevjshih Much thanks for your help. I made it.:)

Achilles-96 commented 7 years ago

@kevjshih I changed the three above mentioned symbolic links. The error remained same. There are many links to MATLAB provided libraries. Which of them to change. Is there any way to know? @duchengyao Is there any reason you changed only those three links?

kevjshih commented 7 years ago

I think I determined those three libraries by reading the stack trace (it's been a while so I don't quite recall).

DouSong commented 7 years ago

Thank you so much,it helps me a lot @kevjshih It is very kind of U

xmyqsh commented 7 years ago

Thanks a lot @kevjshih But how can you figure out this issues caused by opencv? I mean how can you figure out this (The problem here seems to be that caffe is compiled against the system version of opencv, but linking to the matlab version when running matcaffe.). Hope your reply. Thanks again.

kevjshih commented 7 years ago

Well the function name (imencode in this case) is in the stacktrace so you can pretty much throw it into a web query and see which library comes up.

xmyqsh commented 7 years ago

got it :+1: @kevjshih

7LFB commented 7 years ago

@kevjshih based on the error information, i change some symbol links one by one, but i still get stuck in libopencv_features2d.so.2.4 even though i have already changed its symbol links. Looking forward for your help

kevjshih commented 7 years ago

@7LFB I'm not sure how much I can help. The general idea here is that you simply need to make sure the .so file being read while in MATLAB is the same as the one you originally compiled Caffe against. If it's not working, then maybe that's not the version of opencv you used? I suppose one thing you can check is whether you have opencv 3.0 install as well, and might've compiled Caffe against that instead.

7LFB commented 7 years ago

thank u a lot for your words and i have already fixed it ! @kevjshih

Shaswat27 commented 7 years ago

@7LFB Facing the same problem. Which all links did you change?

7LFB commented 7 years ago

@Shaswat27 About 5-6 symbol links. I just follow the error information it present like this,"libopencv_features2d.so.2.4, undefined symbol". and then i modified its links one by one.

Ashutosh1995 commented 6 years ago

I am also getting the same error: libcaffe.so.1.0.0: undefined symbol: _ZN2cv8imencodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_11_InputArrayERSt6vectorIhSaIhEERKSB_IiSaIiEE

I am trying to run .m code to generate lmdb process as suggested in Deep Metric Learning using Lifted Structured Embedding which mexa.64 but it stops and pops the error.

I also made symbolic links between the libcaffe.so.1.0.0-rc3 and libcaffe.so and libcaffe.so.1.0.0 but it didn't work out.

Can anyone suggest any solution to this?

wahabaftab commented 6 years ago

I had the same error try using Opencv 2.4.9 for your project also do this in terminal before opening matlab: export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6

binialias commented 6 years ago

I am getting the below error when i issue the make mattest command

I am using the following version of softwares ubuntu : 16.04 Matlab 2016a gcc and g++ 4.9 OpenCV 3.2 Invalid MEX-file '/home/hp/caffe/matlab/+caffe/private/caffe_.mexa64': /usr/lib/libgdal.so.1: undefined symbol: _ZN11xercesc_3_111InputSource11setEncodingEPKt Error in caffe.set_modecpu (line 5) caffe('set_mode_cpu'); Error in caffe.run_tests (line 6) caffe.set_mode_cpu();

How to solve this issue?

variantf commented 6 years ago

@binialias did you tried run export LD_PRELOAD=/usr/lib/libgdal.so.1 before running make mattest as @wahabaftab metioned?

carterbao commented 6 years ago

It took me several days to solve this issue. I tried all the above methods, but they didn't work. Finally I replaced the opencv version from 3.3.0 to 3.2.0 and it works.

binialias commented 6 years ago

yes i have tried that also

On Wed, Nov 22, 2017 at 10:26 PM, Carter Bao notifications@github.com wrote:

It took me several days to solve this issue. I tried all the above methods, but they didn't work. Finally I replaced the opencv version from 3.3.0 to 3.2.0 and it works.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/BVLC/caffe/issues/3934#issuecomment-346410666, or mute the thread https://github.com/notifications/unsubscribe-auth/AXzBOPO2KQtlMpdx9aMOHwX5KHVYyo-dks5s5FIpgaJpZM4H-cJY .

-- Thanks & Regards,

Bini Alias.

BedirYilmaz commented 6 years ago

Hi @variantf @wahabaftab @binialias ,

My system specs

Ubuntu 16.04
CUDA 9.0
Matlab R2015a
gcc/g++ 4.9 for matlab and 5.4.1 for caffe

I also have the same problem, so followed the steps of others in

here https://github.com/BVLC/caffe/issues/3934#issuecomment-243321669 and here http://caffe.berkeleyvision.org/tutorial/interfaces.html

Here are the results I get before and after I apply your suggestion

Errors I get before export LD_PRELOAD=/usr/lib/libgdal.so.1

~/caffe$ make mattest
cd matlab; /usr/local/MATLAB/R2015a/bin/matlab -nodisplay -r 'caffe.run_tests(), exit()'

                                                                                     < M A T L A B (R) >
                                                                           Copyright 1984-2015 The MathWorks, Inc.
                                                                           R2015a (8.5.0.197613) 64-bit (glnxa64)
                                                                                      February 12, 2015

To get started, type one of these: helpwin, helpdesk, or demo.
For product information, visit www.mathworks.com.

Invalid MEX-file '/home/bedir/caffe/matlab/+caffe/private/caffe_.mexa64': /usr/lib/libgdal.so.1: undefined symbol: _ZN11xercesc_3_111InputSource11setEncodingEPKt

Error in caffe.set_mode_cpu (line 5)
caffe_('set_mode_cpu');

Error in caffe.run_tests (line 6)
caffe.set_mode_cpu();

>> 

Errors I get before export LD_PRELOAD=/usr/lib/libgdal.so.1 after export LD_PRELOAD=/usr/lib/libgdal.so.1

~/caffe$ export LD_PRELOAD=/usr/lib/libgdal.so.1
~/caffe$ make mattest
cd matlab; /usr/local/MATLAB/R2015a/bin/matlab -nodisplay -r 'caffe.run_tests(), exit()'
uname: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/libgdal.so.1)
uname: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/libgdal.so.1)
uname: /usr/local/MATLAB/R2015a/bin/glnxa64/libtiff.so.5: no version information available (required by /usr/lib/x86_64-linux-gnu/libpoppler.so.58)
uname: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libpoppler.so.58)
uname: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libgeos_c.so.1)
uname: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libkmlbase.so.1)
uname: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libkmlbase.so.1)
uname: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libkmldom.so.1)
uname: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libkmldom.so.1)
uname: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libkmlengine.so.1)
uname: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libkmlengine.so.1)
uname: /usr/local/MATLAB/R2015a/bin/glnxa64/libcrypto.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libpq.so.5)
uname: /usr/local/MATLAB/R2015a/bin/glnxa64/libssl.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libpq.so.5)
uname: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libdapclient.so.6)
uname: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libdapclient.so.6)
uname: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libdap.so.17)
uname: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libdap.so.17)
uname: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libgeos-3.5.0.so)
uname: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libgeos-3.5.0.so)
uname: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/lib/x86_64-linux-gnu/libicuuc.so.55)
sed: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/libgdal.so.1)
sed: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/libgdal.so.1)
sed: /usr/local/MATLAB/R2015a/bin/glnxa64/libtiff.so.5: no version information available (required by /usr/lib/x86_64-linux-gnu/libpoppler.so.58)
sed: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libpoppler.so.58)
sed: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libgeos_c.so.1)
sed: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libkmlbase.so.1)
sed: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libkmlbase.so.1)
sed: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libkmldom.so.1)
sed: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libkmldom.so.1)
sed: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libkmlengine.so.1)
sed: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libkmlengine.so.1)
sed: /usr/local/MATLAB/R2015a/bin/glnxa64/libcrypto.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libpq.so.5)
sed: /usr/local/MATLAB/R2015a/bin/glnxa64/libssl.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libpq.so.5)
sed: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libdapclient.so.6)
sed: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libdapclient.so.6)
sed: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libdap.so.17)
sed: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libdap.so.17)
sed: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libgeos-3.5.0.so)
sed: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libgeos-3.5.0.so)
sed: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/lib/x86_64-linux-gnu/libicuuc.so.55)
getconf: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/libgdal.so.1)
getconf: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/libgdal.so.1)
getconf: /usr/local/MATLAB/R2015a/bin/glnxa64/libtiff.so.5: no version information available (required by /usr/lib/x86_64-linux-gnu/libpoppler.so.58)
getconf: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libpoppler.so.58)
getconf: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libgeos_c.so.1)
getconf: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libkmlbase.so.1)
getconf: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libkmlbase.so.1)
getconf: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libkmldom.so.1)
getconf: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libkmldom.so.1)
getconf: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libkmlengine.so.1)
getconf: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libkmlengine.so.1)
getconf: /usr/local/MATLAB/R2015a/bin/glnxa64/libcrypto.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libpq.so.5)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/libgdal.so.1)
getconfawk: : /usr/local/MATLAB/R2015a/bin/glnxa64/libssl.so.1.0.0/usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: : version `GLIBCXX_3.4.20' not found (required by /usr/lib/libgdal.so.1)no version information available (required by /usr/lib/x86_64-linux-gnu/libpq.so.5)

getconf: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libdapclient.so.6)
getconf: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libdapclient.so.6)
getconf: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libdap.so.17)
getconf: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libdap.so.17)
awk: /usr/local/MATLAB/R2015a/bin/glnxa64/libtiff.so.5: no version information available (required by /usr/lib/x86_64-linux-gnu/libpoppler.so.58)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libpoppler.so.58)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libgeos_c.so.1)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libkmlbase.so.1)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libkmlbase.so.1)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libkmldom.so.1)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libkmldom.so.1)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libkmlengine.so.1)getconf
: awk/usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: : /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libgeos-3.5.0.so): 
version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libkmlengine.so.1)getconf
: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libgeos-3.5.0.so)
awk: /usr/local/MATLAB/R2015a/bin/glnxa64/libcrypto.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libpq.so.5)
awk: /usr/local/MATLAB/R2015a/bin/glnxa64/libssl.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libpq.so.5)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libdapclient.so.6)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libdapclient.so.6)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libdap.so.17)
getconfawk: : /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6/usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: : version `CXXABI_1.3.8' not found (required by /usr/lib/x86_64-linux-gnu/libicuuc.so.55)version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libdap.so.17)

awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libgeos-3.5.0.so)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libgeos-3.5.0.so)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/lib/x86_64-linux-gnu/libicuuc.so.55)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/libgdal.so.1)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/libgdal.so.1)
awk: /usr/local/MATLAB/R2015a/bin/glnxa64/libtiff.so.5: no version information available (required by /usr/lib/x86_64-linux-gnu/libpoppler.so.58)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libpoppler.so.58)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libgeos_c.so.1)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libkmlbase.so.1)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libkmlbase.so.1)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libkmldom.so.1)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libkmldom.so.1)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libkmlengine.so.1)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libkmlengine.so.1)
awk: /usr/local/MATLAB/R2015a/bin/glnxa64/libcrypto.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libpq.so.5)
awk: /usr/local/MATLAB/R2015a/bin/glnxa64/libssl.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libpq.so.5)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libdapclient.so.6)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libdapclient.so.6)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libdap.so.17)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libdap.so.17)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libgeos-3.5.0.so)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libgeos-3.5.0.so)
awk: /usr/local/MATLAB/R2015a/sys/os/glnxa64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/lib/x86_64-linux-gnu/libicuuc.so.55)
/usr/local/MATLAB/R2015a/bin/glnxa64/MATLAB: /usr/local/MATLAB/R2015a/bin/glnxa64/libtiff.so.5: no version information available (required by /usr/lib/x86_64-linux-gnu/libpoppler.so.58)
/usr/local/MATLAB/R2015a/bin/glnxa64/MATLAB: /usr/local/MATLAB/R2015a/bin/glnxa64/libcrypto.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libpq.so.5)
/usr/local/MATLAB/R2015a/bin/glnxa64/MATLAB: /usr/local/MATLAB/R2015a/bin/glnxa64/libssl.so.1.0.0: no version information available (required by /usr/lib/x86_64-linux-gnu/libpq.so.5)
/usr/local/MATLAB/R2015a/bin/glnxa64/MATLAB: symbol lookup error: /usr/lib/libgdal.so.1: undefined symbol: _ZN11xercesc_3_111InputSource11setEncodingEPKt
Makefile:539: recipe for target 'mattest' failed

~/caffe$ 

I also tried to change my environment variables in /etc/environment accordingly but it did not work. I would definitely want to try to switch to opencv3.2 as well, but since there are others in opencv 3.2 that facing the same problem, I see no point.

jwz-ecust commented 6 years ago

My system specs

Ubuntu 16.04
CUDA 8.0
Matlab R2014b
gcc/g++  5.4.0
OpenCV3.2

I have the same problem, so followed the steps of others in

Invalid MEX-file '/home/cuishi/caffe/matlab/+caffe/private/caffe_.mexa64': /usr/lib/libgdal.so.1:
undefined symbol: _ZN11xercesc_3_111InputSource11setEncodingEPKt

Any solutions?

ksnzh commented 6 years ago

@Ashutosh1995 Have you solved this problem?

artish3 commented 6 years ago

@duchengyao after following yours, i got this: Invalid MEX-file '/home/akhil/caffe/matlab/+caffe/private/caffe_.mexa64': /usr/local/MATLAB/MATLAB_Production_Server/R2015a/bin/glnxa64/libopencv_core.so.2.4: file too short

Error in caffe.set_modecpu (line 5) caffe('set_mode_cpu');

Error in classification_demo (line 71) caffe.set_mode_cpu();

wahabaftab commented 6 years ago

try exporting this: export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 and this: export LD_PRELOAD=$LD_PRELOAD:/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/usr/lib/x86_64-linux-gnu/libprotobuf.so.9 and try to use matlab 2015a or lower , bcoz matcaffe usually gives error on latest versions(opencv 2.4.9)

Also check this link if my solution isn't working (its in another language so translate it) http://blog.csdn.net/rt5rte54654/article/details/54742981

soulslicer commented 6 years ago

Can you please send me your mex file

soulslicer commented 6 years ago

Is anyone able to upload for me a matlab caffe mex file. I am simply unable to build it

kangyang94 commented 6 years ago

@duchengyao I try to make the link,and the question has been solved. But I got another question. Invalid MEX-file '/home/ky/Desktop/sphereface/tools/caffe-sphereface/matlab/+caffe/private/caffe_.mexa64': /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0: undefined symbol: FT_Face_GetCharVariantIndex How can I fix it?

briantse100 commented 5 years ago

It has worked well for me after I delete the files. You should copy the files first. root@t:/matlab/r2015b/bin/glnxa64# sudo rm -r libopencv_highgui.so.2.4 libopencv_imgproc.so.2.4 libopencv_core.so.2.4

WW2401 commented 4 years ago

When I make mattest,I met the follow problem.
Invalid MEX-file '/home/caffe/matlab/+caffe/private/caffe_.mexa64': /usr/local/lib/libopencv_imgcodecs.so.3.4: undefined symbol: _ZN2cv6detail17check_failed_autoEmmRKNS0_12CheckContextE. Error in caffe.set_modecpu (line 5) caffe('set_mode_cpu'); Error in caffe.run_tests (line 6) caffe.set_mode_cpu();

How can I solve it? Thanks a lot @kevjshih @duchengyao ubuntu matlab:R2018b cuda:10.0 opencv:3.4.7 gcc/g++:5.5

futureflsl commented 3 years ago

When I make mattest,I met the follow problem. Invalid MEX-file '/home/caffe/matlab/+caffe/private/caffe_.mexa64': /usr/local/lib/libopencv_imgcodecs.so.3.4: undefined symbol: _ZN2cv6detail17check_failed_autoEmmRKNS0_12CheckContextE. Error in caffe.set_modecpu (line 5) caffe('set_mode_cpu'); Error in caffe.run_tests (line 6) caffe.set_mode_cpu();

How can I solve it? Thanks a lot @kevjshih @duchengyao ubuntu matlab:R2018b cuda:10.0 opencv:3.4.7 gcc/g++:5.5 I got the same error as yours,Did you solved it? ubuntu18.04 matlab:R2018b cuda:10.0 opencv:3.4.4 gcc/g++:7.5.0