When I tried to compile mex files in Matlab (R2009a, 32-bit) on my Ubuntu 11.10 system, I got the following error:
>>mexAll
/usr/bin/ld: /home/swagatika/softwares/matlab/sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.10' not found (required by /usr/bin/ld)
/usr/bin/ld: /home/swagatika/softwares/matlab/sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/bin/ld)
/usr/bin/ld: /home/swagatika/softwares/matlab/sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/bin/ld)
collect2: ld returned 1 exit status
mex: link of ' "minFunc_2009/lbfgsC.mexglx"' failed.
Well, I found that I upgraded my system from v10.10 to 11.10. In the process, the libraries stored in Matlab were not updated with the system libraries.
So when such an error occurs,
1) Locate the library file in the system.
2)Remove or create a back up of the library in Matlab path.
3)Create a soft link in the matlab's appropriate folder for the one present in /usr/lib/
$ locate libstdc++.so.6
/home/swagatika/.dropbox-dist/libstdc++.so.6
/home/swagatika/softwares/matlab/sys/os/glnx86/libstdc++.so.6
/home/swagatika/softwares/matlab/sys/os/glnx86/libstdc++.so.6.0.9
/home/swagatika/softwares/matlab/toolbox/shared/hdllink/scripts/linux32/libstdc++.so.6
/home/swagatika/softwares/matlab/toolbox/shared/hdllink/scripts/linux32/libstdc++.so.6.0.9
/home/swagatika/softwares/matlab/toolbox/symbolic/mupad/linux/lib/gcclibs/libstdc++.so.6
/usr/lib/i386-linux-gnu/libstdc++.so.6
/usr/lib/i386-linux-gnu/libstdc++.so.6.0.16
/usr/lib/ure/lib/libstdc++.so.6
$ln -s /usr/lib/i386-linux-gnu/libstdc++.so.6 libstdc++.so.6
Now it compiles properly.
No comments:
Post a Comment