Access Keys:
Skip to content (Access Key - 0)

MATLAB compiler issues on Ubuntu lucid and later releases

The default Ubuntu gcc, g++ and gfortran compilers in the Ubuntu natty (11.04) and later releases are incompatible with libraries supplied with the R2011a and later MATLAB releases. If you attempt to use these compilers with MATLAB, you will get errors similar to the following:

...libstdc++.so.6: version `GLIBCXX_3.4.14' not found...

As a workaround, you can install the 4.4 versions of these compilers on your computer and instruct MATLAB to use those compilers instead. To do this type:

sudo aptitude install gcc-4.4 g++-4.4 gfortran-4.4

at a terminal prompt (you will need to know the sudo password to do this). If you are using a debathena cluster machine, you will need to do this every time you log in as these packages do not persist after you log out. You will also need to configure MATLAB to use these compilers instead of the default ones.

To do this for mex:

Start MATLAB. At the MATLAB command prompt, execute mex -setup and select option 1. (Template Options file for building gcc MEX-files).

Exit MATLAB and edit the mexopts.sh file in your ~/.matlab directory for the MATLAB release you are using (for example, the file for the current MATLAB version as of this writing is ~/.matlab/R2012a/mexopts.sh). in your editor, replace occurrences of CC='gcc' by CC='gcc-4.4' in the glnx86 and glnxa64 sections of this file. In like fashion, replace CXX='g++' by CXX='g++-4.4' and FC='gfortran' by FC='gfortran-4.4'.

To do this for the MATLAB compiler:

Similarly to the step above, run mbuild -setup at the MATLAB prompt instead. Choose the only option 1. (Build and link with MATLAB Compiler generated library via the system ANSI C/C++ compiler), and edit the generated mbuildopts.sh file in your home directory (for example, ~/.matlab/R2012a/mbuildopts.sh) in similar fashion to the mexopts.sh file.

See Also

IS&T Contributions

Documentation and information provided by IS&T staff members


Last Modified:

August 04, 2020

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
Labels:
matlab matlab Delete
ubuntu ubuntu Delete
lucid lucid Delete
natty natty Delete
debathena debathena Delete
glibcxx glibcxx Delete
compiler compiler Delete
error error Delete
oneiric oneiric Delete
c-matlab c-matlab Delete
matlab-review matlab-review Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Feedback
This product/service is:
Easy to use
Average
Difficult to use

This article is:
Helpful
Inaccurate
Obsolete
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki