Compiling the Standard Distribution Under UNIX/Linux

Comments:
1. The details of compiling NEURON under UNIX differ slightly, depending on whether you are starting with the standard distribution's gzipped tar files, or development code from the Subversion repository. These instructions assume that you are working with the former.
2. In the following instructions, mm and nn stand for the version numbers of InterViews and NEURON, respectively.

Installing from source code gives you much more control over what you get and where it ends up. Here are your basic choices:

Full installation of NEURON with InterViews
This is what we recommend, and what most users will want.
NRNIV only (no GUI)
Includes everything except the GUI classes. Really intended for the very small number of users with a hardware/OS environment that will not compile InterViews. Suitable for non-interactive use, e.g. running large families of simulations on supercomputer hardware. Note: users who performed the Full installation can also use NEURON non-interactively by simply launching it with its GUI inactivated.
NRNOC only (no C++ classes)
Very few users will want this. You'll know who you are.
NEURON with Java
For a handful of users with very special needs. We must emphasize that Java is absolutely not necessary to use NEURON, and that none of NEURON's tools require Java in order to work.


Full installation of NEURON with InterViews

1. Create a neuron directory in your home directory, put the gzipped source files in it, and jump in after them.
  cd $HOME
  mkdir neuron
  mv iv-mm.tar.gz neuron
  mv nrn-nn.tar.gz neuron
  cd neuron
2. Install InterViews
  tar xzf iv-mm.tar.gz
  # renaming the new directory to iv makes life simpler later on
  mv iv-mm iv
  cd iv
  ./configure --prefix=`pwd` # What if configure fails
  make
  make install
3. Install NEURON
  cd $HOME/neuron
  tar xzf nrn-nn.tar.gz
  # renaming the new directory to nrn makes life simpler later on
  mv nrn-n.n nrn
  cd nrn
  ./configure --prefix=`pwd`
  make
  make install
4. Test NEURON by running its "demonstration" program.
  ./config.guess #your hostcpu is printed in the form hostcpu-vendor-osversion
  # for this concrete example, we assume it is i686
  i686/bin/neurondemo
If this doesn't work, you may need the LD_LIBRARY_PATH environment variable.

5. Update your PATH environment variable. For Linux, add the following line to the .bashrc file
  source $HOME/neuron/nrnenv
and create an nrnenv file in $HOME/neuron with the contents
  export IV=$HOME/neuron/iv
  export N=$HOME/neuron/nrn
  # for this concrete example, we assume hostcpu is i686
  export CPU=i686
  export PATH="$IV/$CPU/bin:$N/$CPU/bin:$PATH"
If you plan to use the ParallelContext with PVM, you may need a few more environment variables.


NRNIV only (no GUI)

1. Create a neuron directory in your home directory, put the gzipped source for NEURON in it, and jump in after it.
  cd $HOME
  mkdir neuron
  mv nrn-nn.tar.gz neuron
  cd neuron
2. Install NEURON
  tar xzf nrn-nn.tar.gz
  # renaming the new directory to nrn makes life simpler later on
  mv nrn-n.n nrn
  cd nrn
  ./configure --prefix=`pwd` --without-iv
  make
  make install
3. Test NEURON by running its "demonstration" program.
  ./config.guess #your hostcpu is printed in the form hostcpu-vendor-osversion
  cd share/nrn/demo/release
  # for this concrete example, we assume hostcpu is i686
  $HOME/neuron/nrn/i686/bin/nrnivmodl
  i686/special
If this doesn't work, you may need the LD_LIBRARY_PATH environment variable.

4. Update your PATH environment variable. For Linux, add the following line to the .bashrc file
  source $HOME/neuron/nrnenv
and create an nrnenv file in $HOME/neuron with the contents
  export N=$HOME/neuron/nrn
  # for this concrete example, we assume hostcpu is i686
  export CPU=i686
  export PATH="$N/$CPU/bin:$PATH"
If you plan to use the ParallelContext with PVM, you may need a few more environment variables.


NRNOC only (no C++ classes)

1. Create a neuron directory in your home directory, put the gzipped source for NEURON in it, and jump in after it.
  cd $HOME
  mkdir neuron
  mv nrn-nn.tar.gz neuron
  cd neuron
2. Install NEURON
  tar xzf nrn-nn.tar.gz
  # renaming the new directory to nrn makes life simpler later on
  mv nrn-n.n nrn
  cd nrn
  ./configure --prefix=`pwd` --without-nrniv
  make
  make install
3. Test NEURON by running its "demonstration" program.
  ./config.guess #your hostcpu is printed in the form hostcpu-vendor-osversion
  cd share/nrn/demo/release
  # for this concrete example, we assume hostcpu is i686
  $HOME/neuron/nrn/i686/bin/nrnocmodl
  i686/special
If this doesn't work, you may need the LD_LIBRARY_PATH environment variable.

4. Update your PATH environment variable. For Linux, add the following line to the .bashrc file
  source $HOME/neuron/nrnenv
and create an nrnenv file in $HOME/neuron with the contents
  export N=$HOME/neuron/nrn
  # for this concrete example, we assume hostcpu is i686
  export CPU=i686
  export PATH="$N/$CPU/bin:$PATH"
If you plan to use the ParallelContext with PVM, you may need a few more environment variables.


Final Comments

You may not ever need to know any of these things. But just in case  .  .  .
1. Where things are installed
The --prefix option in the configure statement controls where the installation will be placed. If you don't specify a prefix, a default installation directory is used. For InterViews this is /usr/local/iv, and for NEURON it is /usr/local/nrn
2. Where the NEURON installation looks for InterViews
This is controlled by the --with-iv option when you execute ./configure . . . in the nrn-n.n directory. If you don't specify a --with-iv, it looks first in prefix/.../iv and then in /usr/local/iv.
3. Putting things in other locations
Other configure options are also available. You can also build in a different directory than the sources, e.g. because you have different cpu's sharing the same sources, or because you desire several versions with different configure options (profiling, non-shared, code coverage, with and without Java).

More about environment variables

The LD_LIBRARY_PATH environment variable

In general there should no longer be any requirement for CPU, NEURONHOME, or LD_LIBRARY_PATH environment variables. However, if you have trouble launching NEURON it may be because I am not using libtool generically in the configuration files and need an explicit LD_LIBRARY_PATH for InterViews or for the compiler libraries. Try adding a

  setenv LD_LIBRARY_PATH "${HOME}/neuron/nrn/hostcpu/lib"
statement to your nrnenv file.

Using ParallelContext?

Install PVM and add

  export PVM_ROOT=$HOME/pvm3
  source ${PVM_ROOT}/lib/bashrc.stub
  export PVM_RSH=/usr/bin/ssh
to nrnenv.

What if ./configure fails

This is rare and generally means something is not quite right about the development environment on your machine. Take a look at the config.log file and see if you can diagnose why the last test gave a fatal error. Often it is because the c++ compiler/linker cannot find important libraries. Most errors can be worked around with environment variables such as LD_LIBRARY_PATH.


Page and graphics copyright © 1999 - 2007 by N.T. Carnevale and M.L. Hines, All Rights Reserved.