无效的 MEX 文件 libmkl_rt.so:无法打开
Invalid MEX-file libmkl_rt.so: cannot open
我有一个 MEX 文件,可以在 CentOS 7.7 和 MATLAB R2018b 上完美地编译和 运行s。我可以使用 MATLAB R2016b 在 Ubuntu 16.04 上编译它,但是当我尝试 运行 它时,我得到
libmkl_rt.so: cannot open shared object file: No such file or directory.
我试过了
setenv('LD_LIBRARY_PATH',[getenv('LD_LIBRARY_PATH'),':/opt/intel/compilers_and_libraries_2019.1.144/linux/mkl/lib/intel64_lin'])
和
setenv('LD_RUN_PATH',[getenv('LD_RUN_PATH'),':/opt/intel/compilers_and_libraries_2019.1.144/linux/mkl/lib/intel64_lin'])
根据 ,没有运气。还是一样的问题。
这是我用来编译的命令:
mex -v -I/usr/include -I/opt/intel/mkl/include station_cov.cpp -L/lib64 -larmadillo -L/opt/intel/mkl/lib/intel64 -lmkl_core -lmkl_sequential
这似乎是一个路径问题,但我无法弄清楚我哪里出错了。任何帮助将不胜感激。
编辑:
./station_cov.mexa64: /usr/local/MATLAB/R2016b/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./station_cov.mexa64)
linux-vdso.so.1 => (0x00007fff1f5ca000)
libarmadillo.so.9 => /usr/lib/x86_64-linux-gnu/libarmadillo.so.9 (0x00007fb5f7592000)
libmwlapack.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwlapack.so (0x00007fb5f71e3000)
libmwblas.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwblas.so (0x00007fb5f6fc7000)
libmx.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmx.so (0x00007fb5f6c3a000)
libmex.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmex.so (0x00007fb5f6a02000)
libstdc++.so.6 => /usr/local/MATLAB/R2016b/sys/os/glnxa64/libstdc++.so.6 (0x00007fb5f66f0000)
libgcc_s.so.1 => /usr/local/MATLAB/R2016b/sys/os/glnxa64/libgcc_s.so.1 (0x00007fb5f64da000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb5f6110000)
libmkl_rt.so => not found
libarpack.so.2 => /usr/lib/libarpack.so.2 (0x00007fb5f5ec5000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb5f5bbb000)
/lib64/ld-linux-x86-64.so.2 (0x000055b58a794000)
libut.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libut.so (0x00007fb5f58fc000)
libmwbinder.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwbinder.so (0x00007fb5f56e8000)
libmwompwrapper.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwompwrapper.so (0x00007fb5f54e2000)
libboost_system.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_system.so.1.56.0 (0x00007fb5f52df000)
libmwcpp11compat.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwcpp11compat.so (0x00007fb5f50c0000)
libtbb.so.2 => /usr/local/MATLAB/R2016b/bin/glnxa64/libtbb.so.2 (0x00007fb5f4e75000)
libtbbmalloc.so.2 => /usr/local/MATLAB/R2016b/bin/glnxa64/libtbbmalloc.so.2 (0x00007fb5f4c23000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb5f4a05000)
libmwresource_core.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwresource_core.so (0x00007fb5f4803000)
libmwi18n.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwi18n.so (0x00007fb5f44d9000)
libmwfl.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwfl.so (0x00007fb5f4128000)
libboost_chrono.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_chrono.so.1.56.0 (0x00007fb5f3f22000)
libboost_date_time.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_date_time.so.1.56.0 (0x00007fb5f3d10000)
libboost_filesystem.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_filesystem.so.1.56.0 (0x00007fb5f3afa000)
libboost_log.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_log.so.1.56.0 (0x00007fb5f381d000)
libboost_regex.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_regex.so.1.56.0 (0x00007fb5f350c000)
libboost_signals.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_signals.so.1.56.0 (0x00007fb5f32f6000)
libboost_thread.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_thread.so.1.56.0 (0x00007fb5f30d5000)
libicudata.so.56 => /usr/local/MATLAB/R2016b/bin/glnxa64/libicudata.so.56 (0x00007fb5f16ef000)
libicuuc.so.56 => /usr/local/MATLAB/R2016b/bin/glnxa64/libicuuc.so.56 (0x00007fb5f1358000)
libicui18n.so.56 => /usr/local/MATLAB/R2016b/bin/glnxa64/libicui18n.so.56 (0x00007fb5f0ede000)
libicuio.so.56 => /usr/local/MATLAB/R2016b/bin/glnxa64/libicuio.so.56 (0x00007fb5f0cd0000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fb5f0ab6000)
libmwservices.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwservices.so (0x00007fb5f0483000)
libmwmpath.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwmpath.so (0x00007fb5f01f5000)
libmwm_dispatcher.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwm_dispatcher.so (0x00007fb5efefb000)
libmwmlutil.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwmlutil.so (0x00007fb5ef6d9000)
liblapack.so.3 => /usr/lib/liblapack.so.3 (0x00007fb5eeef6000)
libblas.so.3 => /usr/lib/libblas.so.3 (0x00007fb5eec94000)
libgfortran.so.3 => /usr/local/MATLAB/R2016b/sys/os/glnxa64/libgfortran.so.3 (0x00007fb5ee976000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fb5ee76e000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb5ee569000)
libexpat.so.1 => /usr/local/MATLAB/R2016b/bin/glnxa64/libexpat.so.1 (0x00007fb5ee341000)
libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007fb5ee108000)
libboost_serialization.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_serialization.so.1.56.0 (0x00007fb5edea8000)
libunwind.so.8 => /usr/local/MATLAB/R2016b/bin/glnxa64/libunwind.so.8 (0x00007fb5edc88000)
libssl.so.1.0.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libssl.so.1.0.0 (0x00007fb5eda1d000)
libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007fb5ed5c2000)
libmwdisplay_device.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwdisplay_device.so (0x00007fb5ed3ba000)
libmwcppmicroservices.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwcppmicroservices.so (0x00007fb5ed1b8000)
libmwregexp.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwregexp.so (0x00007fb5ecf6f000)
libmwsettingscore.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwsettingscore.so (0x00007fb5ecb2a000)
libmwms.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwms.so (0x00007fb5ec4e6000)
libmwnativedisplay.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwnativedisplay.so (0x00007fb5ec2db000)
libmwopccore.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwopccore.so (0x00007fb5ec084000)
libmwopcmodel.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwopcmodel.so (0x00007fb5ebe09000)
libmwopczippackage.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwopczippackage.so (0x00007fb5ebbe5000)
libmwopcmwservices.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwopcmwservices.so (0x00007fb5eb985000)
libmwwebproxy.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwwebproxy.so (0x00007fb5eb778000)
libmwkeybrd.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwkeybrd.so (0x00007fb5eb575000)
libboost_iostreams.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_iostreams.so.1.56.0 (0x00007fb5eb361000)
libCppMicroServices.so.2.1.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libCppMicroServices.so.2.1.0 (0x00007fb5eb0cc000)
libPocoCrypto.so.31 => /usr/local/MATLAB/R2016b/bin/glnxa64/libPocoCrypto.so.31 (0x00007fb5eaeaa000)
libPocoFoundation.so.31 => /usr/local/MATLAB/R2016b/bin/glnxa64/libPocoFoundation.so.31 (0x00007fb5eaac8000)
libPocoJSON.so.31 => /usr/local/MATLAB/R2016b/bin/glnxa64/libPocoJSON.so.31 (0x00007fb5ea87a000)
libPocoNet.so.31 => /usr/local/MATLAB/R2016b/bin/glnxa64/libPocoNet.so.31 (0x00007fb5ea55a000)
libPocoNetSSL.so.31 => /usr/local/MATLAB/R2016b/bin/glnxa64/libPocoNetSSL.so.31 (0x00007fb5ea313000)
libPocoUtil.so.31 => /usr/local/MATLAB/R2016b/bin/glnxa64/libPocoUtil.so.31 (0x00007fb5ea0a0000)
libPocoXML.so.31 => /usr/local/MATLAB/R2016b/bin/glnxa64/libPocoXML.so.31 (0x00007fb5e9e13000)
libxerces-c-3.1.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libxerces-c-3.1.so (0x00007fb5e977c000)
libmwflnetwork.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwflnetwork.so (0x00007fb5e94d2000)
libmwflstoragevfs.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwflstoragevfs.so (0x00007fb5e921b000)
libmwflstorageprovider.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwflstorageprovider.so (0x00007fb5e8fe1000)
libmwstoragefileprovider.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwstoragefileprovider.so (0x00007fb5e8da8000)
libmwstorageshlibstoragesys.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwstorageshlibstoragesys.so (0x00007fb5e8b65000)
libmwstoragefilefolderobserver.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwstoragefilefolderobserver.so (0x00007fb5e8951000)
libmwsearch_path_interfaces.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwsearch_path_interfaces.so (0x00007fb5e8745000)
libmwxmlcore.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwxmlcore.so (0x00007fb5e84cf000)
libopenblas.so.0 => /usr/lib/libopenblas.so.0 (0x00007fb5e643b000)
libquadmath.so.0 => /usr/local/MATLAB/R2016b/sys/os/glnxa64/libquadmath.so.0 (0x00007fb5e61fd000)
libminizip.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libminizip.so (0x00007fb5e5ff0000)
libmwflcrypto.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwflcrypto.so (0x00007fb5e5dc3000)
libmwflcryptoutils.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwflcryptoutils.so (0x00007fb5e5bb7000)
libmwflcryptocryptopp.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwflcryptocryptopp.so (0x00007fb5e5667000)
libmwflstorageevents.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwflstorageevents.so (0x00007fb5e5460000)
libmwstoragesharedlib.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwstoragesharedlib.so (0x00007fb5e5243000)
libmwflcryptoopenssl.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwflcryptoopenssl.so (0x00007fb5e5019000)
您的 MATLAB 版本 requires GCC 4.9.x for compiling MEX-files. You likely have version 5.3 instead。
使用 5.3 版编译时,您的二进制文件需要 link 到 5.3 版或更新版本附带的 C++ 库。
MATLAB 是用 4.9 编译的,需要该版本的 C++ 库或更新的库。
MATLAB 带有自己版本的 GCC C++ 库 (v 4.9),并且 links 在您的 MEX 文件被加载之前就已经有了。当您的 MEX 文件被 link 编辑时,已经加载了一个版本的 C++ 库,但它是错误的版本。
有两种方法可以解决这个问题:
官方方法:安装 GCC 4.9.x,并通过向 mex
命令添加适当的参数确保在编译 MEX 文件时使用它。您还必须重新编译您的依赖项(Armadillo 和 MKL,从您的 ldd
输出来看,它们似乎依赖于许多其他库)。
糟糕的方法:从 MATLAB 目录中删除 C++ 库,并让它使用系统附带的库(较新,因此应该可以工作)。我们正在谈论文件 /usr/local/MATLAB/R2016b/sys/os/glnxa64/libstdc++.so.6
和 /usr/local/MATLAB/R2016b/sys/os/glnxa64/libgcc_s.so.1
。这个解决方案比另一个更容易,我不能推荐其他任何东西。过去我用许多不同版本的 Linux 和 MATLAB 做过这个,但可能不会用 Ubuntu 16 和 MATLAB R2016a,所以通过移动文件或重命名它们来仔细尝试,所以你如果 MATLAB 无法启动,可以撤消更改。然而,这确实需要管理员权限,因此它不是对每个人都可行的解决方案。
我有一个 MEX 文件,可以在 CentOS 7.7 和 MATLAB R2018b 上完美地编译和 运行s。我可以使用 MATLAB R2016b 在 Ubuntu 16.04 上编译它,但是当我尝试 运行 它时,我得到
libmkl_rt.so: cannot open shared object file: No such file or directory.
我试过了
setenv('LD_LIBRARY_PATH',[getenv('LD_LIBRARY_PATH'),':/opt/intel/compilers_and_libraries_2019.1.144/linux/mkl/lib/intel64_lin'])
和
setenv('LD_RUN_PATH',[getenv('LD_RUN_PATH'),':/opt/intel/compilers_and_libraries_2019.1.144/linux/mkl/lib/intel64_lin'])
根据
这是我用来编译的命令:
mex -v -I/usr/include -I/opt/intel/mkl/include station_cov.cpp -L/lib64 -larmadillo -L/opt/intel/mkl/lib/intel64 -lmkl_core -lmkl_sequential
这似乎是一个路径问题,但我无法弄清楚我哪里出错了。任何帮助将不胜感激。
编辑:
./station_cov.mexa64: /usr/local/MATLAB/R2016b/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./station_cov.mexa64)
linux-vdso.so.1 => (0x00007fff1f5ca000)
libarmadillo.so.9 => /usr/lib/x86_64-linux-gnu/libarmadillo.so.9 (0x00007fb5f7592000)
libmwlapack.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwlapack.so (0x00007fb5f71e3000)
libmwblas.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwblas.so (0x00007fb5f6fc7000)
libmx.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmx.so (0x00007fb5f6c3a000)
libmex.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmex.so (0x00007fb5f6a02000)
libstdc++.so.6 => /usr/local/MATLAB/R2016b/sys/os/glnxa64/libstdc++.so.6 (0x00007fb5f66f0000)
libgcc_s.so.1 => /usr/local/MATLAB/R2016b/sys/os/glnxa64/libgcc_s.so.1 (0x00007fb5f64da000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb5f6110000)
libmkl_rt.so => not found
libarpack.so.2 => /usr/lib/libarpack.so.2 (0x00007fb5f5ec5000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb5f5bbb000)
/lib64/ld-linux-x86-64.so.2 (0x000055b58a794000)
libut.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libut.so (0x00007fb5f58fc000)
libmwbinder.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwbinder.so (0x00007fb5f56e8000)
libmwompwrapper.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwompwrapper.so (0x00007fb5f54e2000)
libboost_system.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_system.so.1.56.0 (0x00007fb5f52df000)
libmwcpp11compat.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwcpp11compat.so (0x00007fb5f50c0000)
libtbb.so.2 => /usr/local/MATLAB/R2016b/bin/glnxa64/libtbb.so.2 (0x00007fb5f4e75000)
libtbbmalloc.so.2 => /usr/local/MATLAB/R2016b/bin/glnxa64/libtbbmalloc.so.2 (0x00007fb5f4c23000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb5f4a05000)
libmwresource_core.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwresource_core.so (0x00007fb5f4803000)
libmwi18n.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwi18n.so (0x00007fb5f44d9000)
libmwfl.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwfl.so (0x00007fb5f4128000)
libboost_chrono.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_chrono.so.1.56.0 (0x00007fb5f3f22000)
libboost_date_time.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_date_time.so.1.56.0 (0x00007fb5f3d10000)
libboost_filesystem.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_filesystem.so.1.56.0 (0x00007fb5f3afa000)
libboost_log.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_log.so.1.56.0 (0x00007fb5f381d000)
libboost_regex.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_regex.so.1.56.0 (0x00007fb5f350c000)
libboost_signals.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_signals.so.1.56.0 (0x00007fb5f32f6000)
libboost_thread.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_thread.so.1.56.0 (0x00007fb5f30d5000)
libicudata.so.56 => /usr/local/MATLAB/R2016b/bin/glnxa64/libicudata.so.56 (0x00007fb5f16ef000)
libicuuc.so.56 => /usr/local/MATLAB/R2016b/bin/glnxa64/libicuuc.so.56 (0x00007fb5f1358000)
libicui18n.so.56 => /usr/local/MATLAB/R2016b/bin/glnxa64/libicui18n.so.56 (0x00007fb5f0ede000)
libicuio.so.56 => /usr/local/MATLAB/R2016b/bin/glnxa64/libicuio.so.56 (0x00007fb5f0cd0000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fb5f0ab6000)
libmwservices.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwservices.so (0x00007fb5f0483000)
libmwmpath.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwmpath.so (0x00007fb5f01f5000)
libmwm_dispatcher.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwm_dispatcher.so (0x00007fb5efefb000)
libmwmlutil.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwmlutil.so (0x00007fb5ef6d9000)
liblapack.so.3 => /usr/lib/liblapack.so.3 (0x00007fb5eeef6000)
libblas.so.3 => /usr/lib/libblas.so.3 (0x00007fb5eec94000)
libgfortran.so.3 => /usr/local/MATLAB/R2016b/sys/os/glnxa64/libgfortran.so.3 (0x00007fb5ee976000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fb5ee76e000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb5ee569000)
libexpat.so.1 => /usr/local/MATLAB/R2016b/bin/glnxa64/libexpat.so.1 (0x00007fb5ee341000)
libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007fb5ee108000)
libboost_serialization.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_serialization.so.1.56.0 (0x00007fb5edea8000)
libunwind.so.8 => /usr/local/MATLAB/R2016b/bin/glnxa64/libunwind.so.8 (0x00007fb5edc88000)
libssl.so.1.0.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libssl.so.1.0.0 (0x00007fb5eda1d000)
libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007fb5ed5c2000)
libmwdisplay_device.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwdisplay_device.so (0x00007fb5ed3ba000)
libmwcppmicroservices.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwcppmicroservices.so (0x00007fb5ed1b8000)
libmwregexp.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwregexp.so (0x00007fb5ecf6f000)
libmwsettingscore.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwsettingscore.so (0x00007fb5ecb2a000)
libmwms.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwms.so (0x00007fb5ec4e6000)
libmwnativedisplay.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwnativedisplay.so (0x00007fb5ec2db000)
libmwopccore.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwopccore.so (0x00007fb5ec084000)
libmwopcmodel.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwopcmodel.so (0x00007fb5ebe09000)
libmwopczippackage.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwopczippackage.so (0x00007fb5ebbe5000)
libmwopcmwservices.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwopcmwservices.so (0x00007fb5eb985000)
libmwwebproxy.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwwebproxy.so (0x00007fb5eb778000)
libmwkeybrd.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwkeybrd.so (0x00007fb5eb575000)
libboost_iostreams.so.1.56.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libboost_iostreams.so.1.56.0 (0x00007fb5eb361000)
libCppMicroServices.so.2.1.0 => /usr/local/MATLAB/R2016b/bin/glnxa64/libCppMicroServices.so.2.1.0 (0x00007fb5eb0cc000)
libPocoCrypto.so.31 => /usr/local/MATLAB/R2016b/bin/glnxa64/libPocoCrypto.so.31 (0x00007fb5eaeaa000)
libPocoFoundation.so.31 => /usr/local/MATLAB/R2016b/bin/glnxa64/libPocoFoundation.so.31 (0x00007fb5eaac8000)
libPocoJSON.so.31 => /usr/local/MATLAB/R2016b/bin/glnxa64/libPocoJSON.so.31 (0x00007fb5ea87a000)
libPocoNet.so.31 => /usr/local/MATLAB/R2016b/bin/glnxa64/libPocoNet.so.31 (0x00007fb5ea55a000)
libPocoNetSSL.so.31 => /usr/local/MATLAB/R2016b/bin/glnxa64/libPocoNetSSL.so.31 (0x00007fb5ea313000)
libPocoUtil.so.31 => /usr/local/MATLAB/R2016b/bin/glnxa64/libPocoUtil.so.31 (0x00007fb5ea0a0000)
libPocoXML.so.31 => /usr/local/MATLAB/R2016b/bin/glnxa64/libPocoXML.so.31 (0x00007fb5e9e13000)
libxerces-c-3.1.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libxerces-c-3.1.so (0x00007fb5e977c000)
libmwflnetwork.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwflnetwork.so (0x00007fb5e94d2000)
libmwflstoragevfs.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwflstoragevfs.so (0x00007fb5e921b000)
libmwflstorageprovider.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwflstorageprovider.so (0x00007fb5e8fe1000)
libmwstoragefileprovider.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwstoragefileprovider.so (0x00007fb5e8da8000)
libmwstorageshlibstoragesys.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwstorageshlibstoragesys.so (0x00007fb5e8b65000)
libmwstoragefilefolderobserver.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwstoragefilefolderobserver.so (0x00007fb5e8951000)
libmwsearch_path_interfaces.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwsearch_path_interfaces.so (0x00007fb5e8745000)
libmwxmlcore.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwxmlcore.so (0x00007fb5e84cf000)
libopenblas.so.0 => /usr/lib/libopenblas.so.0 (0x00007fb5e643b000)
libquadmath.so.0 => /usr/local/MATLAB/R2016b/sys/os/glnxa64/libquadmath.so.0 (0x00007fb5e61fd000)
libminizip.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libminizip.so (0x00007fb5e5ff0000)
libmwflcrypto.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwflcrypto.so (0x00007fb5e5dc3000)
libmwflcryptoutils.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwflcryptoutils.so (0x00007fb5e5bb7000)
libmwflcryptocryptopp.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwflcryptocryptopp.so (0x00007fb5e5667000)
libmwflstorageevents.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwflstorageevents.so (0x00007fb5e5460000)
libmwstoragesharedlib.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwstoragesharedlib.so (0x00007fb5e5243000)
libmwflcryptoopenssl.so => /usr/local/MATLAB/R2016b/bin/glnxa64/libmwflcryptoopenssl.so (0x00007fb5e5019000)
您的 MATLAB 版本 requires GCC 4.9.x for compiling MEX-files. You likely have version 5.3 instead。
使用 5.3 版编译时,您的二进制文件需要 link 到 5.3 版或更新版本附带的 C++ 库。
MATLAB 是用 4.9 编译的,需要该版本的 C++ 库或更新的库。
MATLAB 带有自己版本的 GCC C++ 库 (v 4.9),并且 links 在您的 MEX 文件被加载之前就已经有了。当您的 MEX 文件被 link 编辑时,已经加载了一个版本的 C++ 库,但它是错误的版本。
有两种方法可以解决这个问题:
官方方法:安装 GCC 4.9.x,并通过向
mex
命令添加适当的参数确保在编译 MEX 文件时使用它。您还必须重新编译您的依赖项(Armadillo 和 MKL,从您的ldd
输出来看,它们似乎依赖于许多其他库)。糟糕的方法:从 MATLAB 目录中删除 C++ 库,并让它使用系统附带的库(较新,因此应该可以工作)。我们正在谈论文件
/usr/local/MATLAB/R2016b/sys/os/glnxa64/libstdc++.so.6
和/usr/local/MATLAB/R2016b/sys/os/glnxa64/libgcc_s.so.1
。这个解决方案比另一个更容易,我不能推荐其他任何东西。过去我用许多不同版本的 Linux 和 MATLAB 做过这个,但可能不会用 Ubuntu 16 和 MATLAB R2016a,所以通过移动文件或重命名它们来仔细尝试,所以你如果 MATLAB 无法启动,可以撤消更改。然而,这确实需要管理员权限,因此它不是对每个人都可行的解决方案。