### Supplemental Libraries for GrADS version 2

There are many supplemental libraries that are required to enable various features in the GrADS executable. Building all these libraries from source is not necessarily easy; this page provides some guidance and suggestions that have led to success on COLA's unix systems (64-bit linux running CentOS, and Mac OSX). COLA's objective in building GrADS is to make our binary releases portable, so we strive to build all the libraries from scratch, disabling features GrADS doesn't need, and then link statically when building GrADS. If you are building GrADS from source but not planning to distribute your build, then you may find that many of these libraries are already installed on your system and you can link with them dynamically. In this case, use the --enable-dyn-supplibs option with the GrADS configure script. Please post questions about building from source to the GrADS Users Forum. If you have the proper privileges, you may install these anywhere on your system instead of $HOME, just be sure to change the commands listed in the table below to accomodate your own installation.

To begin, make a directory top level directory for the supplibs under your $HOME:
mkdir $HOME/supplibs

Make a subdirectory where you will store the tar files containing the library source code:
mkdir -p $HOME/supplibs/src/tarfiles

Get the src from COLA's FTP server:
cd $HOME/supplibs/src/tarfiles
ftp iges.org
<login as anonymous>
cd grads/Supplibs/2.1/src
mget *
quit

These are the directories where you will install the compiled libaries, pkgconfig files, the necessary include files, and any executable utilities from the libraries that GrADS will need:
mkdir $HOME/supplibs/lib
mkdir $HOME/supplibs/lib/pkgconfig
mkdir $HOME/supplibs/include
mkdir $HOME/supplibs/bin

Move through the list of libraries in the table below, building them in order listed. Instructions for configuring and installing in the $HOME/supplibs directory are given for each library. If you are building on Mac OSX 10.6, set the environment variable CFLAGS to "-arch i386". For Mac OSX 10.7, I have used -arch x86_64.

When you are done, unpack the GrADS source code tarball under $HOME. Change into the new GrADS directory you just created, and type ./configure. When the configuration is done, it will show a summary of which features have been enabled. Then type 'make install' and look for your executables in the ./bin directory.

Good Luck!!

Library | Version | Why GrADS needs it | How to configure and install it for GrADS

readline

5.0

Enables command line editing.
Links:
home page
local copy of source code

cd $HOME/supplibs/src/
tar xvfz ./tarfiles/readline-5.0.tar.gz
mkdir readline
cd readline-5.0
./configure --prefix=$HOME/supplibs/src/readline
make ; make install
cp $HOME/supplibs/src/readline/lib/libreadline.a $HOME/supplibs/lib
mkdir -p $HOME/supplibs/include/readline
cp $HOME/supplibs/src/readline/include/readline/*.h $HOME/supplibs/include/readline

ncurses | 5.7 | Required by readline. Links: home page local copy of source code | cd $HOME/supplibs/src/ tar xvfz ./tarfiles/ncurses-5.7.tar.gz mkdir ncurses cd ncurses-5.7 ./configure --prefix=$HOME/supplibs/src/ncurses make ; make install cp $HOME/supplibs/src/ncurses/lib/libncurses.a $HOME/supplibs/lib

zlib

1.2.5

General compression library.
Required by NetCDF et al.
Links:
home page
local copy of source code

cd $HOME/supplibs/src/
tar xvfz ./tarfiles/zlib-1.2.5.tar.gz
mkdir zlib
cd zlib-1.2.5
./configure --prefix=$HOME/supplibs/src/zlib
make ; make install
cp $HOME/supplibs/src/zlib/lib/libz.a $HOME/supplibs/lib
mkdir $HOME/supplibs/include/zlib
cp $HOME/supplibs/src/zlib/include/zlib.h $HOME/supplibs/include/zlib

libpng

1.5.12

PNG reference library.
Links:
home page
local copy of source code

cd $HOME/supplibs/src/
tar xvfz tarfiles/libpng-1.5.12.tar.gz
mkdir libpng
cd libpng-1.5.12
./configure --prefix=$HOME/supplibs/src/libpng
make ; make install
cp $HOME/supplibs/src/libpng/lib/libpng16.a $HOME/supplibs/lib
mkdir $HOME/supplibs/include/libpng16
cp $HOME/supplibs/src/libpng/include/libpng16/*.h $HOME/supplibs/include/libpng16
cp $HOME/supplibs/src/libpng/lib/pkgconfig/libpng16.pc $HOME/supplibs/lib/pkgconfig

Note: The pkgconfig file is required for building cairo

jpeg

6b

Image compression library.
Links:
home page
local copy of source code

cd $HOME/supplibs/src/
tar xvfz tarfiles/jpegsrc.v6b.tar.gz
mkdir -p jpeg/bin/cjpeg
mkdir -p jpeg/man/man1
mkdir jpeg/include
mkdir jpeg/lib
cd jpeg-6b
./configure --prefix=$HOME/supplibs/src/jpeg
make ; make install
cp *.h $HOME/supplibs/src/jpeg/include/
cp libjpeg.a $HOME/supplibs/src/jpeg/lib
cp libjpeg.a $HOME/supplibs/lib

gd

2.0.34

GD Graphics Library.
Requires: zlib, libpng, jpeg
Links:
home page
local copy of source code

cd $HOME/supplibs/src/
tar xvfz tarfiles/gd-2.0.34.tar.gz
mkdir gd
cd gd-2.0.34
./configure \
--with-png=$HOME/supplibs/src/libpng \
--with-jpeg=$HOME/supplibs/src/jpeg \
--prefix=$HOME/supplibs/src/gd
make ; make install
cp $HOME/supplibs/src/gd/lib/libgd.a $HOME/supplibs/lib
mkdir $HOME/supplibs/include/gd
cp $HOME/supplibs/src/gd/include/* $HOME/supplibs/include/gd

jasper | 1.900.1 | For image coding and manipulation Links: home page local copy of source code | cd $HOME/supplibs/src/ tar xvfz tarfiles/jasper-1.900.1.tar.gz mkdir jasper cd jasper-1.900.1 ./configure \ --prefix=$HOME/supplibs/src/jasper \ --with-jpeg=$HOME/supplibs/src/jpeg make ; make install cp $HOME/supplibs/src/jasper/lib/libjasper.a $HOME/supplibs/lib

g2clib

1.4.0

Decodes data in GRIB2 format.
Requires: zlib, png, jasper
Links:
home page
local copy of source code

cd $HOME/supplibs/src/
tar xvfz tarfiles/g2clib-1.4.0.tar.gz
cd g2clib-1.4.0

Note: There is no configure script in this library, so you must edit the makefile to change two lines identified below (INC, CC). Write out $HOME explicitly in the makefile.
INC=-I/usr/include -I$HOME/supplibs/src/jasper/include \
-I$HOME/supplibs/src/libpng -I$HOME/supplibs/src/zlib/include
CC=gcc

make
cp libgrib2c.a $HOME/supplibs/lib/
mkdir $HOME/supplibs/include/grib2c
cp grib2.h $HOME/supplibs/include/grib2c

szip | 2.1 | General purpose lossless compression library. Required by HDF5 Links: home page local copy of source code | cd $HOME/supplibs/src/ tar xvfz tarfiles/szip-2.1.tar.gz mkdir szip cd szip-2.1 ./configure --prefix=$HOME/supplibs/src/szip make ; make install cp $HOME/supplibs/src/szip/lib/libsz.a $HOME/supplibs/lib

udunits

1.11.7

Supports units of physical quantities.
Links:
home page
local copy of source code

cd $HOME/supplibs/src/
tar xvfz ./tarfiles/udunits-1.11.7.tar.gz
ln -sf udunits-1.11.7 udunits
cd udunits/src/
./configure --prefix=$HOME/supplibs/src/udunits
make ; make install
cd ../
cp ./lib/libudunits.a $HOME/supplibs/lib/
mkdir $HOME/supplibs/include/udunits
cp ./include/udunits.h $HOME/supplibs/include/udunits

hdf

4.2r3

Hierarchical Data Format library, version 4. Requires: zlib, udunits, jpeg, szip
Links:
home page
local copy of source code

cd $HOME/supplibs/src/
tar xvfz tarfiles/HDF4.2r3.tar.gz
mkdir hdf
cd HDF4.2r3
./configure --disable-netcdf --disable-fortran \
--with-zlib=$HOME/supplibs/src/zlib \
--with-jpeg=$HOME/supplibs/src/jpeg \
--with-szip=$HOME/supplibs/src/szip \
--prefix=$HOME/supplibs/src/hdf
make ; make install
cp $HOME/supplibs/src/hdf/lib/libdf.a $HOME/supplibs/lib
cp $HOME/supplibs/src/hdf/lib/libmfhdf.a $HOME/supplibs/lib
mkdir $HOME/supplibs/include/hdf
cp $HOME/supplibs/src/hdf/include/*.h $HOME/supplibs/include/hdf

hdf5

1.8.11

(GrADS 2.0.a7+)
Hierarchical Data Format library, version 5. Requires: zlib, szip
Links:
home page
local copy of source code

cd $HOME/supplibs/src/
tar xvfz tarfiles/hdf5-1.8.11.tar.gz
mkdir hdf5
cd hdf5-1.8.11
./configure --disable-fortran \
--with-zlib=$HOME/supplibs/src/zlib \
--with-szlib=$HOME/supplibs/src/szip \
--prefix=$HOME/supplibs/src/hdf5
make ; make install
cp $HOME/supplibs/src/hdf5/lib/libhdf5.a $HOME/supplibs/lib
cp $HOME/supplibs/src/hdf5/lib/libhdf5_hl.a $HOME/supplibs/lib
mkdir $HOME/supplibs/include/hdf5
cp $HOME/supplibs/src/hdf5/include/*.h $HOME/supplibs/include/hdf5/

curl

7.19.6

For enabling OPeNDAP access.
Links:
home page
local copy of source code

cd $HOME/supplibs/src
tar xvfz tarfiles/curl-7.19.6.tar.gz
mkdir curl
cd curl-7.19.6
./configure --without-ssl --without-libidn --enable-static \
--disable-ldap --prefix=$HOME/supplibs/src/curl
make ; make install
cp $HOME/supplibs/src/curl/lib/libcurl.a $HOME/supplibs/lib
cp $HOME/supplibs/src/curl/lib/pkgconfig/libcurl.pc $HOME/supplibs/lib/pkgconfig

netcdf

4.2.1.1

(GrADS 2.0.a8+)
Network Common Data Form library.
Requires hdf5, zlib, szip, curl.
Links:
home page
local copy of source code

cd $HOME/supplibs/src
tar xvfz tarfiles/netcdf-4.2.1.1tar.gz
mkdir netcdf
cd netcdf-4.2.1.1

Note: before running configure, set the following environment variables:
setenv LIBS "-lsz -lm -lrt -lz -ldl -lcurl"
setenv LDFLAGS -L$HOME/supplibs/lib
setenv CPPFLAGS -I$HOME/supplibs/include/hdf5
./configure --disable-f77 --enable-netcdf-4 \
--enable-dap --prefix=$HOME/supplibs/src/netcdf
make ; make install
cp $HOME/supplibs/src/netcdf/lib/libnetcdf.a $HOME/supplibs/lib
mkdir $HOME/supplibs/include/netcdf
cp $HOME/supplibs/src/netcdf/include/netcdf.h $HOME/supplibs/include/netcdf
cp $HOME/supplibs/src/netcdf/bin/nc-config $HOME/supplibs/bin

Note: After the library is built, you can unset the environment variables:
unsetenv LIBS
unsetenv LDFLAGS
unsetenv CPPFLAGS

tiff

3.8.2

(GrADS 2.0.a5+)
Library for storing image data in the Tag Image File Format.
Links:
home page
local copy of source code

cd $HOME/supplibs/src/
tar xvfz tarfiles/tiff-3.8.2.tar.gz
mkdir tiff
cd tiff-3.8.2
./configure --prefix=$HOME/supplibs/src/tiff
make ; make install
cp lib/libtiff.a $HOME/supplibs/lib/
mkdir $HOME/supplibs/include/tiff
cp ./include/*.h $HOME/supplibs/include/tiff

geotiff

1.2.5

(GrADS 2.0.a5+)
Library for reading, and writing georeferenced raster imagery.
Requires: tiff.
Links:
home page
local copy of source code

cd $HOME/supplibs/src/
tar xvfz tarfiles/libgeotiff-1.2.5.tar.gz
mkdir geotiff
cd libgeotiff-1.2.5
./configure --enable-incode-epsg --enable-static \
--with-libtiff=$HOME/supplibs/src/tiff \
--prefix=$HOME/supplibs/src/geotiff
make ; make install
cp $HOME/supplibs/src/geotiff/lib/libgeotiff.a $HOME/supplibs/lib
mkdir $HOME/supplibs/include/geotiff
cp $HOME/supplibs/src/geotiff/include/* $HOME/supplibs/include/geotiff

shapelib | 1.2.10 | (GrADS 2.0.a8+) Enables handling of shapefiles Links: home page local copy of source code | cd $HOME/supplibs/src/ tar xvfz tarfiles/shapelib-1.2.10.tar.gz cd shapelib-1.2.10 make lib cp ./.libs/libshp.a $HOME/supplibs/lib/ mkdir $HOME/supplibs/include/shapelib cp shapefil.h $HOME/supplibs/include/shapelib

pkgconfig

0.23

(GrADS 2.1.a0+)
A helper tool used when compiling applications and libraries. Required for Cairo.
Links:
home page
local copy of source code

cd $HOME/supplibs/src
tar xvfz tarfiles/pkgconfig-0.23.tar.gz
mkdir pkg-config
cd pkg-config-0.23
./configure --prefix=$HOME/supplibs/src/pkg-config
make ; make install
cp $HOME/supplibs/src/pkg-config/bin/pkg-config $HOME/supplibs/bin/
N.B. These environment variables are set AFTER pkg-config is built:
setenv PKG_CONFIG $HOME/supplibs/bin/pkg-config
setenv PKG_CONFIG_PATH $HOME/supplibs/lib/pkgconfig

xml2

2.6.16

An XML parser and toolkit.
Enables OPeNDAP station data access, also used by Cairo library.
Links:
home page
local copy of source code

cd $HOME/supplibs/src
tar xvfz tarfiles/libxml2-2.6.16.tar.gz
mkdir libxml2
cd libxml2-2.6.16
./configure --prefix=$HOME/supplibs/src/libxml2 \
--with-zlib=$HOME/supplibs/src/zlib \
--without-threads --without-iconv --without-iso8859x
make ; make install
cp $HOME/supplibs/src/libxml2/lib/libxml2.a $HOME/supplibs/lib
cp $HOME/supplibs/src/libxml2/lib/pkgconfig/libxml-2.0.pc $HOME/supplibs/lib/pkgconfig

dap

3.7.8

Open-source Project for a Network Data Access Protocol (OPeNDAP).
Requires: xml2, curl.
Links:
home page
local copy of source code

cd $HOME/supplibs/src
tar xvfz tarfiles/libdap-3.7.8.tar.gz
mkdir libdap
cd libdap-3.7.8

N.B. You may need edit configure.ac so it won't use pkg-config to find curl or xml2 (libdap_pkgconfig_libcurl=no and libdap_pkgconfig_libxml2=no) then run autoreconf. This is only necessary if curl is installed someplace else on your system without the special configure options outlined above for building curl. Alternatively, you can set the following environment vars:
setenv PKG_CONFIG $HOME/supplibs/bin/pkg-config
setenv PKG_CONFIG_PATH $HOME/supplibs/lib/pkgconfig

./configure \
--with-xml2=$HOME/supplibs/src/libxml2 \
--with-zlib=$HOME/supplibs/src/zlib \
--with-curl=$HOME/supplibs/src/curl \
--prefix=$HOME/supplibs/src/libdap
make ; make install
cp $HOME/supplibs/src/libdap/lib/libdap.a $HOME/supplibs/lib
cp $HOME/supplibs/src/libdap/lib/libdapclient.a $HOME/supplibs/lib

gadap

2.0

Enables OPeNDAP access of
in situ data.
Requires dap, curl, and xml2.
Links:
local copy of source code

cd $HOME/supplibs/src
tar xvfz tarfiles/gadap-2.0.tar.gz
mkdir gadap
cd gadap-2.0
setenv PATH {$PATH}:{$HOME}/supplibs/src/libdap/bin
./configure --prefix=$HOME/supplibs/src/gadap
make ; make install
cp $HOME/supplibs/src/gadap/lib/libgadap.a $HOME/supplibs/lib/
mkdir $HOME/supplibs/include/gadap
cp $HOME/supplibs/src/gadap/include/*.h $HOME/supplibs/include/gadap

Xrender

0.9.6

(GrADS 2.1.a0+)
A helper tool used when compiling applications and libraries. Required for Cairo.
Links:
home page
local copy of source code

cd $HOME/supplibs/src
tar xvfz tarfiles/libXrender-0.9.6.tar.gz
mkdir libXrender
cd libXrender-0.9.6

N.B. It may be necessary to unset the environment vars PGK_CONFIG and PKG_CONFIG_PATH before configuring libXrender. If so, be sure to reset them before continuing to build the remainder of the libraries.

./configure --prefix=$HOME/supplibs/src/libXrender
make ; make install
cp $HOME/supplibs/src/libXrender/lib/libXrender.a $HOME/supplibs/lib
cp $HOME/supplibs/src/libXrender/lib/pkgconfig/xrender.pc $HOME/supplibs/lib/pkgconfig

pixman

0.28.0

(GrADS 2.1.a0+)
A pixel manipulation library for
X and Cairo.
Links:
home page
local copy of source code

cd $HOME/supplibs/src
tar xvfz tarfiles/pixman-0.28.0.tar.gz
mkdir pixman
cd pixman-0.28.0
./configure --prefix=$HOME/supplibs/src/pixman
make ; make install
cp $HOME/supplibs/src/pixman/lib/libpixman-1.a $HOME/supplibs/lib
cp $HOME/supplibs/src/pixman/lib/pkgconfig/pixman-1.pc $HOME/supplibs/lib/pkgconfig
mkdir $HOME/supplibs/include/pixman-1
cp $HOME/supplibs/src/pixman/include/pixman-1/.h $HOME/supplibs/include/pixman-1/

freetype

2.4.10

(GrADS 2.1.a0+)
A software font engine. Required by Cairo.
Links:
home page
local copy of source code

cd $HOME/supplibs/src
tar xvfz tarfiles/freetype-2.4.10.tar.gz
mkdir freetype
cd freetype-2.4.10
./configure \
--without-fsspec --without-fsref --without-ats --without-bzip2 \
--without-quickdraw-toolbox --without-quickdraw-carbon \
--with-zlib=$HOME/supplibs/src/zlib \
--prefix=$HOME/supplibs/src/freetype
make ; make install
cp $HOME/supplibs/src/freetype/lib/libfreetype.a $HOME/supplibs/lib
cp $HOME/supplibs/src/freetype/lib/pkgconfig/freetype2.pc $HOME/supplibs/lib/pkgconfig
mkdir -p $HOME/supplibs/include/freetype2/freetype/config
cd $HOME/supplibs/include/freetype2
cp $HOME/supplibs/src/freetype/include/freetype/*.h .
cd ./freetype
cp $HOME/supplibs/src/freetype/include/freetype2/freetype/*.h .
cd ./config
cp $HOME/supplibs/src/freetype/include/freetype2/freetype/config/*.h .

fontconfig

2.9.0

(GrADS 2.1.a0+)
A library for configuring and customizing font access. Required by Cairo.
Links:
home page
local copy of source code

cd $HOME/supplibs/src
tar xvfz tarfiles/fontconfig-2.9.0.tar.gz
mkdir fontconfig
cd fontconfig-2.9.0
./configure --enable-libxml2 \
--prefix=$HOME/supplibs/src/fontconfig \
--with-freetype-config=$HOME/supplibs/src/freetype/bin/freetype-config \
--with-add-fonts=/Library/Fonts,/System/Library/Fonts (for mac)
--with-add-fonts=/usr/share/X11/fonts,/usr/share/fonts (for unix)

N.B. After configuration, edit config.h to set USE_ICONV = 0
I don't know of another way to tell it not to use libiconv.
make ; make install
cp $HOME/supplibs/src/fontconfig/lib/libfontconfig.a $HOME/supplibs/lib/
cp $HOME/supplibs/src/fontconfig/lib/pkgconfig/fontconfig.pc \ $HOME/supplibs/lib/pkgconfig
mkdir $HOME/supplibs/include/fontconfig
cp $HOME/supplibs/src/fontconfig/include/fontconfig/*.h \ $HOME/supplibs/include/fontconfig

cairo

1.12.16

(GrADS 2.1.a1+)
A 2D graphics library with support for multiple output devices. Requires pkgconfig, zlib, xml2, libpng, pixman, fontconfig, freetype, and Xrender.
Links:
home page
local copy of source code

cd $HOME/supplibs/src
tar xvf tarfiles/cairo-1.12.16.tar.gz
mkdir cairo
cd cairo-1.12.16
./configure --prefix=$HOME/supplibs/src/cairo \
--enable-xlib=yes \
--enable-xml=yes \
--enable-fc=yes \
--enable-ft=yes \
--enable-xlib-xrender=yes \
--enable-pthread=yes \
--enable-xcb=no \
--enable-qt=no \
--enable-quartz=no \
--enable-win32=no \
--enable-skia=no \
--enable-os2=no \
--enable-beos=no \
--enable-drm=no \
--enable-gl=no
make ; make install
cp $HOME/supplibs/src/cairo/lib/libcairo.a $HOME/supplibs/lib/
cp $HOME/supplibs/src/cairo/lib/pkgconfig/* $HOME/supplibs/lib/pkgconfig/
mkdir $HOME/supplibs/include/cairo/
cp $HOME/supplibs/src/cairo/include/* $HOME/supplibs/include/cairo/