MATLAB GCC version compatibility fix

Matlab with GCC / Gfortran needs compatible libc and libgfortran libraries. On non-officially-supported systems (too new Linux version), libc or libgfortran may be incompatible with Matlab.

Fortran

MATLAB/sys/os/glnxa64/libgfortran.so.5: version ‘GFORTRAN_1.4’ not found (required by /usr/lib/liblapack.so.3) MATLAB/sys/os/glnxa64/libgfortran.so.5: version `GFORTRAN_1.4' not found (required by /usr/lib/libblas.so.3)

Workaround: let the system default dynamic shared libraries take priority by renaming the Matlab libraries like:

cd $(matlab -batch "disp(matlabroot)")/sys/os/glnxa64

mv libgfortran.so.5 libgfortran.so.5.bak

C++

MATLAB/sys/os/glnxa64/libstdc++.so.6: version ‘GLIBCXX_3.4’ not found

Workaround: let the system default dynamic shared libraries take priority by renaming the Matlab libraries like:

cd $(matlab -batch "disp(matlabroot)")/sys/os/glnxa64

mv libstdc++.so.6 libstdc++.so.6.bak

Fix

If Matlab won’t startup, another way to do this from the system Terminal is:

cd $(dirname $(realpath $(which matlab)))/../sys/os/glnxa64/

mv libstdc++.so.6 libstdc++.so.6.bak