mex下编译vtk示例时未找到GLIBCXX

发布于 2024-12-19 20:03:16 字数 611 浏览 5 评论 0原文

我一直在尝试按照 这个示例 在 Ubuntu 上使用 mex 在 MATLAB 中编译 vtk 11.10。我使用的 mex 命令如下:

mex -I/usr/include/vtk-5.6 vtk_file.cpp -L/usr/lib/ -lvtkFiltering -lvtkRendering -lvtkCommon

编译后我有一个 .mexa64 文件。

但是,当我尝试运行该文件时,最终出现以下错误:

Invalid MEX-file '/home/bill/Documents/MATLAB/vtk/vtk_file.mexa64': 
/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6:
version `GLIBCXX_3.4.11' not found (required by /usr/lib/libvtkFiltering.so.5.6)

如何确保找到 glibcxx?我本以为它会默认包含在编译中。

I have been trying to follow this example for compiling vtk in MATLAB using mex, on an Ubuntu 11.10. The mex command I used is as follows:

mex -I/usr/include/vtk-5.6 vtk_file.cpp -L/usr/lib/ -lvtkFiltering -lvtkRendering -lvtkCommon

After compilation I have a .mexa64 file.

However, when I try to run the file I end up with the following error:

Invalid MEX-file '/home/bill/Documents/MATLAB/vtk/vtk_file.mexa64': 
/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6:
version `GLIBCXX_3.4.11' not found (required by /usr/lib/libvtkFiltering.so.5.6)

How can I ensure that glibcxx is found? I would have assumed that it would be included by default in the compilation.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

平生欢 2024-12-26 20:03:16

Matlab 使用自己的 glibc 库,因此常常会造成一团糟。

要解决该问题,您应该首先尝试确保 matlab 使用受支持的 gcc 版本。编译时你会收到警告吗?

如果你是sudoer,你也可以“强制”matlab使用标准glibc,通过做类似的事情(我做到了,而且效果很好):

cd /usr/local/MATLAB/R2011a/sys/os/glnxa64
sudo mkdir old
sudo mv libstdc++.so.6* old
sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6 

很多人在互联网上抱怨这一点,有不同的解决方案,如果那些两个不起作用。

Matlab uses its own glibc librarires, and it's often a big mess because of that.

To solve that problem you should first try to ensure that matlab use a supported version of gcc. Do you get a warning about that when you compile?

If you are sudoer, you can also "force" matlab to use the standard glibc, by doing something like that (I did it, and it works fine):

cd /usr/local/MATLAB/R2011a/sys/os/glnxa64
sudo mkdir old
sudo mv libstdc++.so.6* old
sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6 

Many people complain about that on the internet, there are different solutions, if those two ones don't work.

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