Compiling script fails with newer NEURON versions due to $N

Post Reply
MBeining

Compiling script fails with newer NEURON versions due to $N

Post by MBeining »

Hi there,
I am the dev of T2N, the Matlab-NEURON interface, where I also implemented auto compiling of the mod files.
For this I used this script which is modification of the original mknrndll.sh and which allows to hand over the NEURON path from Matlab via the console:

Code: Select all

if test -f $1/bin/cygpath ; then
  N="`$1/bin/cygpath -u $1`"
  PATH=$N/bin
else
  N=$1
  if test -d $N/mingw ; then
    PATH=$N/mingw/bin:$PATH
  fi
  if test -d $N/bin64 ; then
    PATH=$N/bin64:$PATH
  else
    PATH=$N/bin:$PATH
  fi
fi
export PATH
export N
NEURONHOME=$N
export NEURONHOME

rm -f nrnmech.dll
sh $N/lib/mknrndl2.sh

echo ""
if [ -f nrnmech.dll ] ; then
echo "nrnmech.dll was built successfully."
else
echo "There was an error in the process of creating nrnmech.dll"
fi
In versions up to NEURON 7.4 this worked, however with the newer versions like NEURON 7.6.7 this actually fails. Parts of it I can fix, e.g. that the bin folder is now in mingw/usr/bin, however my current problem is with "$N" which is used in the subsequently called NEURON scripts "mknrndl2.sh" and "mknrndll.mak":


If I provide $N as I always did with "/c/nrn" I first get an error
sh: /c/nrn/lib/mknrndl2.sh: No such file or directory
which I can easily fix by changing the call to sh in my script such that is calls it with "sh c:/nrn/lib/mkrnrndl2.sh". However, even with this fix I get errors in the subsequent NEURON scripts:
make: /c/nrn/lib/mknrndll.mak: No such file or directory
make: *** No rule to make target '/c/nrn/lib/mknrndll.mak'. Stop.

If I provide $N as "C:/nrn" I get the error
x86_64-w64-mingw32-gcc -DDLL_EXPORT -DPIC -Ic:/nrn/src/scopmath -Ic:/nrn/src/nrnoc -Ic:/nrn/src/oc -c mod_func.c
make: x86_64-w64-mingw32-gcc: Command not found
make: *** [c:/nrn/lib/mknrndll.mak:67: mod_func.o] Error 127

Of course I can copy and modifiy NEURON's "mknrndl2.sh", too, to fix the issues happening in there, too, but I am trying to avoid this for obvious reasons (e.g. having to check for any modifications you did in these files in each new NEURON version).
As NEURON's mknrndll scripts in version 7.6.7 seem to work when using them as intended via NEURONs mknrndll on Windows (otherwise there would already be complaints I guess) there should be some way for making it work without having to change more than "mknrndll.sh", so I hope you can help me with the solution.

Thank you very much.
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: Compiling script fails with newer NEURON versions due to $N

Post by hines »

Please try providing N as /cygdrive/c/nrn
The problem with c:/nrn is that the ':' in a pathlist is a separator.
The problem with /c/nrn is that msys2 apparently no longer supports that style.
MBeining

Re: Compiling script fails with newer NEURON versions due to $N

Post by MBeining »

Thanks for that hint!

After also adding a check to add the correct mingw path (in this case $N/mingw/mingw64/bin) it worked!
Mohamed_Hisham
Posts: 16
Joined: Thu Oct 08, 2015 2:56 pm
Location: Wright State University

Re: Compiling script fails with newer NEURON versions due to $N

Post by Mohamed_Hisham »

Hello, I was looking a similar case to my problem, and this is the closest one.

recently, when trying to compile mod files on windows 10, first the GUI does not show up properly ( the browsing window), but after maximizing it to the window so that it can be seen, and browsing to the directory where the mod files are in. I get the following message on the cmd window.

Code: Select all

c:\nrn/mingw/usr/bin/sh c:\nrn/lib/mknrndll.sh /cygdrive/c\nrn
c:\nrn/lib/mknrndll.sh: line 42:   373 Segmentation fault      (core dumped) sh $N/lib/mknrndl2.sh "--OUTPUTDIR=$OUTPUTDIR"
and this file is left in the directory

Code: Select all

Exception: STATUS_ACCESS_VIOLATION at rip=001800A663D
rax=0000000000030000 rbx=0000000180338660 rcx=0000000180338638
rdx=0000000000410000 rsi=0000000000000002 rdi=0000000180338638
r8 =00000000FFFFC88C r9 =0000000180153BC0 r10=0000000100000000
r11=000000010042864F r12=0000000000000000 r13=00000001004CD548
r14=0000000000000003 r15=0000000180338E78
rbp=00000000FFFFCC60 rsp=00000000FFFFC800
program=C:\nrn\mingw\usr\bin\sh.exe, pid 373, thread main
cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B
Stack trace:
Frame        Function    Args
000FFFFCC60  001800A663D (00180193ADC, 00000000000, 001004CF4F3, 00000000000)
000FFFFCC60  00180152F66 (001005D086C, 000FFFFCC60, 00000000000, 001005D0874)
000FFFFCC60  0018012B65B (001005D086C, 000FFFFCC60, 00000000000, 001005D0874)
000FFFFCC60  0010042864F (000FFFFCCD0, 00000000030, 00000000000, 502D6E69572D484D)
000FFFFCC60  001004BEDAF (0018005C74F, 001801DFED0, 000FFFFCBC0, 00000000008)
000FFFFCC60  001004BF822 (000FFFFCC60, 00600000160, 00000000030, FF0700010302FF00)
000FFFFCCD0  0018004A884 (00000000000, 00000000000, 00000000000, 00000000000)
00000000000  00180048343 (00000000000, 00000000000, 00000000000, 00000000000)
000FFFFFFF0  001800483F4 (00000000000, 00000000000, 00000000000, 00000000000)
End of stack trace
this was on version 7.7, I got similar issues with 7.8 too, but 7.4 works normally
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: Compiling script fails with newer NEURON versions due to $N

Post by hines »

Please try https://neuron.yale.edu/ftp/neuron/vers ... -setup.exe
If there are any difficulties that is the best place for me to resolve. I'm not experiencing any $N issue with that.
Mohamed_Hisham
Posts: 16
Joined: Thu Oct 08, 2015 2:56 pm
Location: Wright State University

Re: Compiling script fails with newer NEURON versions due to $N

Post by Mohamed_Hisham »

Thanks for your kind support.

I installed this version, the GUI issue is the same, it shows unfamiliar window to me with only "nothing" button
https://drive.google.com/file/d/1ey9WeK ... sp=sharing

and this time it only gives me the following

Code: Select all

NEURON -- VERSION 8.0.dev-239-g8f2aaaa9 master (8f2aaaa9) 2020-11-11
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2019
See http://neuron.yale.edu/neuron/credits

        0
        0
        0
        0
        1
c:\nrn/mingw/usr/bin/sh c:\nrn/lib/mknrndll.sh /cygdrive/c\nrn
I am not sure how to debug this problem to get you more information
Mohamed_Hisham
Posts: 16
Joined: Thu Oct 08, 2015 2:56 pm
Location: Wright State University

Re: Compiling script fails with newer NEURON versions due to $N

Post by Mohamed_Hisham »

I tried to open the bash window and type
nrnivmodl
in the command window, but I get this error

Code: Select all

$ nrnivmodl
sh: /lib/mknrndl2.sh: No such file or directory
but , trying the same on windows powershell has worked
Post Reply