使用 Matlab R2011a 在 Ubuntu 11.04 上编译 Matlab mex 文件时出错
我正在尝试编译一个共享库,它将在 Ubuntu 11.04 上调用 MATLAB 函数。就像命令一样:
mcc - B cpplib:libStepCluster StepCluster.m
得到以下错误。
/usr/lib/i38-linux-gnu/i686-linux-gnu/4.5.2/cc1plus: /usr/local/MATLAB/R2010a/sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by /usr/lib/libppl_c.so.2)
/usr/lib/i38-linux-gnu/i686-linux-gnu/4.5.2/cc1plus: /usr/local/MATLAB/R2010a/sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib/libppl_c.so.2)
/usr/lib/i38-linux-gnu/i686-linux-gnu/4.5.2/cc1plus: /usr/local/MATLAB/R2010a/sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by /usr/lib/libppl.so.7)
/usr/lib/i38-linux-gnu/i686-linux-gnu/4.5.2/cc1plus: /usr/local/MATLAB/R2010a/sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib/libppl.so.7)
/usr/lib/i38-linux-gnu/i686-linux-gnu/4.5.2/cc1plus: /usr/local/MATLAB/R2010a/sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib/libgmpxx.so.4)
我知道代码在 Ubuntu 10.10 上运行良好,并升级到 Ubuntu 11.04。那么问题就出来了。问题是什么以及如何在不造成太多痛苦的情况下解决它?
I am trying to compile a shared library which will call MATLAB function on Ubuntu 11.04. Like the command:
mcc - B cpplib:libStepCluster StepCluster.m
Get the following error.
/usr/lib/i38-linux-gnu/i686-linux-gnu/4.5.2/cc1plus: /usr/local/MATLAB/R2010a/sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by /usr/lib/libppl_c.so.2)
/usr/lib/i38-linux-gnu/i686-linux-gnu/4.5.2/cc1plus: /usr/local/MATLAB/R2010a/sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib/libppl_c.so.2)
/usr/lib/i38-linux-gnu/i686-linux-gnu/4.5.2/cc1plus: /usr/local/MATLAB/R2010a/sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by /usr/lib/libppl.so.7)
/usr/lib/i38-linux-gnu/i686-linux-gnu/4.5.2/cc1plus: /usr/local/MATLAB/R2010a/sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib/libppl.so.7)
/usr/lib/i38-linux-gnu/i686-linux-gnu/4.5.2/cc1plus: /usr/local/MATLAB/R2010a/sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib/libgmpxx.so.4)
I konw the code works fine with Ubuntu 10.10, and upgraded to Ubuntu 11.04. Then the problem comes out. What is the problem and how to resolve it without too much pain?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
MatLab R2011a编译错误解决方案。
下载并安装 GCC-4.4
使用命令: mbuild -setup
选择选项 1 然后你会得到一个文件,位于 /usr/local/MATLAB/R2011a/bin/mbuildopts.sh
搜索该文件并将所有编译器选项替换为 gcc- 4.4
然后编译一下,应该就可以了!
MatLab R2011a Compile Error Solution.
Download and install GCC-4.4
Use command: mbuild -setup
Choose option 1 and then you will get a file locate in /usr/local/MATLAB/R2011a/bin/mbuildopts.sh
Search the file and replace all the compiler option with gcc-4.4
Then compile it, it should be fine!
根目录是
GLIBCXX_3.4.14'未找到
。寻找类似的问题: GLIBCXX versions 和 @ninjalj 答案,看来您有链接器问题:The root is
GLIBCXX_3.4.14' not found
. Looking a similar SO question: GLIBCXX versions and @ninjalj answer, it appears you have a linker problem:我尝试了 Eric Chu 的答案,但这是唯一对我有用的方法:
您需要先备份文件。
I tried Eric Chu's answer but this is the only thing that worked for me:
You will want to backup the file first.