Caffe compile MATLAB interface and error problem

Source: Internet
Author: User
first, after installing Caffe, compile

sudo make all-j8

sudo make test-j8

sudo make runtest-j8 next compile matlab excuse

sudo make matcaffe-j8

Test matlab interface: sudo make mattest-j8 if it's okay.

However, if the MATLAB version and the GCC (Linux) version do not match, it will cause errors


If you call caffe in MATLAB, you may also encounter the following error message and the above error statement

Invalid mex-file '/home/matconvnet-1.0-beta20/matlab/mex/vl_nnconv.mexa64 ':
/usr/local/matlab/r2016a/bin/ glnxa64/.. /.. /sys/os/glnxa64/libstdc++.so.6:version
' glibcxx_3.4.21 ' not found (required by/home/matconvnet-1.0-beta20/ MATLAB/MEX/VL_NNCONV.MEXA64)

MATLAB refers to the version of GCC and the version of the system does not match, the general situation is the version of the MATLAB reference is too low

Some caffe installation tutorials will lower the GCC version just in the first

If not, you can change the soft connection of GCC referenced in matlab

The path of GCC in my Ubuntu is the libstdc++.so.6 soft connection mismatch under the/usr/lib/x86_-linux_gnu/path (guaranteed and l/usr/lib/x86_64-linux-gnu/libstdc++.so.6 Connection version)

You can view the details of a connection through ls-al/usr/lib/x86_64-linux-gnu/libstdc++.so.6

sudo ln-s/usr/local/matlab/r2014a/sys/os/glnxa64/libstdc++.so.6.21/usr/local/matlab/r2014a/sys/os/glnxa64/ Libstdc++.so.6

Update Soft connection sudo ldconfig

In this way, after the soft connection is updated, there are sometimes errors, it is possible that the OPENCV version referenced in MATLAB does not match

such as: Invalid mex-file '/home/matconvnet-1.0-beta20/matlab/mex/vl_nnconv.mexa64 ':/usr/local/matlab/r2016a/bin/ glnxa64/.. /.. /sys/os/glnxa64/libstdc++.so.6:version ' glibcxx_3.4.21 ' not found (required by/home/matconvnet-1.0-beta20/matlab/ MEX/VL_NNCONV.MEXA64) at this time also need to update some soft connections, OPENCV related

View the relevant files

ls-al/usr/local/matlab/r2014a/bin/glnxa64/libopen* ls-al/usr/local/opencv-2.4.13/build/lib/libopencv_* (I am installing the opencv2.4 because the installation 3.0 is always compiled and not passed)


Delete the original connection

sudo rm-rf libopencv_core.so.2.4 libopencv_highgui.so.2.4 libopencv_imgproc.so.2.4

Create a new connection

sudo ln-s/usr/local/opencv-2.4.13/build/lib/libopencv_core.so.2.4.13 libopencv_core.so.2.4

sudo ln-s/usr/local/opencv-2.4.13/build/lib/libopencv_imgproc.so.2.4.13 libopencv_imgproc.so.2.4

sudo ln-s/usr/local/opencv-2.4.13/build/lib/libopencv_highgui.so.2.4.13 libopencv_highgui.so.2.4

Update connection sudo ldconfig
Re-test the interface sudo make mattest OK

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.