GEMPAK Manual

GEMPAK Installation Guide: Linux, Unix and Solaris

GEMPAK Installation

NOTE: All files referenced in the following installation instructions can also be obtained/downloaded from here.

64-bit Linux RPM

As root (or with super-user/sudo):

sudo rpm -ivh gempak-latest*.rpm

to install to a custom directory (--prefix=/usr/local will install to /usr/local/GEMPAK7)

sudo rpm -ivh gempak-latest*.rpm --prefix=/usr/local

OR, Install via Unidata AWIPS yum repository:

wget -O /etc/yum.repos.d/awips2.repo https://www.unidata.ucar.edu/software/awips2/doc/awips2.repo
sudo yum clean all
sudo yum install gempak
64-bit Linux RPM (built against Python 2.7)

GEMPAK built against libpython2.7.so, which allows the use of the python-awips package to retrieve and display AWIPS data in GEMPAK programs.

As root (or with super-user/sudo):

sudo rpm -ivh gempak-python-latest*.rpm

Install via Unidata AWIPS yum repository (incl. python packages installed to /awips2/python)

sudo yum groupinstall gempak-python

or (standalone, requires Python 2.7 be installed and available via LD_LIBRARY_PATH)

sudo yum install gempak-python
Source Code

GEMPAK can be installed by an individual user, and root / superuser permission is not required. It's assumed for this guide and throughout other online documentation that GEMPAK is installed for a gempak user account in the home directory (/home/gempak).

  1. Install prereqs:
    yum install openmotif libX11 libXt libXext libXp libXft libXtst xorg-x11-xbitmaps -y
  2. Download the latest source code tarball from github.com
  3. Unpack
    tar -xvzf gempak-7.4.0.tar.gz
  4. Edit GEMPAK7/Gemenviron.profile to set $NAWIPS to the new GEMPAK7 directory (see below)
  5. Create a symbolic link NAWIPS in your home directory will allow you to maintain a single command in .cshrc or .profile that sources the current GEMPAK installation:
    ln -s GEMPAK7/ NAWIPS
  6. cd to GEMPAK7, source Gemenviron.profile, and build.
    cd GEMPAK7
    . Gemenviron.profile
    make everything
  7. Optional: Source build_python.sh before make to build against Python 2.7
    . build_python.sh
    make everything

More Build Instructions...

Configure Your System

Gemenviron / Gemenviron.profile

To build GEMPAK on your system, the environmental variable $NAWIPS must be defined at the top of Gemenviron [ for csh/tcsh ] or Gemenviron.profile [ for bash/ksh ]. These files contain definitions for the locations of various components used by GEMPAK. It is the responsibility of the GEMPAK administrator to confirm that $NAWIPS is defined correctly with the full path of the GEMPAK 7 directory. Other variables which point to the location of data directories, tables and can be tailored at your lesiure, but it's recommended that only $NAWIPS be modified as all other variables related to GEMPAK are dependant on $NAWIPS.

If you unpacked GEMPAK in /home/gempak and plan on compiling with gfortran, you can skip this step.

If you unpacked and plan to install GEMPAK in an uncommon directory (such as /opt/gempak/), you'll need to edit the NAWIPS definition at the top of the appropriate file:

# Please configure the following definitions to reflect your system:
#
# Top level directory:
   setenv NAWIPS /home/gempak/GEMPAK7
#
Sourcing Environmental Variables

csh/tcsh

source the full path of Gemenviron in your .cshrc

source /home/gempak/NAWIPS/Gemenviron

bash

add the following to .profile

. /home/gempak/NAWIPS/Gemenviron.profile

Important environmental variable to be familiar with are:

The last definition, $GEMDATA, points to the /data/ldm/gempak but can be changed depending on how you install and configure the LDM.

Required Libraries

If your system uses standard locations for its compilers, X11/Motif libraries and make utilities, you do not needto change any settings. It's assumed both an ansi compatible C compiler and a Fortran 77 compatible compiler are available.

To build locally from source, you must have the developer environments installed for X11, Open Motif and libXp.

X11
Open Motif

RPM packages of v2.3.1 are recommended for most systems, and are available mozifzone.net). Some operating systems provide the MOTIF libraries, but some only install them as an option.

Generally you have the option to build Open Motif locally from source (v2.3.3), but for Fedora Core 13 & 14 systems a source build is required.

libXp
Full List of Required Libraries

Some systems, most notably recent releases of Fedora Core (fc16 and fc17) require a number of packages be installed in order to successfully build OpenMotif and GEMPAK. Below is a list of all required packages, followed by a single yum install command to take care of them in one instance:

To install all at once:

yum install gcc gcc-c++ gcc-gfortran libX11 libX11-devel libXt-devel \
libXext libXp libXp-devel libXft-devel libXtst-devel xorg-x11-xbitmaps flex \
byacc *fonts-ISO8859-* -y

Note that on recent RHEL-based systems, these packages must also be installed:

On recent systems (running GCC 10+), the changes in this commit should be applied to fix various compilation errors.

Build Options

Gemenviron / Gemenviron.profile

To change the GCC compiler, edit the USE_GFORTRAN, USE_PGI and USE_G77 definitions in Gemenviron or Gemenviron.profile (gfortran is the default):

# Uncomment the following lines for using GCC compilers (Solaris/HP only)
# set USEGCC_SOL=1
# set USEGCC_HPUX=1
#
set USE_GFORTRAN=1
#set USE_PGI=1
#set USE_G77=1
Makeinc.common

For most systems, GEMPAK will be built using either g77 or gfortran[4.1+]. Files located in $NAWIPS/config/ contain information specific to the individual platform you will be installing on (sol, x86, hpux, linux, osf, irix, aix, freebsd, darwin).

SunOS-Specific Options

Bundled cc is not ansi compatible, so SunOS users should make sure SUNWspro/bin/cc is found before /usr/ucb/cc in your path. Also, you will need to ensure that /usr/ccs/bin is in your path.

Ubuntu Linux

Ubuntu builds require the compiler flag -fno-stack-protector be added to COPT (C compiler options) and FOPT (fortran compiler options). Ubuntu-specific Makeinc files are provided in $NAWIPS/config/ that include this compiler flag:

Mac OS X

Mac OS X GEMPAK Installation Guide, Kevin Tyle, University of Albany.

This document will guide users through building GEMPAK on Intel Mac OS X 10.6 (Snow Leopard) with GCC 4.4 compilers. The same procedure should also work for 10.5 (Leopard), but earlier versions/CPU's of OS X remain untested.

Compiling GEMPAK Source

Make

GEMPAK and various bundled libearies are compiled from source by the Make tool, using the Fortran and C compilers specified in the above configuration files. From $NAWIPS issue the command

make all >& make.out

The redirection command >& sends STDOUT to the log file make.out. The Make process takes several minutes to complete, first compiling libraries such as netCDF, ncepBUFR, HDF5 and zlib, followed by the GEMPAK source. In another terminal you can follow the STDOUT log with the command

tail -f make.out

or attach an ampersand to send make to the background and tail the log instantly

make all >& make.out & tail -f make.out

This process allows you to examine the build as it runs but preserves the output in the event something goes horribly wrong. If seeking help from Unidata, attach some or all of this make.out log. One should note that with the Makefile installation, only fatal errors (errors that cause the build to end prematurely) are significant, and most "warnings" can be ignored.

Install & Clean
make install; make clean

Executables are installed to $OS_BIN and libraries should already be located in $OS_LIB.

The command make clean will remove compiled objects and binary executables from the source tree.

If your distribution is modified by patches or other edits and updates and you have to rebuild, the compilation time will be reduced as the libraries which took the majority of the time to build already exist.

Cleaning a Build

In the event that core definitions change and libraries must be built from scratch, a the entire install for your system will need to be cleaned:

make distclean

This full clean will delete all objects and executables as well as all libraries built for the current system.

Everything
make everything

This command will combine the steps of make all, make install and make clean to build and install the package, but will not log STDOUT to file. The command also runs the make programs_nc and make programs_gf targets mentioned below.

GF & NC Programs
make programs_nc

and

make programs_gf

build versions of programs which link directly to device drivers (eliminating the gplt/message queue interface). These are primarily used for projects where multiple scripts are run at scheduled times, as in the cron, and don't require user interaction.

Everything Okay? Continue on to LDM & GEMPAK Setup

Troubleshooting

Missing MOTIF Libraries

Any error messages involving missing Xm files (such as Xm/XmAll.h):

> ...include/geminc.h:59:22: Xm/XmAll.h: No such file or directory
> In file included from /home/gempak/GEMPAK7/include/proto.h:28,
>    from /home/gempak/GEMPAK7/include/gemprm.h:647,

Indicate that openmotif and openmotif-devel were not found on your system. Either the motif libraries are not installed on your system, or the correct location has not been specified to the compiler. If the latter is the case, you will need to edit $NAWIPS/config/Makeinc.linux_gfortran (assuming a linux system using gfortran), where $NA_OS is your system architecture as determined in the Gemenviron configuration file.

Incorrectly sourced Gemenviron/Gemenviron.profile

The runtime error

> [GEMPLT -101]  NOPROC - Nonexistent executable

indicates that your environmental variables are not sourced correctly (type command 'env' to see all envars and make sure the Gemenviron configuration file is edited and sourced as described above).

Error in message queue
> Error in message send = 22
> itype, ichan, nwords,0,65536,3

This runtime error means the message queue is full, which typically occurs when executing GEMPAK programs in batch mode from scripts. To fix, exit GEMPAK and run

cleanup -c

This command will remove existing message queues (the "ipcrm" command is run to remove message queues found with "ipcs"). It will also look for running "gplt" processes and kill them.

Further Support