Error message working with DUNEuro,

Following in detail the DUNEuro tutorial a receive this error message:

FEM> 1. brain: sepi01/tess_innerskull_bem_2432V.mat
FEM> 2. skull: sepi01/tess_outerskull_bem_2432V.mat
FEM> 3. scalp: sepi01/tess_head_bem_2432V.mat
 
generating tetrahedral mesh from closed surfaces ...
creating volumetric mesh from a surface mesh ...
volume mesh generation is complete
BST> Saving protocol "TutorialEpilepsy"...
BST> Checking latest online version for duneuro...
BST> Adding plugin duneuro to path: /Users/Palacciv/.brainstorm/plugins/duneuro/bst_duneuro
BST> Adding plugin duneuro to path: /Users/Palacciv/.brainstorm/plugins/duneuro/bst_duneuro/bin
BST> Emptying temporary directory...
DUNEURO> Writing temporary files to: /Users/Palacciv/.brainstorm/tmp
DUNEURO> System call: "/Users/Palacciv/.brainstorm/plugins/duneuro/bst_duneuro/bin/bst_duneuro_meeg_mac64.app" "/Users/Palacciv/.brainstorm/tmp/duneuro_minifile.mini"
dyld: Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib
  Referenced from: /Users/Palacciv/.brainstorm/plugins/duneuro/bst_duneuro/bin/bst_duneuro_meeg_mac64.app
  Reason: image not found
"/Users/Palacciv/.brainstorm/plugins/duneuro/bst_duneuro/bin/bst_duneuro_meeg_mac64.app" "/Users/Palacciv/.brainstorm/tmp/duneuro_minifile.mini": Aborted

status =

   134


***************************************************************************
** Error: Error during the DUNEuro computation, see logs in the command window.
***************************************************************************

The revious processes run perfectly,

Does anybody knows if it could be related to MATLAB installation or to DUNEuro?

Thanks in advance,

This looks like the same problem that you reported with the MEX files of the MEM toolbox:

The problem is most likely not DUNEuro or MEM but your operating system. You operating system can't execute some of the compile code, maybe because of rights limitations. Examples of problems: the OS doesn't want to execute the binaries for safety reasons, you have another program blocking them, you are not an admin, you don't have execution rights on these files...)

You reported that things worked before. If you have updated your version of MacOS recently, the problem could be the additional restrictions Apple impose on the execution of programs that were not approved explicitly by Apple.
You might find your solution in the following post:

Since you were recently asking about software recommendations:
MacOS might not be the most recommended operating system for research. Research software is often more complicated to run on MacOS. Consider using Windows 10 or Ubuntu instead.

1 Like

Thank you very much.
Yes, you're right, it looks like the same problem. I thought so, the moment I looked at it, but I want to hear a different opinion. Since the beginning my confussion was regarding my MATLAB installation and of course, Apple and MacOS.
I reported things worked pretty well but it was, working with the brainstorm compiled version that works pretty well under MacOS. The first problem was with MEM. Then I learned that it runs only with the brainstorm MATLAB version so I worked under it and found this errors.
I have all the previleges in my system. I'm the admin, but don't know about the execution rights. Supposelly there is nothing blocking the binaries I'll look at it again. I have not updated the version of MacOS since the release of the macOS Big Sur 11.2.3, that is the most reacent one.
I'm going to read the post you recomend me and try all in one of my Windows machines, see how it works.
I let the forum know about my tests since it could be usefull for all,

Hello everyone, I know this is an old post but I ran into a similar error using an Apple M1 Mac, in which Duneuro couldn't find the gmp libraries.

I was able to proceed after dowloading gmp with the -x86_64 version of brew (using the native Silicon version of brew did not work due to a different folder structure).

However, a different error ensued:

BST> Plugin duneuro already loaded: /Users/francesco/.brainstorm/plugins/duneuro
DUNEURO> Writing temporary files to: /Users/francesco/.brainstorm/tmp/duneuro_230404_212147
DUNEURO> System call: "/Users/francesco/.brainstorm/plugins/duneuro/bst_duneuro/bin/bst_duneuro_meeg_mac64.app" "/Users/francesco/.brainstorm/tmp/duneuro_230404_212147/duneuro_minifile.mini"
"/Users/francesco/.brainstorm/plugins/duneuro/bst_duneuro/bin/bst_duneuro_meeg_mac64.app" "/Users/francesco/.brainstorm/tmp/duneuro_230404_212147/duneuro_minifile.mini": Illegal instruction

status =

   132

***************************************************************************
** Error: Error during the DUNEuro computation, see logs in the command window.
***************************************************************************

Any idea about what could be the cause?

@tmedani @juangpc ?

Hi @DocFF,

Are you using the compiled version of Brainstorm?

It seems to be a MAC-related issue again.
@Palaccivatbfc were you able to run it?

@juangpc any idea?

Hi @tmedani,

I am using the source version of Brainstorm with the latest Matlab stable release, so everything is running with Rosetta.

Could the error be related to this (similar problem, different software)?

https://github.com/sorbet/sorbet/issues/3852

Unfortunately, I'm currently using Windows and Linux, not Mac, so I can't replicate and test this issue. But from the link you shared, it seems to be a similar issue. Let's see what @juangpc thinks.

For research dev purposes, we do not recommend using Mac; we end up with more issues to solve than the initial main purpose.

Hi all,
I'd like to share some thoughts on this issue, and the project in general, going forward.

Deploying software for multiple OS, across time, is hard. So I find these words to be particularly insightful:

Since you were recently asking about software recommendations:
MacOS might not be the most recommended operating system for research. Research software is often more complicated to run on MacOS. Consider using Windows 10 or Ubuntu instead.

At least partially, the error is related to the operating system not being able to find "gmp" dynamic library. To solve this issue, I would try: brew install gmp. I am not sure if that will solve all the problems or just that one particular. Gmp is a well-known computational library so it does make sense to need it installed.

In case the issues are more related to intel/arm architectures. Current available version of Brainstorm-DUNEuro integration for mac was compiled with an intel-mac, not with an arm-mac. Although Apple provides tools such as rosetta these are fairly complicated free-open-source applications, and many things can go wrong.

  • When we did all this work, we added the architecture flag "-march=native" for the compiler. I am not completely sure why we did that. It can make the app go faster, but I would't do it today. It might be making things more difficult for rosetta.

For the brainstorm team:

  • We can rebuild the binaries with a newer operating system. I am currently using MacOS Monterrey 12.4. There is an update on MacOS, Ventura. If we rebuild the binaries with a newer version of MacOS, gcc, toolchains, standard libraries, etc... it is likely that tools like rosetta will work better. Building without architecture=native will probably help too. But there is a problem, if we build with a newer version of the MacOS, it might happen, that users with older MacOS then have to partially update their OS. If you decide so, I am happy to help (i have an intel mac). @Francois @tmedani I go through your comments, it is a pleasure to see how you take good care of the community.

  • We can find some arm Mac (or use a vps service) and build the binaries in that architecture. Add an additional supported architecture to the project. I am not familiar with the details of Matlab in general and more specifically mex Matlab api for intel and rosetta architectures. It might be easy or it might be hard to have all the integration working for that architecture. Because this is the architecture for Apple, going forward, there is no point in not having a compatible version for apple silicon.

Just checked and it seems like github will provide this functionality later this year (apple silicon github ci). When that happens, I can create a workflow for github ci to build recurrently brainstorm-duneuro binaries. Amazon, other companies offer mac os servers.

For the adventurous souls:

Nothing is faster and more stable that software compiled with your own machine, running in your own machine. Wether you have an intel mac or an arm mac, probably some of your issues will get resolved if you build your own binaries, at the expense of some time. You can follow the instructions to build your own version of the brainstorm-duneuro application here. If you get stuck, I'm happy to help.

Best regards,

1 Like

Hi @juangpc, thank you for your reply.

I have tried building duneuro following the link you posted, however I got stuck. Please see the attached log. I would be thankful if you could take a look.

build_release_linux_log.txt (11.1 KB)

Best regards,

@DocFF, which OS are you using and which version?

MacOS 13.3.1 with an Apple M1 Pro chip

@juangpc ?

I ran into the same issue as Error message working with DUNEuro, - #4 by DocFF on Ubuntu 20.04 before and after a recent system update. More specifically, I'm receiving an illegal instruction error:

"/home/bic/vikramn/.brainstorm/plugins/duneuro/bst_duneuro/bin/bst_duneuro_meeg_linux64.app" "/export02/data/vikramn/brainstorm_tmp/duneuro_230929_150820/duneuro_minifile.mini": Illegal instruction

status =

132


** Error: Error during the DUNEuro computation, see logs in the command window.


Not sure if this has to do with the OS I'm using or if this is fixable. I also have duneuro downloaded from GitHub as a separate package on my workstation, so maybe I could coax the SimNIBS FEM model data + the empirical recordings into the command line interface to compute the forward model... however, I think it would be easier to get everything working within Brainstorm, if possible.

I also tried recompiling the binaries for the "bst-duneuro" package within my Brainstorm folder ( GitHub - brainstorm-tools/bst-duneuro: Brainstorm-Duneuro integration), and then ran the same analysis (forward model computation based on vertices on the cortical surface using the SIMNIBS FEM model) on a different dataset, but consistently ran into the same error as above.

Let me know if there's any way to fix this.

More info on the error:

BST> Plugin duneuro already loaded: /home/bic/vikramn/.brainstorm/plugins/duneuro
DUNEURO> Writing temporary files to: /export02/data/vikramn/brainstorm_tmp/duneuro_231018_113820
DUNEURO> System call: "/home/bic/vikramn/.brainstorm/plugins/duneuro/bst_duneuro/bin/bst_duneuro_meeg_linux64.app" "/export02/data/vikramn/brainstorm_tmp/duneuro_231018_113820/duneuro_minifile.mini"
"/home/bic/vikramn/.brainstorm/plugins/duneuro/bst_duneuro/bin/bst_duneuro_meeg_linux64.app" "/export02/data/vikramn/brainstorm_tmp/duneuro_231018_113820/duneuro_minifile.mini": Illegal instruction

status =

   132


***************************************************************************
** Error: Error during the DUNEuro computation, see logs in the command window.
***************************************************************************

Hi,
I cannot replicate this error.
It is probably due to some incompatibility between the binaries and the standard libraries installed on your system.
It can probably be solved by compiling the application from source, in your system. That way you will ensure compatibility and perhaps it will even run faster and more stable.
If one is familiar with C++ projects, to compile from source should be easy enough. If not, I think it is a fair exercise to learn about computers. If you have any doubts you can ask.

In order to to compile from source, you need to follow the instructions we (@tmedani and me) wrote a while back, here: https://github.com/brainstorm-tools/bst-duneuro#development. It is a script which should do most of the work semi-automatically. The end result is a binary application called bst_duneuro_meeg_linux64.app which is what used to be copied into the plugin folder for duneuro (/somewhere.in.your.system/.brainstorm/plugins/duneuro/bst_duneuro/bin) inside Brainstorm.

Hope this helps.