Fedora 9 on a Dell Latitude D630.

MATLAB 2008b, Mex, and GCC 4.3.0


I run Fedora 9 on my Dell D630 Latitude. This is an excellent machine/software combo. However, I pulled out some older code from my graduate career to run in MATLAB for research purposes and could not get the software to compile. MATLAB would run (I was running 2008a at the time), but would not mex c-code especially built to be ran through a Mex interface. I installed the new version of MATLAB (version 2008b) thinking this might fix some issues. This did not. The same compilation error still remained.


Linux, MATLAB, and LSTDC++

Upon issuing the mex command, I received the warning

Warning: You are using gcc version “4.3.0”. The earliest gcc version supported with mex is “4.0.0”. The latest version tested for use with mex is “4.2.0”. To download a different version of gcc, visit http://gcc.gnu.org

This really didn’t concern me since the gcc compilers are always backward compatible. The next error message was

usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status

mex: link of ‘ “xxxxxxx.mexa64″‘ failed.

??? Error using ==> mex at 213
Unable to complete successfully.

After googling this problem, I saw that mex wasn’t finding the C++-compiler.

In the past, I’ve had similar errors and I always created a link to libstdc++.so.6 in /usr/lib to whatever the current version was (libstdc++.so.6.0.x typically). However, this file existed but libstdc++.so did not.

I created a symbolic link (do a “man ln” at the terminal) /usr/lib/libstdc++.so to the /usr/lib/libstdc++.so.6.0.10 in the same directory. However, this too did not work, but gave the error

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.3.0/../../../libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/libstdc++.so when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status

Then I noticed in the /usr/local/matlab/sys/os/glnxa64 directory that there was a libstdc++.so.6 and a libstdc++.so.6.0.8. When I made the symbolic link /usr/lib/libstdc++.so to /usr/local/matlab/sys/os/glnxa64/libstdc++.so.6.0.8, the compilation works.


MATLAB works, again!  A simple symbolic link takes things from being very broken to very functional again.

If you have any questions, leave them below in the comments.

2 thoughts on “MATLAB 2008b, Mex, and GCC 4.3.0”

Leave a Reply