Building FigureGen Dependencies - StormSurgeLive/asgs GitHub Wiki

Building FigureGen Dependencies

GDAL

Download and build gdal (this example was executed on my desktop machine inside the container generated from the image built by cloud/Dockerfiles/Dockerfile.dev):

cd /work
curl -O https://asgs-static-assets.sfo2.digitaloceanspaces.com/lib/gdal-2.3.1.tar.gz
tar xvzf gdal-2.3.1.tar.gz
cd gdal-2.3.1
./configure --prefix=/work/opt/default
make
make install
gdalinfo --version # smoke test
    GDAL 2.3.1, released 2018/06/22
which gdalinfo 
    /work/opt/default/bin/gdalinfo

The gdal library is optionally used by GMT. I will try to build GMT without it to see if we can get away with it.

GMT

Download and build GMT (this example was executed on my desktop machine inside the container generated from the image built by cloud/Dockerfiles/Dockerfile.dev):

curl -O https://asgs-static-assets.sfo2.digitaloceanspaces.com/lib/gmt-4.5.18-src.tar.bz2
curl -O https://asgs-static-assets.sfo2.digitaloceanspaces.com/lib/gmt-4.5.18-non-gpl-src.tar.bz2
curl -O https://asgs-static-assets.sfo2.digitaloceanspaces.com/lib/gshhg-gmt-2.3.7.tar.gz
tar xvjf gmt-4.5.18-non-gpl-src.tar.bz2
tar xvjf gmt-4.5.18-src.tar.bz2
tar xvzf gshhg-gmt-2.3.7.tar.gz
cd gmt-4.5.18
export GMT_SHAREDIR=/work/gshhg-gmt-2.3.7
./configure --prefix=/work/opt/default --enable-shared --enable-triangle --disable-mex --disable-xgrid --enable-flock
make
make install-gmt
make install-data
which gmtset
    /work/opt/default/bin/gmtset

Ghostscript

Unfortunately, I was unable to successfully build GNU Ghostscript inside the existing container. Here are the commands I used:

curl -O https://asgs-static-assets.sfo2.digitaloceanspaces.com/lib/ghostscript-9.54.0.tar.gz
tar xvzf ghostscript-9.54.0.tar.gz
cd ghostscript-9.54.0
./configure --prefix=/work/opt/default --without-tesseract
make

The compilation ended with the following linking error:

/bin/sh <./obj/ldt.tr
/usr/bin/ld: cannot find -lXext
collect2: error: ld returned 1 exit status
base/unixlink.mak:168: recipe for target 'bin/gs' failed
make: *** [bin/gs] Error 1

It may make more sense to install Ghostscript using a package manager than to download, build, and install manually.

FigureGen

I compared the FigureGen.F90 code in output/cpra_postproc/FigureGen49.F90 with the latest FigureGen49.F90 from Casey Dietrich's website and found some differences.

gfortran -o FigureGen49.x -DNETCDF -I/work/opt/default/include -L/work/opt/default/lib FigureGen49.F90 -lnetcdff -lnetcdf

I have modified the FigureGen49.F90 source code to backport netCDF debugging support (intentionally creates a segmentation fault when encountering a netCDF error so that a stack trace will be generated). Then recompiled as follows:

gfortran -g -fbacktrace -o FigureGen49.x -DNETCDF -DNETCDF_DEBUG -I/work/opt/default/include -L/work/opt/default/lib FigureGen49.F90 -lnetcdff -lnetcdf