I am trying to run spm12 with matlab 2023b on my macOS but I got this error when I type spm and I have already installed xcode14 from App Store

448 views (last 30 days)
>> spm
Error using spm_check_installation>check_basic
SPM uses a number of MEX files, which are compiled functions.
These need to be compiled for the various platforms on which SPM
is run. It seems that the compiled files for your computer platform
are missing or not compatible. See
https://en.wikibooks.org/wiki/SPM/Installation_on_64bit_Mac_OS_(Intel)
for information about how to compile MEX files for MACA64
in MATLAB 23.2.0.2391609 (R2023b) Update 2.
  11 Comments
Amir
Amir on 25 Sep 2024
download the updated files from github (for apple silicon). copy & replace into your installation directory. then run spm12 in matlab. it works

Sign in to comment.

Answers (2)

Laurent Lamalle
Laurent Lamalle on 27 Oct 2023
Edited: Laurent Lamalle on 27 Oct 2023
Hello,
For SPM12, on my M2-based PowerBook Pro, I succeeded compiling mexmaca64 mex files using the following procedure:
  • In spm12/src, I edited "Makefile.var" and replaced "mexmaci64" with "mexmaca64" in the MacOS section:
  • ##### MacOS #####
  • ifeq (Darwin,$(PLATFORM))
  • MEXEXT = mexmaca64
  • ...
  • In spm12/src, I edited "Makefile" and added in the "Display Messages" section a line to handle mexmaca64:
  • verb.mexmaci64:
  • $(call verb, "MacOS compilation (Intel 64 bit)")
  • verb.mexmaca64:
  • $(call verb, "MacOS compilation (ARM 64 bit)")
  • After that, the commands "make" and "make install" both run successfully (current directory being spm12/src).
  • I edited spm12/external/src/geometry.c, to add:
  • #include "mex.h"
  • after #include "geometry.h".
  • Then, the command:
  • CFLAGS="-I/PathTo/MATLAB_R2023b.app//extern/include/" make external
  • succeeds, as well as
  • make external-install.
  • I further edited spm12/spm_platform.m to insert the line:
  • 'MACA64', 'unx', 0;...
  • after the line
  • 'MACI64', 'unx', 0;...
  • and changed
  • case {'MAC','MACI','MACI64'}
  • to
  • case {'MAC','MACI','MACI64','MACA64'}
  • in the switch comp cases.
It should be easy to further adapt so that both mexmaci64 and mexmaca64 could be compiled depending on the CPU architecture underlying the particular Darwin platform.
Now, it seems that the developer version of SPM (on github.com) includes already mexmaca64 files...
  4 Comments
Xiaoqing
Xiaoqing on 6 Jan 2024
Edited: Walter Roberson on 6 Jan 2024
hello, I met the same issue. I did as the steps mentioned above.
But at the step make && make install step, I got this message:
cp -f spm_sample_vol.mexmaca64 spm_slice_vol.mexmaca64 spm_brainwarp.mexmaca64 spm_conv_vol.mexmaca64 spm_render_vol.mexmaca64 spm_global.mexmaca64 spm_resels_vol.mexmaca64 spm_bsplinc.mexmaca64 spm_bsplins.mexmaca64 spm_unlink.mexmaca64 spm_existfile.mexmaca64 spm_gamrnd.mexmaca64 spm_hist.mexmaca64 spm_krutil.mexmaca64 spm_project.mexmaca64 spm_hist2.mexmaca64 spm_dilate_erode.mexmaca64 spm_bwlabel.mexmaca64 spm_get_lm.mexmaca64 spm_voronoi.mexmaca64 spm_mesh_dist.mexmaca64 spm_mesh_utils.mexmaca64 spm_mrf.mexmaca64 spm_diffeo.mexmaca64 spm_field.mexmaca64 spm_cat.mexmaca64 spm_jsonread.mexmaca64 spm_mesh_reduce.mexmaca64 spm_mesh_geodesic.mexmaca64 spm_mesh_ray_triangle.mexmaca64 spm_gmmlib.mexmaca64 ..
cp: spm_sample_vol.mexmaca64: No such file or directory
cp: spm_slice_vol.mexmaca64: No such file or directory
cp: spm_brainwarp.mexmaca64: No such file or directory
cp: spm_conv_vol.mexmaca64: No such file or directory
cp: spm_render_vol.mexmaca64: No such file or directory
cp: spm_global.mexmaca64: No such file or directory
cp: spm_resels_vol.mexmaca64: No such file or directory
cp: spm_bsplinc.mexmaca64: No such file or directory
cp: spm_bsplins.mexmaca64: No such file or directory
cp: spm_unlink.mexmaca64: No such file or directory
cp: spm_existfile.mexmaca64: No such file or directory
cp: spm_gamrnd.mexmaca64: No such file or directory
cp: spm_hist.mexmaca64: No such file or directory
cp: spm_krutil.mexmaca64: No such file or directory
cp: spm_project.mexmaca64: No such file or directory
cp: spm_hist2.mexmaca64: No such file or directory
cp: spm_dilate_erode.mexmaca64: No such file or directory
cp: spm_bwlabel.mexmaca64: No such file or directory
cp: spm_get_lm.mexmaca64: No such file or directory
cp: spm_voronoi.mexmaca64: No such file or directory
cp: spm_mesh_dist.mexmaca64: No such file or directory
cp: spm_mesh_utils.mexmaca64: No such file or directory
cp: spm_mrf.mexmaca64: No such file or directory
cp: spm_diffeo.mexmaca64: No such file or directory
cp: spm_field.mexmaca64: No such file or directory
cp: spm_cat.mexmaca64: No such file or directory
cp: spm_jsonread.mexmaca64: No such file or directory
cp: spm_mesh_reduce.mexmaca64: No such file or directory
cp: spm_mesh_geodesic.mexmaca64: No such file or directory
cp: spm_mesh_ray_triangle.mexmaca64: No such file or directory
cp: spm_gmmlib.mexmaca64: No such file or directory
make: *** [main-install] Error 1
I tried download the dev version spm again, but it still failed.
Do you have any suggestion, here is my system.
Apple M2 Sonoma
Stefan Möller
Stefan Möller on 29 Jan 2024
Edited: Stefan Möller on 29 Jan 2024
I had similar issues as NADA and Lorenzo. What worked for me was doing the changes to Makefile and Makefile.var as Laurent suggested. In Makefile.var I also changed MEXBIN to
MEXBIN = /Applications/MATLAB_R2023b.app/bin/mex
and in this line
MEXOPTS = -O -largeArrayDims
I changed the "-" because it might have gotten misread by the system. I don't know if that changed anythong though.
I then changed MACI64 to MACA64 in a few places in spm_platform to get SPM to start.

Sign in to comment.


Amir Dehsarvi
Amir Dehsarvi on 9 Apr 2024
Just install SPM12 the developers version.
  10 Comments
Drew
Drew on 24 Oct 2024 at 20:25
UPDATE: I solved this issue but with a non-optimal workaround.
I found somebody with a similar mac M1 infrastructure and simply had them send the spm developers version to me that they downloaded a long time ago.
We noticed that their version does not match the version on github currently (10/24/24), especcially in the src/Makefile.vars and spm_platform.m file. In the current github version, there is nothing to recognize the MACA64 architecture while this seems to be included in the version my colleague had.
For those who are still having issues, I'd recommend finding someone who has spm still working on their mac M1 or M2 and simply have them send you the zip file they have.
Luca
Luca on 14 Nov 2024 at 15:59
Hi Drew, I am struggling with the same problem but haven´t found anyone with the old developers version yet. Would you be willing to send it to me? Thank you!
Best
luca

Sign in to comment.

Categories

Find more on Environment and Settings in Help Center and File Exchange

Tags

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!