Build issues with Matlab R2022a on Linux
The heterogeneity
branch builds successfully on macOS with Matlab R2022a installed, i.e. phase_field_build.m
runs without any errors or even warnings.
But the build fails on Ubuntu 22.04 LTS, also using Matlab R2022a, with the following errors:
>> phase_field_build
Building phase_field for MATLAB Version 9.12.0.1884302 (R2022a) mmmmmmm ERROR:
/home/me/temp/PhaseField/heterogeneity/Sources/+phase_field/+mex/Modules/./mex_utils.f90:381:39:
381 | call mxCopyPtrToReal8(v_pr, v, n * m)
| 1
......
393 | call mxCopyPtrToReal8(v_pr, tmp, 1)
| 2
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-2) [-Werror]
/home/me/temp/PhaseField/heterogeneity/Sources/+phase_field/+mex/Modules/./mex_utils.f90:369:39:
369 | call mxCopyPtrToReal8(v_pr, v, n)
| 1
......
393 | call mxCopyPtrToReal8(v_pr, tmp, 1)
| 2
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-1) [-Werror]
/home/me/temp/PhaseField/heterogeneity/Sources/+phase_field/+mex/Modules/./mex_utils.f90:331:41:
331 | call mxCopyPtrToReal8(mat_pr, CC, tensors * tensors * num_materials)
| 1
......
393 | call mxCopyPtrToReal8(v_pr, tmp, 1)
| 2
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-3) [-Werror]
/home/me/temp/PhaseField/heterogeneity/Sources/+phase_field/+mex/Modules/./mex_utils.f90:105:52:
105 | call mxCopyPtrToReal8(mxGetPr(field_pr), out_val, n)
| 1
......
393 | call mxCopyPtrToReal8(v_pr, tmp, 1)
| 2
Error: Rank mismatch between actual argument at (1) and actual argument at (2) (scalar and rank-1) [-Werror]
f951: all warnings being treated as errors
Matlab compatible compilers were installed prior to running the build. Specifically, GFortran, GCC, and G++ were downgraded from the pre-installed version 11 to the compatible version 10, and mex -v -setup
was run at the Matlab prompt to make sure these versions are actually being used.
We want to fix the build issues with Matlab R2022a on Ubuntu so that the code can be more universally deployed.