[FieldTrip] MEX compilation failure under R2020a on macOS 10.14

Boomen, C. van den (Carlijn) C.vandenBoomen at uu.nl
Fri May 29 09:39:07 CEST 2020


Hi Andrew,

To add to the information on the website, this is what in total solved the problem. I think step 1 and possibly step two aren't necessary, but this total process did the trick for me.


1.     Download the program Xcode from the Applestore (free of charge)

2.     Copy in the Matlab command window the following code: ft_compile_mex

3.     Open a terminal and copy the following code (where LOCATION_OF_FIELDTRIP is the direction to FieldTrip), and type your computer password when a password is asked for in the terminal

sudo xattr -r -d com.apple.quarantine LOCATION_OF_FIELDTRIP

4.     Copy the following code in the terminal

sudo find LOCATION_OF_FIELDTRIP -name \*.mex\* -exec spctl --add {} \;


Best,
Carlijn

Dr. Carlijn van den Boomen | Departments of Developmental and Experimental Psychology | Utrecht University | Langeveld Building - room H066 | Heidelberglaan 1 | 3584 CS Utrecht | the Netherlands | phone: +31(30) 253 1266 | fax: +31(30) 253 4511
________________________________
From: fieldtrip <fieldtrip-bounces at science.ru.nl> on behalf of Andrew Janke <floss at apjanke.net>
Sent: 29 May 2020 09:30
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Subject: [FieldTrip] MEX compilation failure under R2020a on macOS 10.14

Hi, FieldTrip folks,

I'm running FieldTrip under Matlab R2020a on macOS 10.14.6 with Xcode 11.3.1.

When I try to recompile all the MEX files, I got some warnings and a compilation error.

Any ideas? Maybe this MATRIX_DLL_EXPORT_SYM hack is no longer working under R2020a and recent versions? From src/mxSerialize_cpp.cpp:

// MX_API_VER has unfortunately not changed between R2013b and R2014a,
// so we use the new MATRIX_DLL_EXPORT_SYM as an ugly hack instead
#if defined(__cplusplus) && defined(MATRIX_DLL_EXPORT_SYM)
#define EXTERN_C extern
namespace matrix{ namespace detail{ namespace noninlined{ namespace mx_array_api{
#endif


This is not urgent – I'm not actually using FieldTrip for work; just playing around with it after I saw Carlijn Boomen's compilation problems.

Perhaps this is related to the new C++ and interleaved-complex MEX APIs that Matlab introduced recently?

Details:

>> addpath ~/local/repos/fieldtrip/
>> cd ~/local/repos/fieldtrip/utilities
>> !git log --oneline | head -10
36193a97a updated test scripts, the cfg.sourcemodel should also have a label if it contains a filter. Select only MEG channels for source analysis with pre-computed leadfield.
0e3a52de5 fixed bug in selection of optode channels that was intrpduced with the recent #1377
6325434a6 automatically synchronized identical files to 0fe5399736d832b3206e778603e6427f7bd829fa
0fe539973 fixed multiple regression errors due to PR #1377, mostly related to sloppy data bookkeeping
6dac9ac18 automatically synchronized identical files to b79f65a9e7284c0f244f3c52875ba9f7479932fd
b79f65a9e improve ft_sourceanalysis flexbility to work with pre-computed leadfields (#1377)
b4d569823 Update feature_request.md
49b433569 Update bug_report.md
606c7d67e Update feature_request.md
a48f337db Update bug_report.md
>> ft_compile_mex(true)
Compiling MEX file compat/matlablt2010b/@uint64/abs ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file compat/matlablt2010b/@uint64/min ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file compat/matlablt2010b/@uint64/max ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file compat/matlablt2010b/@uint64/plus ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file compat/matlablt2010b/@uint64/minus ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file compat/matlablt2010b/@uint64/times ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file compat/matlablt2010b/@uint64/rdivide ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file @config/private/deepcopy ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file @config/private/increment ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file @config/private/setzero ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file realtime/online_mri/ft_omri_smooth_volume ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file realtime/src/acquisition/siemens/src/sap2matlab ...
Building with 'Xcode with Clang'.
/Users/janke/local/repos/fieldtrip/realtime/src/acquisition/siemens/src/sap2matlab.c:33:10: warning: enumeration value 'SAP_ARRAY_SIZE' not handled in switch [-Wswitch]
                switch(item->type) {
                       ^
/Users/janke/local/repos/fieldtrip/realtime/src/acquisition/siemens/src/sap2matlab.c:33:10: note: add missing switch cases
                switch(item->type) {
                       ^
1 warning generated.

/Users/janke/local/repos/fieldtrip/realtime/src/acquisition/siemens/src/siemensap.c:323:12: warning: enumeration value 'SAP_ARRAY_SIZE' not handled in switch [-Wswitch]
    switch(typ) {
           ^
/Users/janke/local/repos/fieldtrip/realtime/src/acquisition/siemens/src/siemensap.c:323:12: note: add missing switch cases
    switch(typ) {
           ^
/Users/janke/local/repos/fieldtrip/realtime/src/acquisition/siemens/src/siemensap.c:436:20: warning: enumeration value 'SAP_ARRAY_SIZE' not handled in switch [-Wswitch]
            switch(item->type) {
                   ^
/Users/janke/local/repos/fieldtrip/realtime/src/acquisition/siemens/src/siemensap.c:436:20: note: add missing switch cases
            switch(item->type) {
                   ^
2 warnings generated.

MEX completed successfully.
Compiling MEX file src/ft_getopt ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/read_16bit ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/read_24bit ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/lmoutr ...
Building with 'Xcode with Clang'.
/Users/janke/local/repos/fieldtrip/src/geometry.c:176:15: warning: implicit declaration of function 'mxGetNaN' is invalid in C99 [-Wimplicit-function-declaration]
    proj[0] = mxGetNaN();
              ^
/Users/janke/local/repos/fieldtrip/src/geometry.c:219:11: warning: implicit declaration of function 'mxGetNaN' is invalid in C99 [-Wimplicit-function-declaration]
    *la = mxGetNaN();
          ^
2 warnings generated.

MEX completed successfully.
Compiling MEX file src/ltrisect ...
Building with 'Xcode with Clang'.
/Users/janke/local/repos/fieldtrip/src/geometry.c:176:15: warning: implicit declaration of function 'mxGetNaN' is invalid in C99 [-Wimplicit-function-declaration]
    proj[0] = mxGetNaN();
              ^
/Users/janke/local/repos/fieldtrip/src/geometry.c:219:11: warning: implicit declaration of function 'mxGetNaN' is invalid in C99 [-Wimplicit-function-declaration]
    *la = mxGetNaN();
          ^
2 warnings generated.

MEX completed successfully.
Compiling MEX file src/plinproj ...
Building with 'Xcode with Clang'.
/Users/janke/local/repos/fieldtrip/src/geometry.c:176:15: warning: implicit declaration of function 'mxGetNaN' is invalid in C99 [-Wimplicit-function-declaration]
    proj[0] = mxGetNaN();
              ^
/Users/janke/local/repos/fieldtrip/src/geometry.c:219:11: warning: implicit declaration of function 'mxGetNaN' is invalid in C99 [-Wimplicit-function-declaration]
    *la = mxGetNaN();
          ^
2 warnings generated.

MEX completed successfully.
Compiling MEX file src/ptriproj ...
Building with 'Xcode with Clang'.
/Users/janke/local/repos/fieldtrip/src/geometry.c:176:15: warning: implicit declaration of function 'mxGetNaN' is invalid in C99 [-Wimplicit-function-declaration]
    proj[0] = mxGetNaN();
              ^
/Users/janke/local/repos/fieldtrip/src/geometry.c:219:11: warning: implicit declaration of function 'mxGetNaN' is invalid in C99 [-Wimplicit-function-declaration]
    *la = mxGetNaN();
          ^
2 warnings generated.

MEX completed successfully.
Compiling MEX file src/routlm ...
Building with 'Xcode with Clang'.
/Users/janke/local/repos/fieldtrip/src/geometry.c:176:15: warning: implicit declaration of function 'mxGetNaN' is invalid in C99 [-Wimplicit-function-declaration]
    proj[0] = mxGetNaN();
              ^
/Users/janke/local/repos/fieldtrip/src/geometry.c:219:11: warning: implicit declaration of function 'mxGetNaN' is invalid in C99 [-Wimplicit-function-declaration]
    *la = mxGetNaN();
          ^
2 warnings generated.

MEX completed successfully.
Compiling MEX file src/solid_angle ...
Building with 'Xcode with Clang'.
/Users/janke/local/repos/fieldtrip/src/geometry.c:176:15: warning: implicit declaration of function 'mxGetNaN' is invalid in C99 [-Wimplicit-function-declaration]
    proj[0] = mxGetNaN();
              ^
/Users/janke/local/repos/fieldtrip/src/geometry.c:219:11: warning: implicit declaration of function 'mxGetNaN' is invalid in C99 [-Wimplicit-function-declaration]
    *la = mxGetNaN();
          ^
2 warnings generated.

MEX completed successfully.
Compiling MEX file src/rfbevent ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/meg_leadfield1 ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/splint_gh ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/plgndr ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/ft_spike_sub_crossx ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/rename ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/getpid ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/nanmean ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/nanstd ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/nanvar ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/nansum ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/nanstd ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/det2x2 ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/inv2x2 ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/mtimes2x2 ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/sandwich2x2 ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/combineClusters ...
Building with 'Xcode Clang++'.
MEX completed successfully.
Compiling MEX file external/fileexchange/CalcMD5 ...
Building with 'Xcode with Clang'.
MEX completed successfully.
Compiling MEX file src/mxSerialize_cpp ...
Building with 'Xcode Clang++'.
Error using mex
/Users/janke/local/repos/fieldtrip/src/mxSerialize_cpp.cpp:10:1: error: unknown type name 'EXTERN_C'
EXTERN_C mxArray* mxSerialize(mxArray const *);
^
/Users/janke/local/repos/fieldtrip/src/mxSerialize_cpp.cpp:10:17: error: expected ';' after top level declarator
EXTERN_C mxArray* mxSerialize(mxArray const *);
                ^
                ;
/Users/janke/local/repos/fieldtrip/src/mxSerialize_cpp.cpp:11:1: error: unknown type name 'EXTERN_C'
EXTERN_C mxArray* mxDeserialize(const void *, size_t);
^
/Users/janke/local/repos/fieldtrip/src/mxSerialize_cpp.cpp:11:17: error: expected ';' after top level declarator
EXTERN_C mxArray* mxDeserialize(const void *, size_t);
                ^
                ;
/Users/janke/local/repos/fieldtrip/src/mxSerialize_cpp.cpp:22:31: error: use of undeclared identifier 'mxSerialize'
        plhs[0] = (mxArray *) mxSerialize(prhs[0]);
                              ^
5 errors generated.

Error in ft_compile_mex>compile_mex_list (line 217)
  eval(cmd);
Error in ft_compile_mex (line 114)
  compile_mex_list(L, ftpath, force);
>> ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.8.0.1323502 (R2020a)
MATLAB License Number: 973906
Operating System: Mac OS X  Version: 10.14.6 Build: 18G4032
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB                                                Version 9.8         (R2020a)
Database Toolbox                                      Version 9.2.1       (R2020a)
FieldTrip                                             Version unknown     www.fieldtriptoolbox.org<http://www.fieldtriptoolbox.org>
Financial Toolbox                                     Version 5.15        (R2020a)
Optimization Toolbox                                  Version 8.5         (R2020a)
Statistics and Machine Learning Toolbox               Version 11.7        (R2020a)
>>

Cheers,
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200529/a323ebc4/attachment.htm>


More information about the fieldtrip mailing list