mex下编译vtk示例时未找到GLIBCXX
我一直在尝试按照 这个示例 在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Matlab 使用自己的 glibc 库,因此常常会造成一团糟。
要解决该问题,您应该首先尝试确保 matlab 使用受支持的 gcc 版本。编译时你会收到警告吗?
如果你是sudoer,你也可以“强制”matlab使用标准glibc,通过做类似的事情(我做到了,而且效果很好):
很多人在互联网上抱怨这一点,有不同的解决方案,如果那些两个不起作用。
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):
Many people complain about that on the internet, there are different solutions, if those two ones don't work.