Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

caffe Mattest error #3934

Open
bcd33bcd opened this issue Apr 3, 2016 · 34 comments
Open

caffe Mattest error #3934

bcd33bcd opened this issue Apr 3, 2016 · 34 comments
Labels

Comments

@bcd33bcd
Copy link

bcd33bcd commented Apr 3, 2016

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
Copy link

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
Copy link

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
Copy link

duchengyao commented Aug 30, 2016

@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
Copy link

lld533 commented Aug 31, 2016

@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
Copy link

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
Copy link

lld533 commented Aug 31, 2016

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

@Achilles-96
Copy link

@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
Copy link

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

@DouSong
Copy link

DouSong commented Dec 29, 2016

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

@xmyqsh
Copy link
Contributor

xmyqsh commented Jan 3, 2017

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
Copy link

kevjshih commented Jan 3, 2017

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
Copy link
Contributor

xmyqsh commented Jan 3, 2017

got it 👍 @kevjshih

@7LFB
Copy link

7LFB commented Apr 8, 2017

@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
Copy link

kevjshih commented Apr 8, 2017

@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
Copy link

7LFB commented Apr 8, 2017

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

@Shaswat27
Copy link

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

@7LFB
Copy link

7LFB commented May 13, 2017

@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
Copy link

Ashutosh1995 commented Jul 27, 2017

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
Copy link

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
Copy link

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_mode_cpu (line 5) caffe('set_mode_cpu'); Error in caffe.run_tests (line 6) caffe.set_mode_cpu();

How to solve this issue?

@variantf
Copy link

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

@carterbao
Copy link

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
Copy link

binialias commented Dec 19, 2017 via email

@BedirYilmaz
Copy link

BedirYilmaz commented Dec 24, 2017

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 #3934 (comment)
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
Copy link

jwz-ecust commented Jan 12, 2018

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
Copy link

ksnzh commented Jan 23, 2018

@Ashutosh1995 Have you solved this problem?

@artish3
Copy link

artish3 commented Jan 25, 2018

@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_mode_cpu (line 5)
caffe_('set_mode_cpu');

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

@wahabaftab
Copy link

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
Copy link

Can you please send me your mex file

@soulslicer
Copy link

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

@kangyang94
Copy link

@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
Copy link

briantse100 commented Mar 29, 2019

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
Copy link

WW2401 commented Nov 6, 2019

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_mode_cpu (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
Copy link

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_mode_cpu (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

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

No branches or pull requests