Compiling script fails with newer NEURON versions due to $N

Post Reply
MBeining
Posts: 35
Joined: Thu Apr 03, 2014 8:18 am

Compiling script fails with newer NEURON versions due to $N

Post by MBeining » Sun May 26, 2019 5:26 am

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: 1577
Joined: Wed May 18, 2005 3:32 pm

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

Post by hines » Mon May 27, 2019 8:20 am

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
Posts: 35
Joined: Thu Apr 03, 2014 8:18 am

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

Post by MBeining » Thu May 30, 2019 5:22 am

Thanks for that hint!

After also adding a check to add the correct mingw path (in this case $N/mingw/mingw64/bin) it worked!

Post Reply