Why am I unable to use MEX on Solaris 10 in MATLAB 7.0.4 (R14SP2)?

3 views (last 30 days)
I am using the Solaris 10 ANSI C compiler to compile the yprime.c MEX-file located in $MATLAB/extern/examples/mex (where $MATLAB is the MATLAB installation directory, which is returned by typing "matlabroot" at the MATLAB command prompt). When I execute the following code:
mex yprime.c
I receive the following error:
"/usr/include/sys/feature_tests.h", line 332: #error: "Compiler or
options invalid for pre-UNIX 03 X/Open applications and pre-2001
POSIX applications"
cc: acomp failed for yprime.c
mex: compile of 'yprime.c' failed.
??? Error using ==> mex
Unable to complete successfully

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This bug has been fixed in Release 2006a (R2006a). For previous product releases, read below for any possible workarounds:
We have verified that there has been a change in the Solaris 10 system ANSI C compiler that causes this error. The critical part of the error message is:
"Compiler or options invalid for pre-UNIX 03 X/Open applications and pre-2001 POSIX applications"
The Solaris 10 system ANSI C compiler (cc) is no longer tolerant of implicit support for ISO C99 standard features. The compiler now requires that you explicitly enable C99 features by using either the -xc99 flag or by some other means, such as an _XOPEN_SOURCE=600 macro, even if you do not use any of these features.
To fix this error use the following steps:
1. Rename the file, $MATLAB/bin/mexopts.sh to mexopts.sh.old
(Where the term $MATLAB represents the MATLAB installation directory.)
2. Download the attached file, mexopts.tar, to $MATLAB/bin
3. Extract the file mexopts.sh from mexopts.tar. In MATLAB you can use the UNTAR function to do this. Once you have extracted mexopts.sh you can delete mexopts.tar.
4. At the command prompt, execute:
mex -setup.
5. Select the "system ANSI C compiler". This should now refer to the file you just downloaded.

More Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products


Release

R14SP2

Community Treasure Hunt

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

Start Hunting!