- 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
13 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Maneet Kaur Bagga
2024-3-29
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!
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!