Scientia Plus Conscientia

Thoughts on Science and Nature

Software and install notes

Originally posted: 2013-09-12 | Last updated: 2022-04-16

Software installation and deployment notes

These are my notes for deploying or installing from source some of the software tools I use most often. The instructions are tested on openSUSE Tumbleweed but they are fairly general and will work on almost any other Linux environment. The sections are roughly given in order to satisfy dependencies.

I try write everything as carefully as possible and keep everything updated but in spite of this inconsistencies and errors often find their way into the notes. The open source world moves fast, links change, and build instructions become outdated overnight. When that happens things will not work right away. Think before using these notes and use them with caution. No warranties are given or implied. Have fun compiling!

Some prerequisites

gcc, gcc++, gcc-fortran, make, cmake, hdf5, libtiff, libjpeg, libpng, gd, libcairo, freeglut, freetype, ncurses, blas, readline, libxml, libxml2, Mesa, numpy, flex, python-sip, libusb, giflib, libwebp, libcurl, bison, unixODBC, pango, wxWidgets, sqlite, qt, tcl, tk, motif, libcerf, libzstd, libqt*, xerces.

In openSUSE use zypper from the command line as root. Do not forget to also install the devel files.

General procedure:

Most packages will build using the following general procedure below. It is assumed you are logged in as root and working on a terminal in a suitable directory:
# change to superuser (root):
su root
# change to a suitable build directory
cd /usr/local/src

Then, for every package foo download the tarball (foo.tar.gz):
wget /path/to/site/foo.tar.gz

then uncompress and untar:
tar -xvf foo.tar.gz

and change to the directory in question:
cd foo/

then, in general, for packages based on configure this will work:
./configure
make -j N
make install

but for packages based on ccmake you will have to do this instead:
# create a build subdirectory
mkdir build
# cd to that directory
cd build
# run ccmake
ccmake ..
# review options …
make -j N
make install
ldconfig

Often this is just enough to have installed the package in your system. Sometimes though, you will need to run ldconfig to update library links.

It may also be important to ensure that pkg-config (or pkgconf) is aware that /usr/lib/pkgconfig and /usr/lib64/pkgconfig are paths where *.pc files are to be found:
# first check that $PKG_CONFIG_PATH is defined and contains those paths:
echo $PKG_CONFIG_PATH
# if that variable is empty, define it:
export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig
# if it is useful to have this permanently defined, add the line to /etc/bash.bashrc.local

If you are using a multicore system, it is advantageous to use the -j flag in make. This forces to use the multiple cores in parallel and the building process goes much faster. Specify the number of cores after the flag, for example, for an eight (8) core processor:
make -j 8

Below I simply state -j N in the examples. Just replace N with the number of cores in your system.

NetCDF

https://www.unidata.ucar.edu/software/netcdf/


./configure CC=gcc FC=gfortran F90=gfortran F77=gfortran CPPFLAGS=-DpgiFortran –with-pic
make -j N
make check
make install

Build notes: it is convenient to install F90 support. –with-pic is mandatory in 64 bit systems for GDAL compatibility.

GEOS

https://libgeos.org/

./configure
make -j N
make install

Proj

https://proj.org/

mkdir build
cd build
ccmake ..
# review options
# generate build script
make -j N
make install

gnuplot

http://www.gnuplot.info/

./configure
make -j N
make check
make install

libgeotiff

https://github.com/OSGeo/libgeotiff

./configure
make -j N
make install

openJPEG

http://www.openjpeg.org/

mkdir build
cd build
ccmake ..
# review options
# generate build script
make -j N
make install

FFTW

http://www.fftw.org/

./configure –with-pic
make -j N
make install

ImageMagick

https://imagemagick.org/

The most recent release is always here: https://www.imagemagick.org/download/ImageMagick.tar.gz

./configure –with-perl –with-fftw
# FFTW must have been compiled with –with-pic
make -j N
make check
make install

GSL – GNU Scientific Library

https://www.gnu.org/software/gsl/

./configure
make -j N
make check
make install

Spatialite

http://www.gaia-gis.it/gaia-sins/

Build notes: first install SQLite, freexl, and librttopo, then proceed with libspatialite:

./configure –enable-libxml2
make -j N
make install

# then continue with these packages (some are old and may not compile, most important is spatialite-tools):
# readosm (https://www.gaia-gis.it/fossil/readosm/index)
# librasterlite2 (https://www.gaia-gis.it/fossil/librasterlite2/index)
# spatialite-tools (https://www.gaia-gis.it/fossil/spatialite-tools/index)
# libgaiagraphics (https://www.gaia-gis.it/fossil/libgaiagraphics/index)
# spatialite_gui (https://www.gaia-gis.it/fossil/spatialite_gui/index)
# for all these use:
./configure
make -j N
make install

GDAL

https://gdal.org/

./configure –with-spatialite=yes
make -j N
make install

Build notes: for use from Perl install from CPAN the module Geo::GDAL::FFI.

GRASS GIS

https://grass.osgeo.org/

Build notes: the GRASS GUI needs python wxWidgets bindings.

./configure –enable-shared –with-odbc –with-fftw –with-readline –with-proj-share=/usr/local/share/proj –enable-largefile –with-freetype –with-freetype-includes=/usr/include/freetype2 –with-sqlite –with-geos –with-netcdf –with-blas
make -j N
make install

GPSBabel

https://www.gpsbabel.org/

# Install libusb, pay attention to include the libusb-config and libusb-compat-devel packages.

./configure
make -j N
make install

# To use in openSUSE, first disable the garmin_gps kernel module, logged as root:

rmmod garmin_gps

QGIS

https://www.qgis.org/

# after getting and untarring the sources make new build directory
mkdir build
# change directory
cd /build
ccmake ..
# review options
# generate build script
make -j N
make install
ldconfig

Build notes: I normally find useful to disable “pedantic” and “tests”. Pay attention to the many requirements (with devel files): libwebkit, python-qt, qwt, libspatialindex, scintilla, qtwebkit, qjson, etc. Also several python modules, as psycopg2, GDAL, etc. The QGIS ccmake has sometimes difficulties finding libraries like qwt and qca. These libraries are often found in directories not included in the standard library path and must be given explicitly. It is always a good exercise to check with find, where these are. For example, in openSUSE these two are often found in:
QCA_INCLUDE_DIR = /usr/include/qt5/Qca-qt5/QtCrypto
QWT_INCLUDE_DIR = /usr/include/qt5/qwt6/ (for qwt6)

GMT – Generic Mapping Tools

https://www.generic-mapping-tools.org/

When you get the sources get also the support data: country polygons (dcw) and coastlines (gshhg). These are tarred and gzipped files. Just place them in a suitable folder. For this I use dedicated folders under /usr/local/share.

# after getting and untarring the sources make new build directory
mkdir build
# change directory
cd /build
# Run ccmake and make any change you need, particularly indicate where GSHHG and DCW are located
ccmake ..
make -j N
make install
ldconfig

Perl

https://www.perl.org/

If you use Linux you will see that Perl comes already installed as part of the system. If you use Perl as a language for your scripting it is a good idea not to mess with the system’s installation and get the last available version apart for your own use.

I use the following folder:
/usr/local/perls/perl-X.X.X

The installation procedure then goes like this:
./Configure -des -Dprefix=/usr/local/perls/perl-X.X.X
make -j N
make test
make install

I then make symbolic links of the content of the local bin directory:
ln -s /usr/local/perls/perl-X.X.X/bin/* /usr/local/bin

But if an older version is present I first delete the old links:
cd /usr/local/bin
find ./ -lname *perls/perl-X.XX.X* -delete

R

https://www.r-project.org//

./configure
make -j N
make install

Build notes: to install packages proceed from the command line use the command install.packages().

Maxima

http://maxima.sourceforge.net/

I used Maxima a lot in the past and always wanted the latest. Now it suffices for me to install it using zypper. In any case, this should still work:

# requires lisp
./configure
make -j N
make install

LaTeX

https://www.latex-project.org/

I prefer to install LaTeX using zypper. In Linux it is called TeX Live. It is a huge collection of files, more than 2300!

Stellarium

http://stellarium.org/

# after getting and untarring the sources make new build directory
mkdir build
# change directory
cd /build
# Run ccmake and make any change you need, perhaps you want to disable some of the plugins
ccmake ..
make -j N
make install
ldconfig

Archive of older notes

What follows are some older instructions for packages I do not longer use often. I have long ago replaced PostgreSQL/PostGIS with SQLite/Spatialite or GeoPackage in my local workflows. I keep the notes as a reminder because the installation procedure is (or was) a bit involved. Please note that instructions below will probably not work right away today.

PostgreSQL

http://www.postgresql.org

./configure –with-perl –with-python
gmake
useradd postgres -p postgres # simple password: postgres
# make sure that the home directory for user
# postgres is where you put the data
chown -R postgres /usr/local/src/postgresql-X.X.X
su postgres
gmake check
exit (su root)
gmake install

# add to /etc/bash.bashrc.local:
export PATH=$PATH:/usr/local/pgsql/bin
# add to /etc/bash.bashrc.local:
export MANPATH=$MANPATH:/usr/local/pgsql/man
# add to /etc/ld.so.conf
/usr/local/pgsql/lib64

then continue:

ldconfig
mkdir /where/your/pgdata/istobelocated # this should be the default directory
chown postgres /where/your/pgdata/istobelocated
su posgtres
initdb -D /where/your/pgdata/istobelocated
postmaster -D /where/your/pgdata/istobelocated
su root
cp contrib/start-scripts/linux /etc/init.d/postgresql
make /etc/init.d/postgresql executable

# as root, activate postgresql in runtime levels 3 and 5
chkconfig –level 35 postgresql on

# leave configured and built in order to follow with PostGIS
# you might want to keep the configured /src directory to eventually uninstall later

PostGIS

http://www.postgis.net/

mv postgis-X.X.X/ postgresql-X.X.X/contrib/postgis-X.X.X/
./configure –without-raster
make -j N
make install
su postgres
createdb test
# createlang plpgsql test
psql -f postgis/postgis.sql -d test
psql -f spatial_ref_sys.sql -d test

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: