Template:Unix installation
From AbInitio
Revision as of 22:37, 22 October 2005 (edit) Stevenj (Talk | contribs) ← Previous diff |
Revision as of 22:40, 22 October 2005 (edit) Stevenj (Talk | contribs) Next diff → |
||
Line 1: | Line 1: | ||
== Installation Paths == | == 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 {{{1|this software}}}, but they've caused a lot of confusion among our beloved users.) | + | 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 {{{name|this software}}}, installs under <code>/usr/local</code> [http://www.pathname.com/fhs/ by default]<nowiki>; that is, libraries go in </nowiki><code>/usr/local/lib</code>, programs in <code>/usr/local/bin</code>, etc. If you don't have <code>root</code> privileges on your machine, you may need to install somewhere else, e.g. under <code>$HOME/install</code> (the <code>install/</code> subdirectory of your home directory). Most of the programs below use a GNU-style <code>configure</code> script, which means that all you would do to install there would be: | + | Most of the software below, including this software, installs under <code>/usr/local</code> [http://www.pathname.com/fhs/ by default]<nowiki>; that is, libraries go in </nowiki><code>/usr/local/lib</code>, programs in <code>/usr/local/bin</code>, etc. If you don't have <code>root</code> privileges on your machine, you may need to install somewhere else, e.g. under <code>$HOME/install</code> (the <code>install/</code> subdirectory of your home directory). Most of the programs below use a GNU-style <code>configure</code> script, which means that all you would do to install there would be: |
./configure --prefix=$HOME/install | ./configure --prefix=$HOME/install | ||
Line 33: | Line 33: | ||
== Fun with Fortran == | == Fun with Fortran == | ||
+ | Our softare, 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. Our <code>configure</code> 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 our software as were used to compile BLAS/LAPACK''. | ||
- | {{{name|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. {{{name|This software}}}'s <code>configure</code> 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 {{{name|this software}}} as were used to compile BLAS/LAPACK''. | + | By default, our software looks for a vendor Fortran compiler first (<code>f77</code>, <code>xlf</code>, etcetera) and then looks for GNU <code>g77</code>. In order to manually specify a Fortran compiler <code>foobar</code> you would configure it with '<code>./configure F77=foobar ...</code>'. |
- | + | ||
- | By default, {{{name|this software}}} looks for a vendor Fortran compiler first (<code>f77</code>, <code>xlf</code>, etcetera) and then looks for GNU <code>g77</code>. In order to manually specify a Fortran compiler <code>foobar</code> you would configure it with '<code>./configure F77=foobar ...</code>'. | + | |
If, when you compiled BLAS/LAPACK, you used compiler options that alter the linking scheme (e.g. <code>g77</code>'s <code>-fcase-upper</code> or <code>-fno-underscoring</code>), you will need to pass the same flags to {{{name|this software}}} via '<code>./configure FFLAGS="...''flags''..." ...</code>'. | If, when you compiled BLAS/LAPACK, you used compiler options that alter the linking scheme (e.g. <code>g77</code>'s <code>-fcase-upper</code> or <code>-fno-underscoring</code>), you will need to pass the same flags to {{{name|this software}}} via '<code>./configure FFLAGS="...''flags''..." ...</code>'. | ||
Line 42: | Line 41: | ||
== Picking a compiler == | == 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 <code>foo</code>, configure with <code>./configure CC=foo</code>; to specify a particular C++ compiler <code>foo++</code>, configure with <code>./configure CXX=foo++</code> | + | 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 <code>foo</code>, configure with <code>./configure CC=foo</code>; to specify a particular C++ compiler <code>foo++</code>, configure with <code>./configure CXX=foo++</code>; to specify a particular Fortran compiler <code>foo90</code>, configure with <code>./configure F77=foo90</code>. |
Revision as of 22:40, 22 October 2005
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
Our softare, 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. Our 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 our software as were used to compile BLAS/LAPACK.
By default, our 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++
; to specify a particular Fortran compiler foo90
, configure with ./configure F77=foo90
.