使用 Matlab R2011a 在 Ubuntu 11.04 上编译 Matlab mex 文件时出错

发布于 2024-12-08 05:17:56 字数 1157 浏览 1 评论 0原文

我正在尝试编译一个共享库,它将在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

帅冕 2024-12-15 05:17:56

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!

半﹌身腐败 2024-12-15 05:17:56

根目录是GLIBCXX_3.4.14'未找到。寻找类似的问题: GLIBCXX versions 和 @ninjalj 答案,看来您有链接器问题:

优先使用readelf -aobjdump -x检查ELF文件
字符串

实际上,所有 GLIBCXX_* 版本并不适用于整个
库,但针对每个符号(符号版本控制,请参阅 DSO-howto)。所以你
可以有例如: std::char_traits::eq@@GLIBCXX_3.4.5
std::ios_base::Init::~Init()@@GLIBCXX_3.4 在同一个库文件上。

您的程序需要 GLIBCXX_3.4.9 的事实可能意味着它
已链接到已引入/已更改的符号
GLIBCXX_3.4.9 上的语义。

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:

Use readelf -a and objdump -x to inspect ELF files in preference
to strings.

Actually, all the GLIBCXX_* versions don't apply to the entire
library, but to each symbol (symbol versioning, see DSO-howto). So you
can have e.g: std::char_traits<wchar_t>::eq@@GLIBCXX_3.4.5 and
std::ios_base::Init::~Init()@@GLIBCXX_3.4 on the same library file.

The fact that your program needs GLIBCXX_3.4.9 probably means that it
has been linked against a symbol that has been introduced/has changed
semantics on GLIBCXX_3.4.9.

梦里寻她 2024-12-15 05:17:56

我尝试了 Eric Chu 的答案,但这是唯一对我有用的方法:

sudo ln -s /usr/lib/libstdc++.so.6 {MATLABROOT}/sys/os/{architecture}/libstdc++.so.6

您需要先备份文件。

I tried Eric Chu's answer but this is the only thing that worked for me:

sudo ln -s /usr/lib/libstdc++.so.6 {MATLABROOT}/sys/os/{architecture}/libstdc++.so.6

You will want to backup the file first.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文