I cannot even compile (mex) your (MATLAB) reference book Fortran codes :.(../exte​rn/example​s/refbook)

17 visualizzazioni (ultimi 30 giorni)
Dear MATLAB Personnel,
I am having a deep truouble with your mex command using any *.F90 FORTRAN codes recently. I wa able to mex them when my MATLAB release was R2017 or R 2018 with Ubuntu 18 . Now I moved to Ubuntu 22 and using R2021b. However, I lost the ability to mex my old FORTRAN codes. These are mostly your reference book codes. , like xtimesy.f or such. Each time I tried to mex these codes I got this result :Building with 'gfortran'.
/usr/local/MATLAB/R2021b/extern/version/fortran_mexapi_version.F:4:27:
4 | built_by_rel(1) = z'2021b'
| 1
Error: BOZ literal constant at (1) is neither a DATA statement value nor an actual argument of INT/REAL/DBLE/CMPLX intrinsic subprogram [see ‘-fno-allow-invalid-boz’]
/usr/local/MATLAB/R2021b/extern/version/fortran_mexapi_version.F:5:29:
5 | target_api_ver(1) = FORT_MX_TARGET_API_VER
| 1
Error: BOZ literal constant at (1) is neither a DATA statement value nor an actual argument of INT/REAL/DBLE/CMPLX intrinsic subprogram [see ‘-fno-allow-invalid-boz’]
CAN YOU HELP ME ?
Regards,
Mehmet Ramazanoglu

Risposte (2)

Robert
Robert il 27 Ott 2022
Try using the following compiler flags that will turn it to warnings, mex FFLAGS='$FFLAGS -fallow-argument-mismatch -fallow-invalid-boz'
  2 Commenti
Robert
Robert il 27 Ott 2022
You may also need to do the following if you get the following error when running the mexfile, /usr/local/MATLAB/R2021b/bin/glnxa64/../../sys/os/glnxa64/libgfortran.so.5: version `GFORTRAN_10' not found
sudo ln -sf /usr/lib/x86_64-linux-gnu/libgfortran.so.5.0.0 "/usr/local/MATLAB/R2021b/sys/os/glnxa64/libgfortran.so.5"
Austin MacMaster
Austin MacMaster il 26 Lug 2023
I'm running into exactly this error when running a successfully compiled mexfile. I created the symbolic link as you included it but am still recieving the same error as before. I see the linkage when I run the following:
$ ls -la /usr/local/MATLAB/R2020b/sys/os/glnxa/
...
lrwxrwxrwx 1 root root 46 Jul 26 17:04 libgfortran.so.5 -> /usr/lib/x86_64-linux-gnu/libgfortran.so.5.0.0
...
The mex file complies with warnings:
:
Warning: gcc version '10' not supported. See https://www.mathworks.com/support/compilers/current_release.
MEX completed successfully.
But when I try to run the function.mex file from matlab I recieve the following error:
Invalid MEX-file
'/path/to/mex/files/function.mexa64':
/usr/loca/MATLAB/R2020b/bin/glnxa64/../../sys/os/glnxa64/libgfortran.so.5:
version 'GFORTRAN_10' not found
(required by /usr/loca/heasoft-6.31.1/x86_64-pc-linux-gnu-libc2.35/lib/libXSFunctions.so)
Any ideas why this might still be occurring?

Accedi per commentare.


Mehmet Ramazanoglu
Mehmet Ramazanoglu il 31 Ott 2022
Dear Robert,
Yes , this new line you mentioned in your email worked with warnings however my code was mex(ed) without any errror.
Thanks.
Mmt

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