Why do I receive an error about gcc version when executing a MEX-file or an executable generated by MATLAB Compiler on Linux?

6 views (last 30 days)
If I call a MEX-file that I compiled using gcc, or an executable that I created using MATLAB Compiler and gcc, I receive the following error:
ERROR: /opt/linux/matlabR14SP3/bin/glnx86/../../sys/os/glnx86/libgcc_s.so.1: version `GCC_3.3' not found (required by /usr/lib/libstdc++.so.6)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 31 May 2023
Edited: MathWorks Support Team on 31 May 2023
This bug has been fixed in Release 2007b (R2007b). For previous product releases, read below for any possible workarounds:
This error may occur when you use MATLAB or MATLAB Compiler in combination with GNU gcc 3.3.x, with gcc 3.2.3 that is distributed by Red Hat, or with another unsupported version of gcc. For the list of supported compilers, consult the following document:
See the related solution to compile and install a fully compatible GNU gcc. While installing the supported version of gcc is strongly recommended, some of our customers have reported the following workarounds are successful. These workarounds have not been tested and are not supported by MathWorks.
Workaround 1:
Before starting MATLAB (if executing a MEX-file) or before executing a file generated by MATLAB Compiler, set the LD_PRELOAD environment variable to /lib/libgcc_s.so.1
For bash users:
export LD_PRELOAD=/lib/libgcc_s.so.1
For csh users:
setenv LD_PRELOAD /lib/libgcc_s.so.1
Workaround 2:
Another workaround is to replace some library files in the MATLAB installation with the corresponding libraries from the version of GCC you are using. Be sure to create backup copies of any libraries you replace, since you may have errors in MATLAB after replacing the libraries. For example in MATLAB 7.1 (R14SP3) you could replace the following files:
libg2c.so.0.0.0
libgcc_s.so.1
libstdc++.so.5.0.3
and the symbolic links associated with these files with newer libraries from your gcc release. The files to be replaced are in the following directory:
$MATLABROOT/sys/os/$ARCH
(where $MATLABROOT is the MATLAB root directory on your machine, as returned by typing:
matlabroot
at the MATLAB command prompt and $ARCH is your architecture "glnx86" for 32-bit Linux and "glnxa64" for 64-bit Linux.)

More Answers (0)

Categories

Find more on C Shared Library Integration in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!