compiling issues on Mac

The basics of how to develop, test, and use models.
Post Reply
LauraD
Posts: 13
Joined: Wed Oct 24, 2018 12:09 pm

compiling issues on Mac

Post by LauraD »

Hello,
I am new to Neuron and am working with several of the codes developed by Dr. Santhakumar's group (several in the DB!). They previously have used it on Windows and we tested that it still works.
However I am working on a MacBook Pro OS version 10.13.6
I believe my current issue is that the compiling is not working properly.
Following the steps on this page: everything seems to go well up until step E then I am not sure if anything is happening properly.
https://neuron.yale.edu/neuron/download/compilestd_osx


The output I get is down below, and I am still not able to get "nrnmech.dll was built successfully." when compiling.
Would appreciate any and all help,
Kind Regards,
Laura Dovek

:nrnenv lauradovek$ export IV=$IDIR/iv
:nrnenv lauradovek$ export N=$IDIR/nrn
:nrnenv lauradovek$ export CPU=x86_64
:nrnenv lauradovek$ export PATH=$IV/$CPU/bin:$N/$CPU/bin:$PATH
:nrnenv lauradovek$ export LD_LIBRARY_PATH=$HOME/local/lib/
:nrnenv lauradovek$ source ~/neuron/nrnenv
-bash: source: /Users/lauradovek/neuron/nrnenv: is a directory
:nrnenv lauradovek$ echo now executing ~/.profile
now executing /Users/lauradovek/.profile
:nrnenv lauradovek$ export PATH=$HOME/local/bin:$PATH
:nrnenv lauradovek$ export LD_LIBRARY_PATH=$HOME/local/lib/
:nrnenv lauradovek$ source ~/neuron/nrnenv
-bash: source: /Users/lauradovek/neuron/nrnenv: is a directory
:nrnenv lauradovek$ cd $HOME/neuron/nrn
:nrn lauradovek$ make after_install
-bash: make: command not found
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: compiling issues on Mac

Post by hines »

It is not hard to build from sources on the mac, but be aware that there is an installation pkg available that does not require the "brew"
developer tool hints alluded to below and also attempts to install xquartz and command line tools if they are not already installed. See:
https://neuron.yale.edu/ftp/neuron/vers ... -36-27.pkg

It appears that you added the line "source ~/neuron/nrnenv" to your nrnenv file which explains the recursive strangeness of your output.


The build notes need to be updated. Here is my current version

Code: Select all

setup development environment

make -v # if does not exist will help you install command line tools.
or else
xcode-select --install

Download and install from xquartz.org

If building from git repository need automake, autoconf, libtool.
Can get from macports. HomeBrew is also easy to use.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install automake autoconf libtool

If wish to use MPI
brew install open-mpi

#get software
cd $HOME
mkdir neuron
cd neuron
git clone http://nrnhines@github.com/neuronsimulator/iv
git clone http://nrnhines@github.com/neuronsimulator/nrn

I build the NEURON installation package with
export MACOSX_DEPLOYMENT_TARGET=10.9
to be compatible with older machines (with an old python one can go back
to 10.7 or perhaps even to 10.6). This is not required if you are only using
this on the machine you are building on. In fact, when building with the
default python2.7.10 on 10.13 I get at link time the error
error: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.9" but "10.13" during
configure. This was avoided by installing the latest python3.7 from
python.org.  Note, when the python is unspecified, configure for NEURON looks
for python3 first. But with that python3.7, if you wish to use rxd then you
also need 'pip3 install scipy' and
brew install cython
If you don't care about rxd then add --disable-rx3d to the nrn configure line.

cd $HOME/neuron/iv
sh build.sh
./configure --prefix=/Applications/NEURON-7.6/iv
make
make install

mkdir -p $HOME/neuron/nrnobj
cd $HOME/neuron/nrn
sh build.sh
cd ../nrnobj
../nrn/configure --prefix=/Applications/NEURON-7.6/nrn --with-paranrn --with-nrnpython
make -j 2 install
make after_install

#single click button action for x11 when entering a window
#focus follows mouse
sudo -u $USER defaults write org.macosforge.xquartz.X11 wm_ffm -bool true


export PYTHONPATH=/Applications/NEURON-7.6/nrn/lib/python
export PATH=/Applications/NEURON-7.6/nrn/x86_64/bin/:$PATH

LauraD
Posts: 13
Joined: Wed Oct 24, 2018 12:09 pm

Re: compiling issues on Mac

Post by LauraD »

Dear Dr. Hines,
Thank you for your prompt reply.

I used the steps you recommended and the program is now able to open and show me the neuron that others had created. However I am still having trouble compiling.
For example I am trying to compile the file: ccanl.mod

This is the output when i drag the file to mknrndll:

Code: Select all

-e 
/Users/lauradovek/Desktop/Neuron/Dentate
ccanl.mod
ccanl.mod
"/Applications/NEURON-7.6/nrn/share/nrn/libtool" --tag=CC --mode=compile mpicc -DHAVE_CONFIG_H  -I. -I.. -I"/Applications/NEURON-7.6/nrn/include/nrn" -I"/Applications/NEURON-7.6/nrn/x86_64/lib"      -g -O2 -c -o mod_func.lo mod_func.c
libtool: compile:  mpicc -DHAVE_CONFIG_H -I. -I.. -I/Applications/NEURON-7.6/nrn/include/nrn -I/Applications/NEURON-7.6/nrn/x86_64/lib -g -O2 -c mod_func.c  -fno-common -DPIC -o .libs/mod_func.o
"/Applications/NEURON-7.6/nrn/share/nrn/libtool" --tag=CC --mode=link mpicc -module  -g -O2    -headerpad_max_install_names -o libnrnmech.la -rpath "/Applications/NEURON-7.6/nrn/x86_64/lib"  ccanl.lo mod_func.lo  -L"/Applications/NEURON-7.6/nrn/x86_64/lib" -lnrnoc -loc -lmemacs -lnrnmpi -lscopmath -lsparse13 -lreadline -lncurses -L"/Applications/NEURON-7.6/nrn/x86_64/lib" -lnrniv -livoc -lneuron_gnu -lmeschach -lsundials       
libtool: link: rm -fr  .libs/libnrnmech.0.so .libs/libnrnmech.la .libs/libnrnmech.lai .libs/libnrnmech.so
libtool: link: mpicc -Wl,-undefined -Wl,dynamic_lookup -o .libs/libnrnmech.0.so -bundle  .libs/ccanl.o .libs/mod_func.o   -L/Applications/NEURON-7.6/nrn/x86_64/lib /Applications/NEURON-7.6/nrn/x86_64/lib/libnrnoc.dylib /Applications/NEURON-7.6/nrn/x86_64/lib/liboc.dylib -L/usr/X11/lib -lX11 /Applications/NEURON-7.6/nrn/x86_64/lib/libmemacs.dylib /Applications/NEURON-7.6/nrn/x86_64/lib/libnrnmpi.dylib /Applications/NEURON-7.6/nrn/x86_64/lib/libscopmath.dylib /Applications/NEURON-7.6/nrn/x86_64/lib/libsparse13.dylib /Applications/NEURON-7.6/nrn/x86_64/lib/libreadline.dylib -lncurses /Applications/NEURON-7.6/nrn/x86_64/lib/libnrniv.dylib /Applications/NEURON-7.6/nrn/x86_64/lib/libivoc.dylib /Applications/NEURON-7.6/nrn/x86_64/lib/libneuron_gnu.dylib /Applications/NEURON-7.6/nrn/x86_64/lib/libmeschach.dylib /Applications/NEURON-7.6/nrn/x86_64/lib/libsundials.dylib  -g -O2  
libtool: link: (cd ".libs" && rm -f "libnrnmech.so" && ln -s "libnrnmech.0.so" "libnrnmech.so")
libtool: link: ( cd ".libs" && rm -f "libnrnmech.la" && ln -s "../libnrnmech.la" "libnrnmech.la" )
Successfully created x86_64/special
Press 'return' key to close
However when I then try to run neuron via the .hoc file I get this message:

Code: Select all

/Applications/NEURON-7.6/nrn/x86_64/bin/nrniv: syntax error
 in John GC alone.hoc near line 73
 		insert ccanl
              ^
oc>




Kind Regards,
Laura
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: compiling issues on Mac

Post by hines »

Is the hoc file in the same folder as the mod file?
Dragging the mod file (or its folder) onto the mknrndll icon should create an x86_64 folder in the folder that contained the mod file.
Verify this is the case. If you launch nrniv in this folder (now containing the x86_64) folder from a terminal, you should see a line like

loading membrane mechanisms from ...
Additional mechanisms from files ccanl.mod
LauraD
Posts: 13
Joined: Wed Oct 24, 2018 12:09 pm

Re: compiling issues on Mac

Post by LauraD »

Hello Dr. Hines,
Yes that is exactly what I am getting,
and yes the x86_64 folder is in the folder containing the mod file.

Code: Select all

Last login: Mon Oct 29 14:58:57 on ttys000
:~ lauradovek$ cd desktop
:desktop lauradovek$ cd Neuron/Dentate
:Dentate lauradovek$ nrniv
NEURON -- VERSION 7.6.2-30-gd432e20 master (d432e20) 2018-10-25
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2018
See http://neuron.yale.edu/neuron/credits

loading membrane mechanisms from x86_64/.libs/libnrnmech.so
Additional mechanisms from files
 ccanl.mod
oc>




I then get the same error but for another channel so I re compile that channel.
This leads to me getting the following:

Code: Select all

-e 
NEURON -- VERSION 7.6.2-30-gd432e20 master (d432e20) 2018-10-25
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2018
See http://neuron.yale.edu/neuron/credits

loading membrane mechanisms from /Users/lauradovek/Desktop/Neuron/Dentate/x86_64/.libs/libnrnmech.so
Additional mechanisms from files
 ichan2.mod
	1 
/Applications/NEURON-7.6/nrn/x86_64/bin/nrniv: syntax error
 in SGC.hoc near line 82
 		insert ccanl
              ^
oc>

They continue to switch places based on which one was compiled more recently.
Kind Regards,
Laura
hines
Site Admin
Posts: 1682
Joined: Wed May 18, 2005 3:32 pm

Re: compiling issues on Mac

Post by hines »

Instead of dragging the mod file, try dragging the folder containing the two mod files on to the mknrndll icon
LauraD
Posts: 13
Joined: Wed Oct 24, 2018 12:09 pm

Re: compiling issues on Mac

Post by LauraD »

Yes, it now works! silly mistake.
Thank you Dr. Hines.
Post Reply