GLIBCXX_3.4 not found problem in Matlab under Ubuntu

Tuesday, May 17, 2011
Today wanting to experiment with compilation tools in Matlab R2010b under Ubuntu 11.04 I faced the following error using the latest gcc 4.5 to compile the example 'yprime.c' given in Matlab's mex guide:

$matlab/sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.sth not found 

Searching in Google revealed that I haven't installed g++ libraries. Straight to synaptic package manager to install libstdc++ (I also installed g++, gcc-multilib and c++ just to be sure :p). But the problem was still there..

After a little digging I found a post describing that i had to replace some files in /usr/local/matlabfolder/sys/os/glnx86/ folder. Had to remove matlab's libstdc++.so files:

cd /usr/local/matlabR2010b/sys/os/glnx86/

Create backup of the three files first!!

sudo cp libstdc++.so.6 ~/Desktop
sudo cp libstdc+.so.6.0.14 ~/Desktop
sudo cp libgcc_s.so.1 ~/Desktop

then get rid of the old ones:

sudo rm libstdc++.so.6
sudo rm libstdc+.so.6.0.14
sudo rm libgcc_s.so.1

and substitude them with the ones used by gcc (probably in /usr/lib/i386-linux-gnu/ or just /usr/lib/)

sudo ln -s /usr/lib/i386-linux-gnu/libstdc++.so.6
sudo ln -s /usr/lib/i386-linux-gnu/libstdc++.so.6.0.14
sudo ln -s /usr/lib/i386-linux-gnu/libgcc_s.so.1

and presto, Matlab compiles like charm!



No comments:

Post a Comment

 
Copyright © Synaptic Activity
Blogger Theme by BloggerThemes Sponsored by Busy Buzz Blogging