Unix Tip: Building and Using Analog on Solaris

By Sandra Henry-Stocker, ITworld.com |  Hardware Add a new comment

Send in your Unix questions today!


See additional Unix tips and tricks



Analog is a free web traffic analysis tool that prepares reports on activity on your web sites, including graphs that summarize hourly, daily, file size file type, visiting site, return codes and numerous other statistics that illustrate how your web sites are being used. I recently compiled and deployed Analog on a couple of Solaris 9 servers. Today's column is a how-to on building Analog and a quick introduction to how it works.



To compile Apache on a Solaris system, you should first grab a copy of the source code. I went to http://www.analog.cx/download.html and downloaded analog-6.0.tar.gz. This command should work on the command line if you have wget installed:



wget http://www.analog.cx/analog-6.0.tar.gz



I then gunzipped and extracted the contents of the downloaded file and attempted to compile the application:
$ gunzip analog-6.0.tar.gz
$ tar xf analog-6.0.tar
$ cd analog-6.0
$ make



My attempt to compile Analog ran into some problems -- notably undefined symbols.

        $ make
        cd src && make
        make[1]: Entering directory `/export/home/henrystocker/analog-6.0/src'
        gcc            -O2      -DUNIX          -c alias.c
        gcc            -O2      -DUNIX          -c analog.c
        gcc            -O2      -DUNIX          -c cache.c
        ... omitted output ...
        Undefined                       first referenced
         symbol                             in file
        gethostbyaddr                       alias.o
        inet_addr                           alias.o
        ld: fatal: Symbol referencing errors. No output written to ../analog
        collect2: ld returned 1 exit status
        make[1]: *** [analog] Error 1
        make[1]: Leaving directory `/export/home/henrystocker/analog-6.0/src'
        make: *** [analog] Error 2

I soon figured out that I needed to make a small change to one of my Makefiles. I made the change with this perl command, adding the network services library after noting that the man pages for the undefined symbols both referenced -lnsl.

        $ cd src
        $ perl -i -p -e "s/LIBS = -lm/LIBS = -lnsl -lm/" Makefile

My LIBS line then looked like this: 

        LIBS = -lnsl -lm (added -lnsl)

After this change, Analog compiled without a hitch: 

        $ cd ..
        $ make
        cd src && make
        make[1]: Entering directory `/export/home/shs/analog-6.0/src'
        gcc            -O2      -DUNIX          -c alias.c
        gcc            -O2      -DUNIX          -c analog.c
        gcc            -O2      -DUNIX          -c cache.c
        ... omitted output ...
        gcc            -O2     -o ../analog alias.o analog.o cache.o dates.o
        globals.o hash.o init.o init2.o input.o macinput.o macstuff.o output.o
        output2.o outcro.o outhtml.o outlatex.o outplain.o outxhtml.o outxml.o
        process.o settings.o sort.o tree.o utils.o win32.o libgd/gd.o
        libgd/gd_io.o libgd/gd_io_file.o libgd/gd_png.o libgd/gdfontf.o
        libgd/gdfonts.o libgd/gdtables.o libpng/png.o libpng/pngerror.o
        libpng/pngmem.o libpng/pngset.o libpng/pngtrans.o libpng/pngwio.o
        libpng/pngwrite.o libpng/pngwtran.o libpng/pngwutil.o pcre/pcre.o
        zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/deflate.o zlib/gzio.o
        zlib/infblock.o zlib/infcodes.o zlib/inffast.o zlib/inflate.o
        zlib/inftrees.o zlib/infutil.o zlib/trees.o zlib/uncompr.o zlib/zutil.o
        unzip/ioapi.o unzip/unzip.o bzip2/bzlib.o bzip2/blocksort.o
        bzip2/compress.o bzip2/crctable.o bzip2/decompress.o bzip2/huffman.o
        bzip2/randtable.o -lnsl -lm
        make[1]: Leaving directory `/export/home/shs/analog-6.0/src'

        $ ls -l analog
        -rwxr-xr-x   1 root     other     577568 Mar 29 19:34 analog

Once Analog was compiled, I moved it into /usr/local/bin (there was no "make install" option) and ran a "make clean" to remove object files. At this point, I had switched over to root.

    Add a comment

    Post a comment using one of these accounts
    Or join now
    At least 6 characters

    Note: Comment will appear soon after you have activated your account.
    Obscene/spam comments will be removed and accounts suspended.
    The information you submit is subject to our Privacy Policy and Terms of Service.

    ITworld LIVE

    Ask a question

    Ask a Question