I would like to determine the platform and compiler version that I am using.
MATLAB: How to determine the platform and compiler version that I am using
alphaglnx86hp700hpuxibm_rslinuxMATLABsgisol2solarisunix
Related Solutions
Currently it is not possible to select a supported compiler with "mex -setup" in LINUX and MAC based systems.
As a workaround, please consider using any of the following:
A. Make system's default "gcc" command point to the supported GCC version
1. Open the terminal window in LINUX and execute the command: $ which gcc This will provide the symbolic link (softlink) to the default version of GCC. 2. Navigate to the directory which has this softlink. Change the softlink to point to the version of GCC that you want to use. For example, for a standard GCC version 4.7 installed (where the compiler command is put at /usr/bin/gcc-4.7), this can be done using the following command: $ sudo ln -f -s /usr/bin/gcc-4.7 gcc Here "gcc" is the name of the softlink determined in step 1. If you execute the command “ls –l gcc” on the terminal, it will indicate that softlink points to gcc-4.7. Note: As an alternative to steps 1 and 2 above, you should also be able to use the following one liner: $ sudo ln -s -f `dirname \`which gcc\``/gcc-4.3 `which gcc` 3. Now open MATLAB and execute the following command: >> !gcc --version This command reflects the version of GCC compiler that is currently being used by MATLAB. If you specify gcc-4.7 as above, it will indicate “gcc-4.7”. You may also use the verbose mode ("-v" flag) to display detailed build information: >> mex -v timestwo.c
B. (For MATLAB releases R2013b and before) Specify the supported GCC compiler in the "mexopts.sh"
On MATLAB command window, first execute "mex -setup" and then select "1" and finally "y" which will include output similar to: /usr/local/MATLAB/R2013b/bin/mexopts.sh is being copied to /home/<username>/.matlab/R2013b/mexopts.sh Open "/home/<username>/.matlab/R2013b/mexopts.sh' with an editor. The compiler is specified with CC='gcc'. Replace the 'gcc' part with the path of the supported compiler as in: CC='/usr/bin/gcc-4.7'
C. Specify the compiler while using the "mex" command (this overrides the default compiler)
<For MATLAB releases R2014a and after> Specify the path of the supported compiler in the compiler option (CC or GCC): >> mex -v GCC='/usr/bin/gcc-4.7' timestwo.c >> mex -v CC='/usr/bin/gcc-4.7' timestwo.c <For MATLAB releases R2013b and before> Specify the path of the supported compiler in the compiler option (CC): >> mex -v CC='/usr/bin/gcc-4.7' timestwo.c
With the initial release of MATLAB Compiler 4.0 (R14), support was available only for Microsoft Windows and Linux (32-bit only).
As of MATLAB Compiler 4.1 (R14SP1), we now additionally support Solaris.
As of MATLAB Compiler 4.2 (R14SP2), we now additionally support HP-UX 11.
Best Answer