Changes between Version 1 and Version 2 of nco_install


Ignore:
Timestamp:
05/04/12 17:14:23 (8 years ago)
Author:
lalibert
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • nco_install

    v1 v2  
    11= Compliling NCO as a non-root user = 
    2 1. Download the most recent NCO version. New features and bug fixes are common and users are urged to keep an up-to-date version of NCO. 
    3 2. Install libs4cdo. Instructions can be found [wiki:CDO_Install here] 
    4 2. Create a local installation directory in your home. In BASH: 
     21. Install libs4cdo. Instructions can be found [wiki:cdo_install here]. 
     31. Create a local installation directory in your home. In BASH: 
    54{{{ 
    6 mkdir -p ~/local/cdo 
     5mkdir -p ~/local/nco 
     6export NCO_HOME="~/local/nco" 
    77export CDO_HOME="~/local/cdo" 
    88}}} 
    9 3. Build libs4cdo, to be found on the CDO website. In the libs4cdo directory: 
     91. Run the following script and hope for the best! Here's the installation we were able to get: 
     10 
    1011{{{ 
    11 ./configure --prefix=$CDO_HOME 
    12 make 
    13 make install 
     12ncap2 -r 
     13 
     14NCO netCDF Operators version "4.0.8" 
     15ncap2 version 4.0.8 
     16Linked to netCDF library version 4.1.2 
     17Copyright (C) 1995--2011 Charlie Zender 
     18NCO is free software and comes with A BIG FAT KISS and ABOLUTELY NO WARRANTY 
     19License: GNU General Public License (GPL) Version 3 
     20Homepage: http://nco.sf.net 
     21User's Guide: http://nco.sf.net/nco.html 
     22Configuration Option:   Active? Meaning or Reference: 
     23Check _FillValue                Yes     http://nco.sf.net/nco.html#mss_val 
     24Check missing_value     No      http://nco.sf.net/nco.html#mss_val 
     25Compressed netCDF3      No      http://nco.sf.net/nco.html#znetcdf (pre-alpha) 
     26DAP clients (libdap)            No      http://nco.sf.net/nco.html#dap 
     27DAP clients (libnetcdf) Yes     http://nco.sf.net/nco.html#dap 
     28Debugging: Custom               No      Pedantic, bounds checking (slowest execution) 
     29Debugging: Symbols              No      Produce symbols for debuggers (e.g., dbx, gdb) 
     30GNU Scientific Library  Yes     http://nco.sf.net/nco.html#gsl 
     31Internationalization            No      http://nco.sf.net/nco.html#i18n (pre-alpha) 
     32MPI parallelization             No      http://nco.sf.net/nco.html#mpi (beta) 
     33netCDF3 64-bit files            Yes     http://nco.sf.net/nco.html#lfs 
     34netCDF4/HDF5                    Yes     http://nco.sf.net/nco.html#nco4 
     35OpenMP SMP threading    No      http://nco.sf.net/nco.html#omp 
     36Optimization: run-time  No      Fastest execution possible (slowest compilation) 
     37Parallel netCDF3                No      http://nco.sf.net/nco.html#pnetcdf (pre-alpha) 
     38Shared libraries built          No      Small, dynamically linked executables 
     39Static libraries built          Yes     Large executables with private namespaces 
     40UDUnits conversions             Yes     http://nco.sf.net/nco.html#udunits 
     41UDUnits2 conversions    No      http://nco.sf.net/nco.html#udunits 
     42Wildcarding (regex)             Yes     http://nco.sf.net/nco.html#rx 
    1443}}} 
    15 4. Build cdo. In the cdo directory: 
     44 
    1645{{{ 
    17 ../configure --prefix=$CDO_HOME --with-proj=$CDO_HOME --with-grib_api=$CDO_HOME --with-jasper=$CDO_HOME --with-netcdf=$CDO_HOME --with-hdf5=$CDO_HOME --with-zlib=$CDO_HOME --with-szlib=$CDO_HOME --with-threads=$CDO_HOME --enable-cgribex=no CFLAGS=-DHAVE_LIBNC_DAP 
    18 make 
    19 make check 
    20 make install 
     46#THIS SCRIPT COMPILES NCO ASSUMING LIBS4CDO WAS INSTALLED 
     47#FREDERIC LALIBERTE AT THE UNIVERSITY OF TORONTO, 2012 
     48# 
     49#MODIFIED FROM A POSTING BY kwilcox at 
     50#http://sourceforge.net/projects/nco/forums/forum/9830/topic/4089501 
     51 
     52#CREATE SOURCE CODE REPOSITORY 
     53INSTALL_PATH=$NCO_HOME 
     54mkdir -p $INSTALL_PATH/src 
     55 
     56#FLAGS FOR INSTALLING LIBRABRIES 
     57INSTALL_ANTLR=1 
     58INSTALL_UDUNITS=1 
     59INSTALL_GSL=1 
     60 
     61 
     62echo "Must specify NETCDF4_DIR and HDF5_DIR." 
     63echo "If libs4cdo was installed, point to that installation" 
     64NETCDF4_DIR=$CDO_HOME 
     65HDF5_DIR=$CDO_HOME 
     66 
     67############# ANTLR2 ################# 
     68APP=antlr-2.7.7 
     69ANTLR_PATH=$INSTALL_PATH/$APP 
     70if [ "$INSTALL_ANTLR" -eq "1" ]; then 
     71rm -rf $ANTLR_PATH 
     72cd $INSTALL_PATH/src 
     73 
     74rm -rf ${APP} 
     75wget http://www.antlr2.org/download/${APP}.tar.gz 
     76tar xzf ${APP}.tar.gz ; cd ${APP} 
     77 
     78# Bug in antlr-2.7.7 ------------------- 
     79sed -i "13a #include <strings.h>" lib/cpp/antlr/CharScanner.hpp 
     80sed -i "14a #include <cstdio>" lib/cpp/antlr/CharScanner.hpp 
     81#The previous lines were extremely important for a successful build, FBL 
     82 
     83CC=gcc CXX='' ./configure \ 
     84--prefix=$ANTLR_PATH \ 
     85--disable-csharp \ 
     86--disable-java \ 
     87--disable-python 2>&1 | tee $APP.config 
     88make 2>&1 | tee $APP.make 
     89make install 2>&1 | tee $APP.install 
     90fi 
     91######################################### 
     92 
     93################ UDUNITS ################# 
     94APP=udunits-2.1.20 
     95UDUNITS_PATH=$INSTALL_PATH/$APP 
     96if [ "$INSTALL_UDUNITS" -eq "1" ]; then 
     97rm -rf $UDUNITS_PATH 
     98cd $INSTALL_PATH/src 
     99 
     100rm -rf ${APP}* 
     101wget ftp://ftp.unidata.ucar.edu/pub/udunits/${APP}.tar.gz 
     102tar xzf ${APP}.tar.gz ; cd ${APP} 
     103 
     104CC=gcc CXX='' F77=gfortran ./configure \ 
     105--prefix=$UDUNITS_PATH 2>&1 | tee $APP.config 
     106make 2>&1 | tee $APP.make 
     107make install 2>&1 | tee $APP.install 
     108fi 
     109######################################### 
     110 
     111#GSL 
     112# GSL ################################### 
     113APP=gsl-1.15 
     114GSL_PATH=$INSTALL_PATH/$APP 
     115if [ "$INSTALL_GSL" -eq "1" ]; then 
     116rm -rf $GSL_PATH 
     117cd $INSTALL_PATH/src 
     118 
     119rm -rf ${APP}* 
     120wget http://gnu.mirror.iweb.com/gnu/gsl/${APP}.tar.gz 
     121tar xzf ${APP}.tar.gz ; cd ${APP} 
     122 
     123./configure \ 
     124--prefix=$GSL_PATH \ 
     125CFLAGS="-fexceptions" | tee $APP.config 
     126make 2>&1 | tee $APP.make 
     127make install 2>&1 | tee $APP.install 
     128fi 
     129######################################### 
     130 
     131#FINALLY! 
     132# NCO ################################### 
     133APP=nco-4.0.8 
     134NCO_PATH=$INSTALL_PATH/$APP 
     135rm -rf $NCO_PATH 
     136cd $INSTALL_PATH/src 
     137 
     138rm -rf ${APP}* 
     139wget http://nco.sourceforge.net/src/${APP}.tar.gz 
     140tar xzf ${APP}.tar.gz ; cd ${APP} 
     141 
     142export LD_LIBRARY_PATH=$HDF5_DIR/lib:$LD_LIBRARY_PATH 
     143export PATH=$HDF5_DIR/bin:$PATH 
     144export LD_LIBRARY_PATH=$NETCDF4_DIR/lib:$LD_LIBRARY_PATH 
     145export PATH=$NETCDF4_DIR/bin:$PATH 
     146export LD_LIBRARY_PATH=$ANTLR_PATH/lib:$LD_LIBRARY_PATH 
     147export PATH=$ANTLR_PATH/bin:$PATH 
     148export LD_LIBRARY_PATH=$UDUNITS_PATH/lib:$LD_LIBRARY_PATH 
     149export PATH=$UDUNITS_PATH/bin:$PATH 
     150export LD_LIBRARY_PATH=$GSL_PATH/lib:$LD_LIBRARY_PATH 
     151export PATH=$GSL_PATH/bin:$PATH 
     152 
     153CC=gcc CXX='' \ 
     154NETCDF_INC=$NETCDF4_DIR/include \ 
     155NETCDF_LIB=$NETCDF4_DIR/lib \ 
     156NETCDF4_ROOT=$NETCDF4_DIR \ 
     157HDF5_LIB_DIR=$HDF5_DIR/lib \ 
     158UDUNITS2_PATH=$UDUNITS_PATH \ 
     159LDFLAGS="-L$ANTLR_PATH/lib -lantlr \ 
     160-lhdf5_hl -lhdf5 -L$NETCDF4_DIR/lib -lnetcdf" \ 
     161CFLAGS="-I$HDF5_DIR/include \ 
     162-L$HDF5_DIR/lib \ 
     163-I$ANTLR_PATH/include \ 
     164-L$ANTLR_PATH/lib" \ 
     165CPPFLAGS="-I$HDF5_DIR/include \ 
     166-L$HDF5_DIR/lib \ 
     167-I$ANTLR_PATH/include \ 
     168-L$ANTLR_PATH/lib" \ 
     169./configure \ 
     170--prefix=$NCO_PATH \ 
     171--disable-shared \ 
     172--disable-udunits2 \ 
     173--enable-netcdf-4 2>&1 | tee $APP.config 
     174echo "#define ENABLE_NETCDF4 1" >> config.h 
     175make 2>&1 | tee $APP.make 
     176make install 2>&1 | tee $APP.install 
    21177}}} 
    22 The CFLAGS command is to enable cdo over OpenDAP. 
    23 5. Update your .bashrc: 
    24 {{{ 
    25 export PATH=$HOME/local/cdo/bin:$PATH 
    26 }}}