|
1 | 1 | # Compilation of SPM on macOS
|
2 | 2 |
|
| 3 | +This page describes the compilation of SPM MEX files on macOS. |
| 4 | + |
3 | 5 | !!! tip
|
4 |
| - If you are using macOS Catalina, Big Sur, Monterey or Ventura, check the [Troubleshooting section](#troubleshooting) first as you should not need to recompile the MEX files. |
| 6 | + If you are using macOS Catalina, Big Sur, Monterey or Ventura and have apparent problems with the MEX files provided with SPM, check the [Troubleshooting section](#troubleshooting) first as it is very likely you do not need to recompile the MEX files. |
5 | 7 |
|
6 |
| -Should you want to compile SPM MEX files, you need to have Apple's |
7 |
| -development environment [Xcode](http://developer.apple.com/tools/xcode/) |
8 |
| -installed. |
| 8 | +To compile SPM MEX files, you need to have Apple's development environment [Xcode](http://developer.apple.com/tools/xcode/) installed. |
9 | 9 |
|
10 |
| -You also need to have the *mex* executable in your system path. To do |
| 10 | +You also need to have the `mex` executable in your system path. To do |
11 | 11 | so, type the following in a Terminal:
|
12 | 12 | ```
|
13 |
| -export PATH=/Applications/MATLAB_R2017a.app/bin:\$PATH |
| 13 | +export PATH=/Applications/MATLAB_R2017a.app/bin:$PATH |
14 | 14 | ```
|
15 | 15 | with the appropriate path where MATLAB is installed
|
16 | 16 |
|
17 |
| -Then, in a Terminal, from the *src* folder of your SPM12 installation, |
| 17 | +If you get errors such as `Bad : modifier in $ (/)`, this is because |
| 18 | +the instructions are given for a `bash` Terminal while you are using a |
| 19 | +`tcsh` Terminal. The equivalent commands are: |
| 20 | +``` |
| 21 | +setenv PATH /Applications/MATLAB_R2017a.app/bin:${PATH} |
| 22 | +``` |
| 23 | + |
| 24 | +## Instructions |
| 25 | + |
| 26 | +In a Terminal, from the *src* folder of your SPM installation, |
18 | 27 | type:
|
19 | 28 | ```
|
20 |
| -cd /Users/login/spm12/src |
| 29 | +cd /Users/login/spm/src |
21 | 30 | make distclean
|
22 | 31 | make && make install
|
23 | 32 | make external-distclean
|
24 | 33 | make external && make external-install
|
25 | 34 | ```
|
26 | 35 |
|
27 |
| -If you get errors such as `Bad : modifier in \$ (/)`, this is because |
28 |
| -the instructions are given for a bash` Terminal while you are using a |
29 |
| -`tcsh` Terminal. The equivalent commands are: |
30 |
| -``` |
31 |
| -setenv PATH /Applications/MATLAB_R2017a.app/bin:\${PATH} |
32 |
| -``` |
33 |
| - |
34 |
| -If you get errors such as `xcrun: error: SDK "macosx10.14.1" cannot be |
35 |
| -located` while compiling, execute the following: |
36 |
| -``` |
37 |
| -sudo xcode-select --switch /Applications/Xcode.app/ |
38 |
| -``` |
| 36 | +This will generate `*.mexmaci64` or `*.mexmaca64` MEX files. |
39 | 37 |
|
40 | 38 | ## Troubleshooting
|
41 | 39 |
|
42 |
| -### macOS Catalina, Big Sur, Monterey, Ventura |
43 |
| - |
44 |
| -If you have issues with MEX files on macOS with one of these errors: |
| 40 | +!!! failure "macOS Catalina, Big Sur, Monterey, Ventura" |
45 | 41 |
|
46 |
| -``` |
47 |
| -"*.mexmaci64" cannot be opened because the developer cannot be verified. |
48 |
| -macOS cannot verify that this app is free from malware |
49 |
| -``` |
50 |
| -``` |
51 |
| -Code signature not valid for use in process using Library Validation: library load disallowed by system policy |
52 |
| -``` |
53 |
| -open a Terminal, `cd` to the SPM directory and type: |
| 42 | + If you have issues with MEX files on macOS with one of these errors: |
54 | 43 |
|
55 |
| -``` |
56 |
| -find . -name "*.mexmaci64" -exec xattr -d com.apple.quarantine {} \; |
57 |
| -``` |
| 44 | + ``` |
| 45 | + "*.mexmaci64" cannot be opened because the developer cannot be verified. |
| 46 | + macOS cannot verify that this app is free from malware |
| 47 | + ``` |
| 48 | + ``` |
| 49 | + Code signature not valid for use in process using Library Validation: library load disallowed by system policy |
| 50 | + ``` |
| 51 | + open a Terminal, `cd` to the SPM directory and type: |
58 | 52 |
|
59 |
| -If it doesn't work, please try this equivalent alternative, replacing |
60 |
| -`SPM_PATH` with the path of your SPM installation: |
| 53 | + ``` |
| 54 | + find . -name "*.mexmaci64" -exec xattr -d com.apple.quarantine {} \; |
| 55 | + ``` |
61 | 56 |
|
62 |
| -``` |
63 |
| -sudo xattr -r -d com.apple.quarantine SPM_PATH |
64 |
| -sudo find SPM_PATH -name "*.mexmaci64" -exec spctl --add {} \; |
65 |
| -``` |
66 |
| - |
67 |
| -### Java Exception and abrupt exit on Mac OS X version 10.10 Yosemite |
| 57 | + If it doesn't work, please try this equivalent alternative, replacing `SPM_PATH` with the path of your SPM installation: |
68 | 58 |
|
69 |
| -If you get MATLAB issues with Yosemite, see the following bug report for |
70 |
| -a patch: |
| 59 | + ``` |
| 60 | + sudo xattr -r -d com.apple.quarantine SPM_PATH |
| 61 | + sudo find SPM_PATH -name "*.mexmaci64" -exec spctl --add {} \; |
| 62 | + ``` |
71 | 63 |
|
72 |
| -[`http://www.mathworks.com/support/bugreports/1098655`](http://www.mathworks.com/support/bugreports/1098655) |
| 64 | +!!! failure "`xcrun: error: SDK "macosx10.14.1" cannot be located` error" |
73 | 65 |
|
74 |
| -### "`This is pdfTeX, Version ...`" error |
| 66 | + If you get errors such as `xcrun: error: SDK "macosx10.14.1" cannot be located` while compiling, execute the following before compilation: |
| 67 | + ``` |
| 68 | + sudo xcode-select --switch /Applications/Xcode.app/ |
| 69 | + ``` |
75 | 70 |
|
76 |
| -If you get an error message such as: |
| 71 | +!!! failure "Java Exception and abrupt exit on Mac OS X version 10.10 Yosemite" |
77 | 72 |
|
78 |
| -``` |
79 |
| -mex -O -c spm_vol_utils.c -DSPM_UNSIGNED_CHAR |
80 |
| - mex: unrecognized option `-O' |
81 |
| - mex: unrecognized option `-c' |
82 |
| -This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011) |
83 |
| -restricted \write18 enabled. |
84 |
| -entering extended mode |
85 |
| -(./spm_vol_utils.c |
86 |
| -This is MeX Version 1.05 18 XII 1993 (B. Jackowski & M. Ry\'cko) |
87 |
| - ! You can't use `macro parameter character #' in vertical mode. |
88 |
| -``` |
| 73 | + If you get MATLAB issues with Yosemite, see the following bug report for a patch: |
89 | 74 |
|
90 |
| -this is due to a conflict between MATLAB `mex` and a LaTeX command with |
91 |
| -the same name. Edit `src/Makefile.var` and mention the full path when |
92 |
| -referring to MEXBIN |
| 75 | + [`http://www.mathworks.com/support/bugreports/1098655`](http://www.mathworks.com/support/bugreports/1098655) |
93 | 76 |
|
94 |
| -``` |
95 |
| -MEXBIN = /Applications/MATLAB_R2012a.app/bin/mex |
96 |
| -``` |
| 77 | +!!! failure "`This is pdfTeX, Version ...` error" |
97 | 78 |
|
98 |
| -or change PATH accordingly. |
| 79 | + If you get an error message such as: |
| 80 | + ``` |
| 81 | + mex -O -c spm_vol_utils.c -DSPM_UNSIGNED_CHAR |
| 82 | + mex: unrecognized option `-O' |
| 83 | + mex: unrecognized option `-c' |
| 84 | + This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011) |
| 85 | + restricted \write18 enabled. |
| 86 | + entering extended mode |
| 87 | + (./spm_vol_utils.c |
| 88 | + This is MeX Version 1.05 18 XII 1993 (B. Jackowski & M. Ry\'cko) |
| 89 | + ! You can't use `macro parameter character #' in vertical mode. |
| 90 | + ``` |
| 91 | + this is due to a conflict between MATLAB `mex` and a LaTeX command with |
| 92 | + the same name. Edit `src/Makefile.var` and mention the full path when |
| 93 | + referring to MEXBIN |
| 94 | + ``` |
| 95 | + MEXBIN = /Applications/MATLAB_R2012a.app/bin/mex |
| 96 | + ``` |
| 97 | + or change PATH accordingly. |
99 | 98 |
|
100 |
| -### Slowdown when using graphical inputs |
| 99 | +!!! failure "Slowdown when using graphical inputs" |
101 | 100 |
|
102 |
| -This seems to happen when a window manager for macOS is installed ([Magnet](https://magnet.crowdcafe.com/) or [Tiles](https://freemacsoft.net/tiles/)), see also |
103 |
| -[this](https://www.mathworks.com/matlabcentral/answers/475682). |
| 101 | + This seems to happen when a window manager for macOS is installed ([Magnet](https://magnet.crowdcafe.com/) or [Tiles](https://freemacsoft.net/tiles/)), see also [this](https://www.mathworks.com/matlabcentral/answers/475682). |
0 commit comments