[Simnibs-discuss] Issues with making Brainstorm compatible with SimNIBS 4.0

Gülce Lale G.Lale at campus.lmu.de
Thu Mar 23 14:35:49 CET 2023


Hi Jesper,

Thank you very much, this solution worked!  I had to write this:  setenv(‘LD_LIBRARY_PATH’, sprintf(‘/path/to/simnibs/external/lib/linux:%s’, getenv(‘LD_LIBRARY_PATH’))) on the MATLAB command window. However, writing it down in a .m script and running it at the beginning before using Brainstorm also worked.

Best wishes,
Gülce

> On 16 Mar 2023, at 18:36, Jesper Duemose Nielsen <jesperdn at drcmr.dk> wrote:
> 
> Hi Gulce
> 
> Allow me to weigh in. Someone from our department had the same issue you describe today; getting a linking error when calling charm from within MATLAB. It turns out that MATLAB includes some libraries itself (among these are gmp, tbb etc.) and when you execute programs from within MATLAB, these are prepended (or rather their paths) to LD_LIBRARY_PATH and hence are used by the program. You can verify if this is the case by comparing the output of running ldd on the .so file in the terminal (what I believe you showed in your previous email) and running ldd on the .so *from within MATLAB*, e.g., using `system` or `unix`.
> 
> One solution is to *prepend* the path to the libraries included in SimNIBS to LD_LIBRARY_PATH like so
> 
>     setenv(‘LD_LIBRARY_PATH’, sprintf(‘/path/to/simnibs/external/lib/linux:%s’, getenv(‘LD_LIBRARY_PATH’)))
> 
> Put this in your .m file before you call charm from MATLAB.
> 
> Best,
> 
> Jesper
> 
> On 3/15/23 17:10, Oula Puonti wrote:
>> Hi Gülce,
>> 
>> Can you send the details of the linux setup you're running?
>> 
>> One option would be to build simnibs for source, which would hopefully
>> then work on your computer as it would be build specifically for that
>> setup. It's not that difficult but you need to have gcc8 devtools
>> available, see here for some instructions:
>> 
>> https://stackoverflow.com/questions/53310625/how-to-install-gcc8-using-devtoolset-8-gcc <https://stackoverflow.com/questions/53310625/how-to-install-gcc8-using-devtoolset-8-gcc>
>> 
>> Other than that you would need to have anaconda or miniconda available
>> for creating the virtual python environment.
>> 
>> If the linux you're running is not a very exotic one, I can also try to
>> build an installer for it andd send it to you. We can try if that works
>> first before you trying to build simnibs from source.
>> 
>> Best,
>> Oula
>> 
>> 
>> 
>> On Tue, 2023-03-14 at 14:27 +0100, Gülce Lale wrote:
>>> Hi Oula,
>>> 
>>> Thank you for your reply.
>>> 
>>> I repeated the steps below. This was my outcome:
>>> 
>>> ldd create_mesh_surf.cpython-39-x86_64-linux-gnu.so
>>>     linux-vdso.so.1 (0x00007ffe67fb8000)
>>>     libmpfr.so.1 => /sw/SimNIBS/4.0.0/simnibs_env/lib/python3.9/site-
>>> packages/simnibs/mesh_tools/cgal/./../../external/lib/linux/libmpfr.s
>>> o.1 (0x00007f8ece819000)
>>>     libgmp.so.3 => /sw/SimNIBS/4.0.0/simnibs_env/lib/python3.9/site-
>>> packages/simnibs/mesh_tools/cgal/./../../external/lib/linux/libgmp.so
>>> .3 (0x00007f8ece5be000)
>>>     libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f8ece586000)
>>>     libtbb.so.2 => /sw/SimNIBS/4.0.0/simnibs_env/lib/python3.9/site-
>>> packages/simnibs/mesh_tools/cgal/./../../external/lib/linux/libtbb.so
>>> .2 (0x00007f8ece31f000)
>>>     libtbbmalloc.so.2 =>
>>> /sw/SimNIBS/4.0.0/simnibs_env/lib/python3.9/site-
>>> packages/simnibs/mesh_tools/cgal/./../../external/lib/linux/libtbbmal
>>> loc.so.2 (0x00007f8ece0c4000)
>>>     libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
>>> (0x00007f8ece0a0000)
>>>     libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6
>>> (0x00007f8ecded3000)
>>>     libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8ecdd8f000)
>>>     libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1
>>> (0x00007f8ecdd75000)
>>>     libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8ecdba0000)
>>>     /lib64/ld-linux-x86-64.so.2 (0x00007f8eceb7b000)
>>>     libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2
>>> (0x00007f8ecdb9a000)
>>>     librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1
>>> (0x00007f8ecdb8e000)
>>> 
>>> From what I can tell it is linking to the correct gmp library. I am
>>> very confused.
>>> 
>>> Then, I created another version of the 4.0.0 where I installed a gmp
>>> package, which had not been present originally. (I am unsure whether
>>> this made a difference.) 
>>> 
>>> I ran the same command in the other folder named
>>> /sw/SImNIBS/4.0.0_daniela/ and got this:
>>> 
>>> /sw/SimNIBS/4.0.0_daniela/simnibs_env/lib/python3.9/site-
>>> packages/simnibs/mesh_tools/cgal$ ldd create_mesh_surf.cpython-39-
>>> x86_64-linux-gnu.so
>>>     linux-vdso.so.1 (0x00007ffc4e505000)
>>>     libmpfr.so.1 =>
>>> /sw/SimNIBS/4.0.0_daniela/simnibs_env/lib/python3.9/site-
>>> packages/simnibs/mesh_tools/cgal/./../../external/lib/linux/libmpfr.s
>>> o.1 (0x00007f92b088b000)
>>>     libgmp.so.3 =>
>>> /sw/SimNIBS/4.0.0_daniela/simnibs_env/lib/python3.9/site-
>>> packages/simnibs/mesh_tools/cgal/./../../external/lib/linux/libgmp.so
>>> .3 (0x00007f92b0630000)
>>>     libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f92b05f8000)
>>>     libtbb.so.2 =>
>>> /sw/SimNIBS/4.0.0_daniela/simnibs_env/lib/python3.9/site-
>>> packages/simnibs/mesh_tools/cgal/./../../external/lib/linux/libtbb.so
>>> .2 (0x00007f92b0391000)
>>>     libtbbmalloc.so.2 =>
>>> /sw/SimNIBS/4.0.0_daniela/simnibs_env/lib/python3.9/site-
>>> packages/simnibs/mesh_tools/cgal/./../../external/lib/linux/libtbbmal
>>> loc.so.2 (0x00007f92b0136000)
>>>     libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
>>> (0x00007f92b0112000)
>>>     libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6
>>> (0x00007f92aff45000)
>>>     libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f92afe01000)
>>>     libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1
>>> (0x00007f92afde7000)
>>>     libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f92afc12000)
>>>     /lib64/ld-linux-x86-64.so.2 (0x00007f92b0bed000)
>>>     libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2
>>> (0x00007f92afc0c000)
>>>     librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1
>>> (0x00007f92afc00000)
>>> 
>>> From what I gather the new 4.0.0_daniela option made no difference.
>>> (I may be wrong).
>>> 
>>> Looking forward to your response.
>>> Thank you for your time and answers in advance.
>>> Best wishes,
>>> Gülce
>>> 
>>>> On 10 Mar 2023, at 17:17, Oula Puonti <oulap at drcmr.dk> <mailto:oulap at drcmr.dk> wrote:
>>>> 
>>>> Hi Gülce,
>>>> 
>>>> I'm guessing that the brainstorm issue is related to the linking
>>>> issue
>>>> with charm, i.e., that brainstorm complains because the charm
>>>> command
>>>> throws an error.
>>>> 
>>>> Can you run a linker on the .so library that is giving problems?
>>>> You
>>>> can do:
>>>> 
>>>> cd /sw/SimNIBS/4.0.0/simnibs_env/lib/python3.9/site-
>>>> packages/simnibs/mesh_tools/cgal/
>>>> 
>>>> and then call:
>>>> 
>>>> ldd create_mesh_surf.cpython-39-x86_64-linux-gnu.so
>>>> 
>>>> For my simnibs installation the output looks like this:
>>>> 
>>>> 	linux-vdso.so.1 (0x00007ffedc7dc000)
>>>> 	libmpfr.so.1 => /home/oulap/SimNIBS-
>>>> 4.0/simnibs_env/lib/python3.9/site-
>>>> packages/simnibs/mesh_tools/cgal/./../../external/lib/linux/libmpfr
>>>> .so.
>>>> 1 (0x00007f4939e00000)
>>>> 	libgmp.so.3 => /home/oulap/SimNIBS-
>>>> 4.0/simnibs_env/lib/python3.9/site-
>>>> packages/simnibs/mesh_tools/cgal/./../../external/lib/linux/libgmp.
>>>> so.3
>>>> (0x00007f4939a00000)
>>>> 	libz.so.1 => /usr/lib/libz.so.1 (0x00007f493a1d9000)
>>>> 	libtbb.so.2 => /home/oulap/SimNIBS-
>>>> 4.0/simnibs_env/lib/python3.9/site-
>>>> packages/simnibs/mesh_tools/cgal/./../../external/lib/linux/libtbb.
>>>> so.2
>>>> (0x00007f4939600000)
>>>> 	libtbbmalloc.so.2 => /home/oulap/SimNIBS-
>>>> 4.0/simnibs_env/lib/python3.9/site-
>>>> packages/simnibs/mesh_tools/cgal/./../../external/lib/linux/libtbbm
>>>> allo
>>>> c.so.2 (0x00007f4939200000)
>>>> 	libpthread.so.0 => /usr/lib/libpthread.so.0
>>>> (0x00007f493a1d2000)
>>>> 	libstdc++.so.6 => /usr/lib/libstdc++.so.6
>>>> (0x00007f4938fc8000)
>>>> 	libm.so.6 => /usr/lib/libm.so.6 (0x00007f493a0ea000)
>>>> 	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1
>>>> (0x00007f493a0ca000)
>>>> 	libc.so.6 => /usr/lib/libc.so.6 (0x00007f4938de1000)
>>>> 	/usr/lib64/ld-linux-x86-64.so.2 (0x00007f493a336000)
>>>> 	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f493a0c5000)
>>>> 	librt.so.1 => /usr/lib/librt.so.1 (0x00007f493a0be000)
>>>> 
>>>> I'm interested to see if your version links to the correct gmp
>>>> library.
>>>> 
>>>> Thanks,
>>>> Oula
>>>> 
>>>> 
>>>> 
>>>> On Wed, 2023-03-08 at 13:39 +0100, Gülce Lale wrote:
>>>>> Dear SimNIBS Team,
>>>>> I have downloaded the newest brainstorm version from March 1st
>>>>> (source + binary) and would like to create a FEM Mesh with
>>>>> SimNIBS
>>>>> 4.0. However, I receive the following error message: "SimNIBS 4.x
>>>>> is
>>>>> not installed or not added to the system path: the command
>>>>> "charm"
>>>>> could not be found.".
>>>>> Yet SimNIBS is correctly installed on linux and has been added to
>>>>> the
>>>>> system variables in the .bashrc file. Additionally, when I check
>>>>> system('charm') on the matlab command window it finds the correct
>>>>> charm.py file and when I type getenv('PATH') I get the correct
>>>>> system
>>>>> variables which include the path to SimNIBS 4.0.0..
>>>>> I also get this error when I try to run “system('charm --
>>>>> version’)” :
>>>>> ImportError: /sw/SimNIBS/4.0.0/simnibs_env/lib/python3.9/site-
>>>>> packages/simnibs/mesh_tools/cgal/create_mesh_surf.cpython-39-
>>>>> x86_64-
>>>>> linux-gnu.so: undefined symbol: __gmpq_ad
>>>>> I already asked this to the Brainstorm team, and they told me
>>>>> that
>>>>> the Brainstorm should be working fine, but the problem might be
>>>>> with
>>>>> SimNIBS and its installation. I am also able to start and use
>>>>> SimNIBS
>>>>> regularly from the terminal and continue to be able to run charm
>>>>> for
>>>>> all my subjects.
>>>>> Therefore, I wanted to ask you why this problem could emerge?
>>>>> Thank you in advance for your time.
>>>>> Best,
>>>>> Gülce
>>>>> 
>>>>> 
>>>>> _______________________________________________
>>>>> Simnibs-discuss mailing list
>>>>> Simnibs-discuss at drcmr.dk <mailto:Simnibs-discuss at drcmr.dk>
>>>>> https://mailman.drcmr.dk/mailman/listinfo/simnibs-discuss <https://mailman.drcmr.dk/mailman/listinfo/simnibs-discuss>
>> _______________________________________________
>> Simnibs-discuss mailing list
>> Simnibs-discuss at drcmr.dk <mailto:Simnibs-discuss at drcmr.dk>
>> https://mailman.drcmr.dk/mailman/listinfo/simnibs-discuss <https://mailman.drcmr.dk/mailman/listinfo/simnibs-discuss>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.drcmr.dk/pipermail/simnibs-discuss/attachments/20230323/f012d120/attachment.html>


More information about the Simnibs-discuss mailing list