Compiling a fortran mex file on an intel mac

3 visualizzazioni (ultimi 30 giorni)
Roy Goodman
Roy Goodman il 5 Ott 2021
Commentato: Ananth il 15 Set 2023
I am attempting to compile a mex file. I have an Intel Mac running Mac Os Big Sur and have intel OneAPI compilers installed including fortran. These are supported and I was able to run mex -setup FORTRAN successfully.
The mex file I want to compile is here: http://www-m3.ma.tum.de/Software/ODEFiles
The first downloadable file is called "dopri" and the download linked from the text "04.11.2014"
The authors include a file compile.m, but no longer update it or the compilation instructions.
The first time I ran it, I got an error because compile.m adds (at line 66) a compile flag "-lgfortran" referencing GNU Fortran which isn't installed.
I removed line 66 and tried again. It ran for a while, but eventually (upon trying to run line 78 of compile.m it tried to execute this compilation command:
/usr/bin/xcrun -sdk macosx11.3 clang -Wl,-twolevel_namespace -undefined error -arch x86_64 -mmacosx-version-min=10.15 -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -bundle -Wl,-exported_symbols_list,"/Applications/MATLAB_R2021b.app/extern/lib/maci64/mexFunction.map" /var/folders/0p/lqhdk1m88xj8w30059_snrh80000gq/T/mex_672399187457508_92268/c_mexapi_version.o "dop853Mex.o" "options.o" "tif.o" "dop853.o" "tif_test.o" -O -Wl,-exported_symbols_list,"/Applications/MATLAB_R2021b.app/extern/lib/maci64/c_exportsmexfileversion.map" -L"/Applications/MATLAB_R2021b.app/bin/maci64" -lmx -lmex -lmat -lc++ -o dop853Mex.mexmaci64
This returned the following error messages:
Error using mex
Undefined symbols for architecture x86_64:
"_for_write_seq_fmt", referenced from:
_dp86co_ in dop853.o
"_for_write_seq_lis", referenced from:
_dop853_ in dop853.o
_dp86co_ in dop853.o
_contd8_ in dop853.o
"_for_write_seq_lis_xmit", referenced from:
_dop853_ in dop853.o
_dp86co_ in dop853.o
_contd8_ in dop853.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error in compile (line 78)
mex(args{:},'dop853Mex.o','options.o','tif.o','dop853.o','tif_test.o');
Can anyone help me complete this compilation?
  1 Commento
Ananth
Ananth il 15 Set 2023
leaving this answer for others in case you stumble across the question:
need to include libifcore.a and its location in the mex command as
mex <source_files> <object_files> -lifcore -L/opt/intel/oneapi/compiler/2023.1.0/mac/compiler/lib/
On my computer, the libifcore.a file is located in /opt/intel/oneapi/compiler/2023.1.0/mac/compiler/lib/; change as needed for your machine.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su MATLAB Compiler in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by