Menu

invalid MEX file with Matlab R2017b

Help
2017-11-07
2018-01-04
  • Michał Szczepanik

    Hello

    I am trying to run PSPM for SCR analysis using latest Matlab release (R2017b) on MacOS Sierra 10.12.6. During EDF data import I encountered the following error:

    Running 'Import'
    Importing /Volumes/My Book Pro/EmoCon/dane_edf/1pok_exp/LOMMOP.edf ...Failed  'Import'
    Invalid MEX-file '/Users/michal/toolboxes/pspm/Import/fieldtrip/read_16bit.mexmaci64': dlopen(/Users/michal/toolboxes/pspm/Import/fieldtrip/read_16bit.mexmaci64, 6): Library not loaded: @loader_path/libmex.dylib
      Referenced from: /Users/michal/toolboxes/pspm/Import/fieldtrip/read_16bit.mexmaci64
      Reason: image not found.
    In file "/Users/michal/toolboxes/pspm/Import/fieldtrip/read_edf.m" (v27), function "readLowLevel" at line 376.
    In file "/Users/michal/toolboxes/pspm/Import/fieldtrip/read_edf.m" (v27), function "read_edf" at line 344.
    In file "/Users/michal/toolboxes/pspm/Import/fieldtrip/ft_read_data.m" (v701), function "ft_read_data" at line 463.
    In file "/Users/michal/toolboxes/pspm/scr_get_edf.m" (v63), function "scr_get_edf" at line 25.
    In file "/Users/michal/toolboxes/pspm/scr_import.m" (v701), function "scr_import" at line 181.
    In file "/Users/michal/toolboxes/pspm/scr_cfg/scr_cfg_run_import.m" (v357), function "scr_cfg_run_import" at line 68.
    
    The following modules did not run:
    Failed: Import
    

    I also use SPM and after moving to Matlab R2017b I had to recompile SPM's mex files, following the instructions in SPM wikibook. I suppose it is a similar case here, with PSPM, but I don't know how to handle it.

    Do you have any recommendations on how to proceed?

    Best regards
    Michał Szczepanik

     
  • tobias moser

    tobias moser - 2017-11-09

    Hi Michał

    libmex.dylib does not seem to be found, which is a bit odd because it should be present, as it is part of Matlab itself. Also referring to fieldtrip, it should be compatible with MacOS without recompiling it. Maybe you could solve the problem by changing the search path for dylib. Unfortunately I'm not very familiar with MacOS but a bit of googling led me to http://www.manpagez.com/man/1/dyld/ . So maybe you could try to modify your environment using setenv() / getenv() to correct the search path. The variable DYLD_LIBRARY_PATH might be interesting. The libmex.dylib should be in <MATLAB-PATH>/bin/maci64/ (might not be exactly maci64 but).

    If you want to recompile the fieldtrip functions I would download fieldtrip from the website and follow this document: http://www.fieldtriptoolbox.org/faq/compile#general_compilation_of_most_mex_files . After recompiling you can replace the folder /Import/fieldtrip/fileio with fileio from the fieldtrip root.

    I hope this helps.

    Best regards
    Tobias

     
  • Michał Szczepanik

    As the new year dawned, I realised that I have left this issue without any response. So, for the record: in PSPM 3.1, recompiling the read_16bit mex files (from fieldtrip) made the mex-related error go away, although import subsequently failed for another reason anyway.

    However, in PSPM 4.0, import works like a charm, without me having to change anything. So I think whatever caused these problems has been fully resolved. Thank you for your assistance and for the new release.

    Best regards
    Michał

     

    Last edit: Michał Szczepanik 2018-01-04
  • Dominik Bach

    Dominik Bach - 2018-01-04

    Thnaks for letting us know - this is excellent news! Dominik

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.