- Edit "/usr/local/MATLAB/R2016b/bin/glnxa64/mexopts/gfortran.xml"
- In the line beginning with "LINKLIBS=..." remove both references to gfortranbegin
- Add "-lgcc_s.1" to the end of that line inside the quotes
- At the bottom of the file, within the "GFORTRANBEGIN_LIBDIR" block, replace 'dirExists name="$$"' with 'dirExists name="/"'.
- Save the file and set up the Fortran compiler as normal. This worked for me on Gentoo using gfortran 8.2.0-r6.
I have a mex -setup file for Intel oneAPI 24 FORTRAN ifort which reports success but mex still insists on running gfortran to compile
9 views (last 30 days)
Show older comments
The attached file runs sucessfully in mex setup and reports
MEX configured to use 'Intel oneAPI 2024 for Fortran with Microsoft Visual Studio 2022' for FORTRAN language compilation.
It then sets my roaming profile AppData\Roaming\MathWorks\MATLAB\R2023b\mex_FORTRAN_win64.xml with the following information
COMPILER="ifort"
CMDLINE100="$COMPILER
FORTRANROOT="C:\Program Files (x86)\Intel\oneAPI\2024.0"
Yet when I run mex it insists on looking for gfortran!
>> mex -v -R2018a timestwo.F
Verbose mode is on.
... Looking for compiler 'gfortran' ...
... Looking for environment variable 'MINGWROOT' ...No.
... Looking for file '$$\bin\gfortran.exe' ...No.
Did not find installed compiler 'gfortran'.
Any pointers for getting it to run the ifort compiler would be appreciated.
0 Comments
Answers (1)
Maneet Kaur Bagga
on 29 Mar 2024
Hi,
As per my understanding you want to compile a Fortran File using the mex command with the verbose mode enabled (mex -v -R2018a twotimes.F), and MATLAB does not attempt to use the configures "ifort" compiler and it looks for the "gfort" compiler which is not found.
One of the possible workarounds for this is as follows:
Firstly Please refer to the following documentation to refer to the Supported and Compatible Compilers and check if you have all the requirements already setup:
The following MATLAB Asnwer has a similar workaround. Please refer to the link below for further understanding:
Hope this helps!
See Also
Categories
Find more on MATLAB Compiler 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!