[FieldTrip] Mex file issue

Schoffelen, J.M. (Jan Mathijs) janmathijs.schoffelen at donders.ru.nl
Wed Oct 19 09:51:09 CEST 2022


Hi Samuel

I hardly ever use FieldTrip on a windows machine, and more in general, handling/maintaining one-shoe-fits-all mex-files on windows platforms is quite challenging. And compilation of mex files an windows platforms can be challenging as well. So I hope that windows users can chime in a bit here.

If you don’t manage to compile the code on your platform, and given that your original problem was with the mex file combineCllusters.mexw64, you could try to delete given mex-file altogether, and fall back to the (slower) m-file.

Best wishes and good luck,
Jan-Mathijs


On 5 Oct 2022, at 10:30, Samuel Harris Cosper via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Dear all,

I am having an issue, as seems to be a common occurrence, with mex files and fieldtrip. I have double checked that “mex -setup” is working correctly and have also installed the MATLAB Support for MinGW-w64 C/C++ Compiler (version 22.1.0) already (in Matlab 2022a). I have also installed the most recent version of Fieldtrip on the Website/github.  Another important factor: I have ran this exact script before on many computers with no issue. Only on my new laptop (windows 10) am I running into this issue. I have made sure that all updates are installed.

Now to my issue. When running ft_timelockstatistics with all of the proper cfg configurations, I receive an error message “Invalid MEX-file 'C:\Program Files\MATLAB\fieldtrip-20220104\private\combineClusters.mexw64': The specified module could not be found.”

I then ran “ft_compile_mex(true)”. Everything seemed to be working until “Compiling MEX file src/mxSerialize_cpp ... Building with 'MinGW64 Compiler (C++)'.” And I received the following error:

Error using ft_compile_mex>compile_mex_list
Error using mex
C:\Program Files\MATLAB\fieldtrip-20220104\src\mxSerialize_cpp.cpp:10:1: error: 'EXTERN_C' does not name a type
EXTERN_C mxArray* mxSerialize(mxArray const *);
^~~~~~~~
C:\Program Files\MATLAB\fieldtrip-20220104\src\mxSerialize_cpp.cpp:11:1: error: 'EXTERN_C' does not name a type
EXTERN_C mxArray* mxDeserialize(const void *, size_t);
^~~~~~~~
C:\Program Files\MATLAB\fieldtrip-20220104\src\mxSerialize_cpp.cpp: In function 'void mexFunction(int, mxArray**, int, const mxArray**)':
C:\Program Files\MATLAB\fieldtrip-20220104\src\mxSerialize_cpp.cpp:22:50: error: 'mxSerialize' was not declared in this scope
         plhs[0] = (mxArray *) mxSerialize(prhs[0]);
                                                  ^


Error in ft_compile_mex (line 114)
  compile_mex_list(L, ftpath, force);

Is there a solution to this issue? I have looked online, but was unsuccessful, particularly for Matlab 2022a and with the newest version of Fieldtrip.

Thanks in advance!

Best wishes,
Sam

---
Dr.rer.nat. Samuel H. Cosper
Postdoc
Entwicklingspsychologie und Neurowissenschaft der Lebensspanne
(Lifespan Developmental Neuroscience)
Fakultät Psychologie (Faculty of Psychology)
Zellescher Weg 17, Raum A229
01062 Dresden

Email: samuel.cosper at tu-dresden.de<mailto:samuel.cosper at tu-dresden.de>

Technische Universität Dresden

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!6fFkX_c6xBjzVG_eLPIZL71U6GTCJldsWGNF1w3wnvpUnAXPZRhCB81IctVkI0s6HUbjRuBJhwEL845Dz6L8zWdECcTWVDMK7cLSqg$

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20221019/fda0c559/attachment.htm>


More information about the fieldtrip mailing list