I cannot even compile (mex) your (MATLAB) reference book Fortran codes :.(../extern/examples/refbook)
4 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(2 个)
Robert
2022-10-27
Try using the following compiler flags that will turn it to warnings, mex FFLAGS='$FFLAGS -fallow-argument-mismatch -fallow-invalid-boz'
2 个评论
Robert
2022-10-27
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
2023-7-26
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?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fortran with MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!