Page 1 of 1

Compiling script fails with newer NEURON versions due to $N

Posted: Sun May 26, 2019 5:26 am
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 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`"
  if test -d $N/mingw ; then
  if test -d $N/bin64 ; then
export PATH
export N

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

echo ""
if [ -f nrnmech.dll ] ; then
echo "nrnmech.dll was built successfully."
echo "There was an error in the process of creating nrnmech.dll"
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 "" and "mknrndll.mak":

If I provide $N as I always did with "/c/nrn" I first get an error
sh: /c/nrn/lib/ 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/". 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 "", 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 "", so I hope you can help me with the solution.

Thank you very much.

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

Posted: Mon May 27, 2019 8:20 am
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.

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

Posted: Thu May 30, 2019 5:22 am
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!