Installing dependency libraries for Nagios/Icinga

Nagios and also Icinga require that the GD library is present; libgd in turn requires libpng, libjpeg and FreeType to be there. For reference, here’s how those packages have been compiled on „my“ Solaris 10 5/09 Sparc M4000 system using Sun Studio 12.1.

Overview

All the sources are to be compiled using Sun Studio and everything is to be installed underneath /opt/local. Code should, generally, be compiled with compiler flags (CFLAGS) set to a value, which generate the best performance. Ie.:

CFLAGS="-fast -xtarget=native -xipo=2 -xautopar -zlazyload"

If compiling in a non global zone, Sun Studio is NOT able expand -xtarget=native. Because of that, cc is to be invoked once in the global zone with -xdryrun (or -###), like so:

cc -xtarget=native -###

On this system, it generates the following output:

sudo /zones/race-monitoring/root/root/opt/sunstudio12.1/bin/cc -xtarget=native  -xdryrun
### cc: Note: NLSPATH = /zones/race-monitoring/root/root/opt/sunstudio12.1/prod/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/zones/race-monitoring/root/root/opt/sunstudio12.1/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat
###     command line files and options (expanded):
### -xchip=sparc64vii -xcache=64/64/2:5120/256/10 -xarch=sparcima -xdryrun
usage: cc [ options] files.  Use 'cc -flags' for details

To verify the expansion of -fast, do another -dryrun:

sudo /zones/race-monitoring/root/root/opt/sunstudio12.1/bin/cc -fast  -xdryrun
### cc: Note: NLSPATH = /zones/race-monitoring/root/root/opt/sunstudio12.1/prod/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/zones/race-monitoring/root/root/opt/sunstudio12.1/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat
###     command line files and options (expanded):
### -xO5 -xchip=sparc64vii -xcache=64/64/2:5120/256/10 -xarch=sparcima -xdepend=yes -xmemalign=8s -fsimple=2 -fns=yes -ftrap=%none -xlibmil -xlibmopt -xbuiltin=%all -D__MATHERR_ERRNO_DONTCARE -fsingle -xalias_level=basic -xdryrun
usage: cc [ options] files.  Use 'cc -flags' for details

-fast and -native together:

sudo /zones/race-monitoring/root/root/opt/sunstudio12.1/bin/cc -fast -native -###
### cc: Note: NLSPATH = /zones/race-monitoring/root/root/opt/sunstudio12.1/prod/bin/../lib/locale/%L/LC_MESSAGES/%N.cat:/zones/race-monitoring/root/root/opt/sunstudio12.1/prod/bin/../../lib/locale/%L/LC_MESSAGES/%N.cat
###     command line files and options (expanded):
### -xO5 -xdepend=yes -xmemalign=8s -fsimple=2 -fns=yes -ftrap=%none -xlibmil -xlibmopt -xbuiltin=%all -D__MATHERR_ERRNO_DONTCARE -fsingle -xalias_level=basic -xchip=sparc64vii -xcache=64/64/2:5120/256/10 -xarch=sparcima -#
usage: cc [ options] files.  Use 'cc -flags' for details

libjpeg

src_url=http://www.ijg.org/files/jpegsrc.v7.tar.gz && \
mkdir -p $HOME/src && cd $HOME/src && \
\
(
 if [[ -r $HOME/src/$(basename $src_url) ]];
  then cat $HOME/src/$(basename $src_url)
  else wget -qO- $src_url | tee $HOME/src/$(basename $src_url)
 fi
) | gzcat | tar xf - && \
\
cd jpeg-7 && \
\
CFLAGS="-fast -xtarget=sparc64vii -xarch=sparcima -xchip=sparc64vii -xcache=64/64/2:5120/256/10           -fma=fused -xc99=all -xipo=2 -zlazyload" \
CC=/opt/sunstudio12.1/bin/cc \
PATH=/opt/local/bin:/opt/sunstudio12.1/bin:/export/home/webservd/bin:/usr/sfw/bin:/usr/xpg6/bin:/usr/xpg4/bin:/usr/openwin/bin:/usr/X11/bin:/usr/sfw/bin:/usr/bin:/usr/ucb:/usr/sbin \
LDFLAGS=-R/opt/local/lib \
    ~+/configure --prefix=/opt/local/jpeg-7 && \
\
CFLAGS="-fast -xtarget=sparc64vii -xarch=sparcima -xchip=sparc64vii -xcache=64/64/2:5120/256/10           -fma=fused -xc99=all -xipo=2 -zlazyload" \
CC=/opt/sunstudio12.1/bin/cc \
PATH=/opt/local/bin:/opt/sunstudio12.1/bin:/export/home/webservd/bin:/usr/sfw/bin:/usr/xpg6/bin:/usr/xpg4/bin:/usr/openwin/bin:/usr/X11/bin:/usr/sfw/bin:/usr/bin:/usr/ucb:/usr/sbin \
LDFLAGS=-R/opt/local/lib \
    make all && \
\
    sudo make install

libpng

libpng does NOT compile with the -fast CFLAGS compiler option. On the M4000 system, -fast expands to -xO5 -xchip=sparc64vii -xcache=64/64/2:5120/256/10 -xarch=sparcima -xdepend=yes -xmemalign=8s -fsimple=2 -fns=yes -ftrap=%none -xlibmil -xlibmopt -xbuiltin=%all -D__MATHERR_ERRNO_DONTCARE -fsingle -xalias_level=basic. If -xlibmopt is enabled, make fails with this error message:

libtool: link:  /opt/sunstudio12.1/bin/cc -G -z defs -M .libs/libpng12.so.0.40.0.exp -h libpng12.so.0 -o .libs/libpng12.so.0.40.0  .libs/libpng12_la-png.o .libs/libpng12_la-pngset.o .libs/libpng12_la-pngget.o .libs/libpng12_la-pngrutil.o .libs/libpng12_la-pngtrans.o .libs/libpng12_la-pngwutil.o .libs/libpng12_la-pngread.o .libs/libpng12_la-pngrio.o .libs/libpng12_la-pngwio.o .libs/libpng12_la-pngwrite.o .libs/libpng12_la-pngrtran.o .libs/libpng12_la-pngwtran.o .libs/libpng12_la-pngmem.o .libs/libpng12_la-pngerror.o .libs/libpng12_la-pngpread.o   -R/opt/local/lib -lz -lc   
Undefined                       first referenced
 symbol                             in file
pow                                 .libs/libpng12_la-pngrtran.o
fabs                                .libs/libpng12_la-pngrtran.o
ld: fatal: Symbol referencing errors. No output written to .libs/libpng12.so.0.40.0

Additionally, automatic parallelization for multiple processors via the -xautopar does not work. If enabled, compile fails:

libtool: link:  /opt/sunstudio12.1/bin/cc -G -z defs -M .libs/libpng12.so.0.40.0.exp -h libpng12.so.0 -o .libs/libpng12.so.0.40.0  .libs/libpng12_la-png.o .libs/libpng12_la-pngset.o .libs/libpng12_la-pngget.o .libs/libpng12_la-pngrutil.o .libs/libpng12_la-pngtrans.o .libs/libpng12_la-pngwutil.o .libs/libpng12_la-pngread.o .libs/libpng12_la-pngrio.o .libs/libpng12_la-pngwio.o .libs/libpng12_la-pngwrite.o .libs/libpng12_la-pngrtran.o .libs/libpng12_la-pngwtran.o .libs/libpng12_la-pngmem.o .libs/libpng12_la-pngerror.o .libs/libpng12_la-pngpread.o   -R/opt/local/lib -lz -lm -lc  -xarch=sparcima  
Undefined                       first referenced
 symbol                             in file
__mt_get_next_chunk_invoke_mfunc_once_int_ .libs/libpng12_la-pngset.o
__mt_get_next_chunk_invoke_mfunc_once_ush_ .libs/libpng12_la-pngrtran.o
__mt_MasterFunction_cxt_            .libs/libpng12_la-pngset.o
ld: fatal: Symbol referencing errors. No output written to .libs/libpng12.so.0.40.0

Because of that, CFLAGS has to be set to an expanded value of -fast.

src_url=http://downloads.sourceforge.net/project/libpng/00-libpng-stable/1.2.40/libpng-1.2.40.tar.bz2 && \
mkdir -p $HOME/src && cd $HOME/src && \
(
 if [[ -r $HOME/src/$(basename $src_url) ]];
  then cat $HOME/src/$(basename $src_url)
  else wget -qO- $src_url | tee $HOME/src/$(basename $src_url)
 fi
) | bzcat | tar xf - && \
\
cd $(basename $src_url .tar.bz2) && \
\
CFLAGS="-xO5 -xdepend=yes -xmemalign=8s -fsimple=2 -fns=yes -ftrap=%none -xlibmil -xbuiltin=%all -D__MATHERR_ERRNO_DONTCARE -fsingle -xalias_level=basic -xchip=sparc64vii -xcache=64/64/2:5120/256/10 -xarch=sparcima -xipo=2 -zlazyload" \
CC=/opt/sunstudio12.1/bin/cc \
PATH=/opt/local/bin:/opt/sunstudio12.1/bin:/export/home/webservd/bin:/usr/sfw/bin:/usr/xpg6/bin:/usr/xpg4/bin:/usr/openwin/bin:/usr/X11/bin:/usr/sfw/bin:/usr/bin:/usr/ucb:/usr/sbin \
LDFLAGS=-R/opt/local/lib \
    ~+/configure --prefix=/opt/local/libpng-1.2.40 && \
\
CFLAGS="-xO5 -xdepend=yes -xmemalign=8s -fsimple=2 -fns=yes -ftrap=%none -xlibmil -xbuiltin=%all -D__MATHERR_ERRNO_DONTCARE -fsingle -xalias_level=basic -xchip=sparc64vii -xcache=64/64/2:5120/256/10 -xarch=sparcima -xipo=2 -zlazyload" \
CC=/opt/sunstudio12.1/bin/cc \
PATH=/opt/local/bin:/opt/sunstudio12.1/bin:/export/home/webservd/bin:/usr/sfw/bin:/usr/xpg6/bin:/usr/xpg4/bin:/usr/openwin/bin:/usr/X11/bin:/usr/sfw/bin:/usr/bin:/usr/ucb:/usr/sbin \
LDFLAGS=-R/opt/local/lib \
    make && \
\
    sudo make install

FreeType

Unlike the other packages, FreeType MUST be compiled with GNU make and not the native Sun make.

src_url=http://www.very-clever.com/download/nongnu/freetype/freetype-2.3.9.tar.bz2 && \
mkdir -p $HOME/src && cd $HOME/src && \
(
 if [[ -r $HOME/src/$(basename $src_url) ]];
  then cat $HOME/src/$(basename $src_url)
  else wget -qO- $src_url | tee $HOME/src/$(basename $src_url)
 fi
) | bzcat | tar xf - && \
\
cd $(basename $src_url .tar.bz2) && \
\
CFLAGS="-fast -xtarget=sparc64vii -xarch=sparcima -xchip=sparc64vii -xcache=64/64/2:5120/256/10           -fma=fused           -xipo=2 -zlazyload" \
GNUMAKE=$(which gmake) CC=/opt/sunstudio12.1/bin/cc \
PATH=/opt/local/bin:/opt/sunstudio12.1/bin:/export/home/webservd/bin:/usr/sfw/bin:/usr/xpg6/bin:/usr/xpg4/bin:/usr/openwin/bin:/usr/X11/bin:/usr/sfw/bin:/usr/bin:/usr/ucb:/usr/sbin \
LDFLAGS=-R/opt/local/lib \
    ~+/configure --prefix=/opt/local/freetype-2.3.9 && \
\
CFLAGS="-fast -xtarget=sparc64vii -xarch=sparcima -xchip=sparc64vii -xcache=64/64/2:5120/256/10           -fma=fused           -xipo=2 -zlazyload" \
GNUMAKE=$(which gmake) CC=/opt/sunstudio12.1/bin/cc \
PATH=/opt/local/bin:/opt/sunstudio12.1/bin:/export/home/webservd/bin:/usr/sfw/bin:/usr/xpg6/bin:/usr/xpg4/bin:/usr/openwin/bin:/usr/X11/bin:/usr/sfw/bin:/usr/bin:/usr/ucb:/usr/sbin \
LDFLAGS=-R/opt/local/lib \
    gmake && \
\
    sudo gmake install

GD

src_url=http://www.libgd.org/releases/gd-2.0.35.tar.bz2 && \
mkdir -p $HOME/src && cd $HOME/src && \
(
 if [[ -r $HOME/src/$(basename $src_url) ]];
  then cat $HOME/src/$(basename $src_url)
  else wget -qO- $src_url | tee $HOME/src/$(basename $src_url)
 fi
) | bzcat | tar xf - && \
\
cd $(basename $src_url .tar.bz2) && \
\
CFLAGS="-fast -xtarget=sparc64vii -xarch=sparcima -xchip=sparc64vii -xcache=64/64/2:5120/256/10 -xautopar -fma=fused -xc99=all -xipo=2 -zlazyload" \
CC=/opt/sunstudio12.1/bin/cc CXX=/opt/sunstudio12.1/bin/CC XMKMF=/usr/openwin/bin/xmkmf \
PATH=/opt/sunstudio12.1/bin:/usr/sfw/bin:/usr/xpg6/bin:/usr/xpg4/bin:/usr/openwin/bin:/usr/X11/bin:/usr/bin:/usr/sbin:/usr/ucb \
LDFLAGS='-L/usr/ucblib -R/opt/local/jpeg-7/lib -R/opt/local/libpng-1.2.40/lib -R/opt/local/freetype-2.3.9/lib -R/usr/ucblib' \
    ~+/configure --prefix=/opt/local/gd-2.0.35 \
    --with-jpeg=/opt/local/jpeg-7 --with-png=/opt/local/libpng-1.2.40 --with-freetype=/opt/local/freetype-2.3.9 && \
\
CFLAGS="-fast -xtarget=sparc64vii -xarch=sparcima -xchip=sparc64vii -xcache=64/64/2:5120/256/10 -xautopar -fma=fused -xc99=all -xipo=2 -zlazyload" \
CC=/opt/sunstudio12.1/bin/cc CXX=/opt/sunstudio12.1/bin/CC XMKMF=/usr/openwin/bin/xmkmf \
PATH=/opt/sunstudio12.1/bin:/usr/sfw/bin:/usr/xpg6/bin:/usr/xpg4/bin:/usr/openwin/bin:/usr/X11/bin:/usr/bin:/usr/sbin:/usr/ucb \
LDFLAGS='-L/usr/ucblib -R/opt/local/jpeg-7/lib -R/opt/local/libpng-1.2.40/lib -R/opt/local/freetype-2.3.9/lib -R/usr/ucblib' \
    make all && \
\
    sudo make install

One thought on “Installing dependency libraries for Nagios/Icinga

  1. Pingback: Installing Nagios « Es ist ein Fehler aufgetreten…

Schreibe einen Kommentar

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s