< SPM
Compilation of SPM12 on Windows 10
This page describes the compilation of SPM12 MEX files on Windows 10 with MATLAB R2018b (9.5) and MSYS2 MinGW-w64 GCC.
If you use other versions of MATLAB and/or compiler, make sure that they are compatible: Supported compilers
Installation of MSYS2/MinGW-w64
Download and install MSYS2 from:
http://www.msys2.org/
in directory C:\msys64. Then, from MSYS2, type:
pacman -Syu pacman -Su pacman -S --needed base-devel pacman -S mingw-w64-x86_64-toolchain
Configuration of MATLAB compilation environment
Start MATLAB and type:
>> setenv('MW_MINGW64_LOC', 'C:\msys64\mingw64') >> mex -setup MEX configured to use 'MinGW64 Compiler (C)' for C language compilation.
Do not worry if there is a warning:
Warning: The MATLAB C and Fortran API has changed to support MATLAB ...
Compilation
In MSYS2, move to the SPM12 source directory with
$ cd /c/Documents and Settings/login/Documents/MATLAB/spm12/src
then set the PATH appropriately
$ PATH=/c/Program\ Files/MATLAB/R2018b/bin/win64:${PATH} $ export MW_MINGW64_LOC=/c/msys64/mingw64/ $ PATH=/c/msys64/mingw64/bin/:${PATH}
and then type the following to start the compilation process
$ make distclean $ make && make install $ make external-distclean $ make external && make external-install
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.