Skip to Main Content Skip to Search
Home |   Select Country  Choose Country  |  Contact Us  |  Cart Store 
Create Account | Log In
Products & Services Industries Academia Support User Community Company

Technical Solutions

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


Date Last Modified: 04 Mar 2008
Solution ID:   1-2H64MF
Product:   MATLAB; MATLAB Compiler
Reported in Release:   No Release
Fixed in Release:   R2007b
Platform:   Linux
Operating System:   Linux Any
 

Subject:

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

Problem Description:

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:
/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)

Solution:

This bug has been fixed in Release 2007b (R2007b). For previous product releases, read below for any possible workarounds:

This bug has been fixed in Release 2007a (R2007a). 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:

http://www.mathworks.com/support/compilers/current_release/

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 The 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.)

 

Related Solutions:

  Provide feedback to help us improve this solution!
Contact support
E-mail this page
Print this page