Back to the main page.

Bug 3402 - external/gifti mexfiles presumably not compatible with matlab v2017+

Status CLOSED DUPLICATE
Reported 2018-01-23 20:58:00 +0100
Modified 2019-08-10 12:37:07 +0200
Product: FieldTrip
Component: external
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P5 normal
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on:
Blocks:
See also:

Arjen Stolk - 2018-01-23 20:58:44 +0100

Not entirely sure if this is specific matlab v2017b as I no longer have an older version installed. The issue does reminisce of the issue with SPM8 mex files. PROBLEM: mesh = ft_read_headshape('data/CP16/recon/freesurfer/SUMA/lh.inflated.gii'); Warning: adding /Users/arjsto/Documents/MATLAB/fieldtrip/external/gifti toolbox to your MATLAB path Error using read_gifti_file (line 17) [GIFTI] Loading of XML file data/CP16/recon/freesurfer/SUMA/lh.inflated.gii failed. Error in gifti (line 71) this = read_gifti_file(varargin{1},giftistruct); Error in ft_read_headshape (line 290) g = gifti(filename); Tracing the steps takes us to a deeper issue with the xlm_findstr.mexmaci62 MEX file, called from xmltree.m at line 52: K>> tree.tree = xml_parser(xmlstr); Invalid MEX-file '/Users/arjsto/Documents/MATLAB/fieldtrip/external/gifti/@xmltree/private/xml_findstr.mexmaci64': dlopen(/Users/arjsto/Documents/MATLAB/fieldtrip/external/gifti/@xmltree/private/xml_findstr.mexmaci64, 6): Library not loaded: @loader_path/libmex.dylib Referenced from: /Users/arjsto/Documents/MATLAB/fieldtrip/external/gifti/@xmltree/private/xml_findstr.mexmaci64 Reason: image not found. Error in xml_parser>prolog (line 359) start = xml_findstr(str,'<',1,1); Error in xml_parser (line 125) xmlstring = normalize(prolog(xmlstr)); POSSIBLE SOLUTION: Downloading gifti 1.6 from https://www.artefact.tk/software/matlab/gifti/ solved the issue here. Yet, I cannot easily figure out why this solves this issue, i.e. whether it uses newer mex-files, or maybe none at all. Maybe Guillaume, creator of gifti.m, can chime in.


Guillaume - 2018-01-24 12:18:43 +0100

I thought this had already been discussed here (maybe in relation to another SPM MEX file): the MEX files have to be recompiled in order to run on Mac with recent MATLAB versions. You can find a more recent xlm_findstr.mexmaci62 here: https://github.com/spm/spm12/blob/master/%40xmltree/private/xml_findstr.mexmaci64 Using the standalone gifti library works because it doesn't use the MEX file in order to make distribution easier - it will be slower though.


Robert Oostenveld - 2018-01-24 12:51:02 +0100

this is indeed a duplicate of 3365. However, a solution has not been found yet. Let's keep the discussion there. *** This bug has been marked as a duplicate of bug 3365 ***


Arjen Stolk - 2018-01-24 17:44:51 +0100

(In reply to Guillaume from comment #1) Thanks for confirming and the recompiled mexfile, Guillaume.


Arjen Stolk - 2018-01-24 18:04:43 +0100

the respective PR: https://github.com/fieldtrip/fieldtrip/pull/642


Arjen Stolk - 2018-01-25 04:13:01 +0100

The mex file works well in matlab 2017b, Guillaume. Did you by any chance test whether it's also compatible with older version of matlab? If so, I can replace the current version of the mex file by it. We try to be backward-compatible up to 2012.


Guillaume - 2018-01-29 14:23:30 +0100

(In reply to Arjen Stolk from comment #5) With SPM, we aim SPM12 to be compatible with all MATLAB versions starting at R2007a: https://en.wikibooks.org/wiki/SPM/MATLAB I could run the new compiled MEX file with R2010a without problem so this should solve the issue for you.


Arjen Stolk - 2018-01-29 17:56:05 +0100

This table is great. I was going to ask whether it also applies to the gifti suite, until I found out it's already embedded in SPM12 (there is a separate gifti folder in fieldtrip/external).


Robert Oostenveld - 2019-08-10 12:37:07 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on https://github.com/fieldtrip/fieldtrip/issues.