Template:Unix installation
From AbInitio
(diff) ←Older revision | Current revision | Newer revision→ (diff)
Contents |
Installation Paths
First, let's review some important information about installing software on Unix systems, especially in regards to installing software in non-standard locations. (None of these issues are specific to this software, but they've caused a lot of confusion among our beloved users.)
Most of the software below, including this software, installs under /usr/local
by default; that is, libraries go in /usr/local/lib
, programs in /usr/local/bin
, etc. If you don't have root
privileges on your machine, you may need to install somewhere else, e.g. under $HOME/install
(the install/
subdirectory of your home directory). Most of the programs below use a GNU-style configure
script, which means that all you would do to install there would be:
./configure --prefix=$HOME/install
when configuring the program; the directories $HOME/install/lib
etc. are created automatically as needed.
Paths for Configuring
There are two further complications. First, if you install in a non-standard location (and /usr/local
is considered non-standard by some proprietary compilers), you will need to tell the compilers where to find the libraries and header files that you dutifully installed. You do this by setting two environment variables:
setenv LDFLAGS "-L/usr/local/lib" setenv CPPFLAGS "-I/usr/local/include"
Of course, substitute whatever installation directory you used. Do this before you run the configure
scripts, etcetera. You may need to include multiple -L
and -I
flags (separated by spaces) if your machine has stuff installed in several non-standard locations. Bourne shell users (e.g. bash
or ksh
) should use the "export FOO=bar
" syntax instead of csh
's "setenv FOO bar
", of course.
You might also need to update your PATH
so that you can run the executables you installed (although /usr/local/bin
is in the default PATH
on many systems). e.g. if we installed in our home directory as described above, we would do:
setenv PATH "$HOME/install/bin:$PATH"
Paths for Running (Shared Libraries)
Second, many of the packages installed below (e.g. Guile) are installed as shared libraries. You need to make sure that your runtime linker knows where to find these shared libraries. The bad news is that every operating system does this in a slightly different way. The good news is that, when you run make install
for the packages involving shared libraries, the output includes the necessary instructions specific to your system, so pay close attention! It will say something like "add LIBDIR to the <code>foobar
environment variable</code>," where LIBDIR
will be your library installation directory (e.g. /usr/local/lib
) and foobar is some environment variable specific to your system (e.g. LD_LIBRARY_PATH
on some systems, including Linux). For example, you might do:
setenv foobar "/usr/local/lib:$foobar"
Note that we just add to the library path variable, and don't replace it in case it contains stuff already. If you use Linux and have root
privileges, you can instead simply run /sbin/ldconfig
, first making sure that a line "/usr/local/lib
" (or whatever) is in /etc/ld.so.conf
.
If you don't want to type these commands every time you log in, you can put them in your ~/.cshrc
file (or ~/.profile
, or ~/.bash_profile
, depending on your shell).
Fun with Fortran
This software, and many of the libraries it calls, are written in C or C++, but it also calls libraries such as BLAS and LAPACK (see below) that are usually compiled from Fortran. This can cause some added difficulty because of the various linking schemes used by Fortran compilers. This software's configure
script attempts to detect the Fortran linking scheme automatically, but in order for this to work you must use the same Fortran compiler and options with this software as were used to compile BLAS/LAPACK.
By default, this software looks for a vendor Fortran compiler first (f77
, xlf
, etcetera) and then looks for GNU g77
. In order to manually specify a Fortran compiler foobar
you would configure it with './configure F77=foobar ...
'.
If, when you compiled BLAS/LAPACK, you used compiler options that alter the linking scheme (e.g. g77
's -fcase-upper
or -fno-underscoring
), you will need to pass the same flags to this software via './configure FFLAGS="...flags..." ...
'.
Picking a compiler
It is often important to be consistent about which compiler you employ. This is especially true for C++ software. To specify a particular C compiler foo
, configure with ./configure CC=foo
; to specify a particular C++ compiler foo++
, configure with ./configure CXX=foo++