Monday, July 01, 2013

Problems with libstdc++.so.6 when compiling mex files in Matlab 2013a x64 on Xubuntu 13.04 x64

Problem compiling mex files in Matlab 2013a x64 on Linux (Xubuntu 13.04 x64):/usr/lib/gcc/x86_64-linux-gnu/4.7/cc1plus: /usr/local/MATLAB/R2013a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/libppl_c.so.4) /usr/lib/gcc/x86_64-linux-gnu/4.7/cc1plus: /usr/local/MATLAB/R2013a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/libppl.so.12)

The problem was that Matlab was linking libstdc++.so.6 (located in /usr/local/MATLAB/R2013a/sys/os/glnxa64) to the file it provides, i.e. libstdc++.so.6.0.13 (located in /usr/local/MATLAB/R2013a/sys/os/glnxa64).

This is the old version of libstdc++, and xubuntu has newer version, i.e. libstdc++.so.6.0.17 (located in /usr/lib/x86_64-linux-gnu).

Thus, I solved this problem by changing the symbolic link in Matlab to point to the new version:cd /usr/local/MATLAB/R2013a/sys/os/glnxa64
sudo mv libstdc++.so.6 libstdc++.so.6_org
sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17 libstdc++.so.6