GLIBCXX not found when compiling vtk example under mex

I am trying to run this example to compile vtk in MATLAB using mex on 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 get 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 make sure glibcxx is found? I would suggest that it will be included by default in compilation.

+4
source share
1 answer

Matlab uses its own glibc libraries, and this is often a big mess.

To solve this problem, you must first make sure that Matlab is using a supported version of gcc . Do you get a warning about this when compiling?

If you are a sudoer, you can also make matlab use standard glibc by doing something like this (I did this 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 complain about it on the Internet, there are different solutions if these two do not work.

+12
source

Source: https://habr.com/ru/post/1385194/


All Articles