Linux 64bit matlab2012a安装MCR Installer,解决无法打开动态链接库问题

本文详细介绍了如何在Linux 64位环境下,针对MATLAB 2012a版本,安装MCR Installer以解决运行时无法找到动态链接库的问题。通过MATLAB命令行获取MCRInstaller路径,下载并安装,最后设置LD_LIBRARY_PATH和XAPPLRESDIR环境变量,确保正确运行编译后的MATLAB函数。
部署运行你感兴趣的模型镜像

在进行这个实验中,通过c++调用matlab中自己编写的函数(是通过将该函数在matlab中mcc编译成.so,然后c++中调用这个.so的方式),成功编译后(编译时也出现一些错误,详情点这里),但是成功编译完后,居然不能运行。为什么编译通过不报任何错误,但是运行不了呢?原来是因为matlab的动态链接库运行时需要安装MCRInstaller(它包含matlab所有的动态链接库文件),所以本文需要安装一下MCRInstaller。我的matlab版本为2012a。安装步骤:

1)在matlab命令行窗口输入mcrinstaller可以看到很详细的安装提示,什么版本的,下载路径都告诉你了:

>> mcrinstaller
The GLNXA64 MCR Installer, version 7.17, is:
    /opt/MATLAB/R2012a/toolbox/compiler/deploy/glnxa64/MCRInstaller.zip

MCR installers for other platforms are located in:
    /opt/MATLAB/R2012a/toolbox/compiler/deploy/<ARCH>
 <ARCH> is the value of COMPUTER('arch') on the target machine.

Full list of available MCR installers:
/opt/MATLAB/R2012a/toolbox/compiler/deploy/glnxa64/MCRInstaller.zip
 
For more information, read your local MCR Installer help.
Or see the online documentation at MathWorks' web site. (Page may load slowly.)

ans =
/opt/MATLAB/R2012a/toolbox/compiler/deploy/glnxa64/MCRInstaller.zip

2)到它提示的路径(/opt/MATLAB/R2012a/toolbox/compiler/deploy/glnxa64/MCRInstaller.zip),下载安装包。

3)准备好一个可写入的安装路径

$ cd /opt/MATLAB/

$ ls
R2012a

$ sudo mkdir MATLAB_Compiler_Runtime

$ sudo chmod 777 MATLAB_Compiler_Runtime

$ ls
MATLAB_Compiler_Runtime  R2012a

4)安装

$ unzip MCRInstaller.zip
$ ./install

进入图形化安装界面,选好安装路径:/opt/MATLAB/MATLAB_Compiler_Runtime,默认安装就行,部分截图如下:







安装好了后,很人性化的提醒你:On the target computer, append the following to your LD_LIBRARY_PATH environment variable:  /opt/MATLAB/MATLAB_Compiler_Runtime/v717/runtime/glnxa64:/opt/MATLAB/MATLAB_Compiler_Runtime/v717/bin/glnxa64:/opt/MATLAB/MATLAB_Compiler_Runtime/v717/sys/os/glnxa64:/opt/MATLAB/MATLAB_Compiler_Runtime/v717/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/opt/MATLAB/MATLAB_Compiler_Runtime/v717/sys/java/jre/glnxa64/jre/lib/amd64/server:/opt/MATLAB/MATLAB_Compiler_Runtime/v717/sys/java/jre/glnxa64/jre/lib/amd64    Next, set the XAPPLRESDIR environment variable to the following value:  /opt/MATLAB/MATLAB_Compiler_Runtime/v717/X11/app-defaults

照做就行:

$ sudo gedit /etc/profile

添加到这里:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MATLAB/bin/glnxa64:/opt/MATLAB/MATLAB_Compiler_Runtime/v717/runtime/glnxa64:/opt/MATLAB/MATLAB_Compiler_Runtime/v717/bin/glnxa64:/opt/MATLAB/MATLAB_Compiler_Runtime/v717/sys/os/glnxa64:/opt/MATLAB/MATLAB_Compiler_Runtime/v717/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/opt/MATLAB/MATLAB_Compiler_Runtime/v717/sys/java/jre/glnxa64/jre/lib/amd64/server:/opt/MATLAB/MATLAB_Compiler_Runtime/v717/sys/java/jre/glnxa64/jre/lib/amd64

$ source /etc/profile

装完之后,再运行这里的最后一个错误就消失了,matlab动态链接看可以成功调用了!

您可能感兴趣的与本文相关的镜像

Linly-Talker

Linly-Talker

AI应用

Linly-Talker是一款创新的数字人对话系统,它融合了最新的人工智能技术,包括大型语言模型(LLM)、自动语音识别(ASR)、文本到语音转换(TTS)和语音克隆技术

评论 5
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值