1999.11.13 01:47 "An easy one-- I hope.", by Thom Farrell

1999.11.13 01:47 "An easy one-- I hope.", by Thom Farrell

Hi!

I think this should be a fairly easy question but for the life of me I cannot find a solution. I have a Solaris 2.6 system that I have built and installed several versions of libtiff in my attempt to solve my woes. I am using GCC 2.8.1. The builds from source go through without error and I have also tried the binary package for Solaris 2.6 from the Solaris Freeware site. In both cases I am running into problems with unresolved references on sqrt, log, and exp when I attempt to use the library. We have some code which was written using tiff-3.30 and we are attempting a recompile as we are replacing a SPARC 1000 (Solaris 2.4) with an Enterprise 450. It's not complicated code but I am having no end of difficulties. The libtiff code section and a sample of the error messages are below. Oddly enough I have been using several other libraries on the same box (both shared and static) without difficulty. I know this post is rather long but I am hoping this provides complete information. Any assistance would greatly appreciated.

Here is a sample of the errors...

gcc renamedpi.o -o renamedpi -I$HOME/libtiff/include -static /opt/gnu/lib/libtiff.a
/opt/gnu/lib/libtiff.a(tif_luv.o): In function `pix16toY':
/afs/jpl.nasa.gov/home/i/imurdock/sparc-sun-solaris2.5/build/tiff-3.4b037/libtiff/../libtiff/tif_luv.c:627: undefined reference to `exp'

/opt/gnu/lib/libtiff.a(tif_luv.o): In function `pix16fromY':
/afs/jpl.nasa.gov/home/i/imurdock/sparc-sun-solaris2.5/build/tiff-3.4b037/libtiff/../libtiff/tif_luv.c:641: undefined reference to `log'

/afs/jpl.nasa.gov/home/i/imurdock/sparc-sun-solaris2.5/build/tiff-3.4b037/libtiff/../libtiff/tif_luv.c:643: undefined reference to `log'

/opt/gnu/lib/libtiff.a(tif_luv.o): In function `L16toGry':
/afs/jpl.nasa.gov/home/i/imurdock/sparc-sun-solaris2.5/build/tiff-3.4b037/libtiff/../libtiff/tif_luv.c:665: undefined reference to `sqrt'

/opt/gnu/lib/libtiff.a(tif_luv.o): In function `XYZtoRGB24':
/afs/jpl.nasa.gov/home/i/imurdock/sparc-sun-solaris2.5/build/tiff-3.4b037/libtiff/../libtiff/tif_luv.c:689: undefined reference to `sqrt'

/afs/jpl.nasa.gov/home/i/imurdock/sparc-sun-solaris2.5/build/tiff-3.4b037/libtiff/../libtiff/tif_luv.c:690: undefined reference to `sqrt'

/afs/jpl.nasa.gov/home/i/imurdock/sparc-sun-solaris2.5/build/tiff-3.4b037/libtiff/../libtiff/tif_luv.c:691: undefined reference to `sqrt'

/opt/gnu/lib/libtiff.a(tif_luv.o): In function `pix24toXYZ':
/afs/jpl.nasa.gov/home/i/imurdock/sparc-sun-solaris2.5/build/tiff-3.4b037/libtiff/../libtiff/tif_luv.c:750: undefined reference to `exp'

/opt/gnu/lib/libtiff.a(tif_luv.o): In function `pix24fromXYZ':
/afs/jpl.nasa.gov/home/i/imurdock/sparc-sun-solaris2.5/build/tiff-3.4b037/libtiff/../libtiff/tif_luv.c:777: undefined reference to `log'

make: *** [renamedpi] Error 1

And the code snippet.....

#include "tiffio.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int GetRes (char *oldname, int *letleg, int *ilen, int *iwid) {

    TIFF *tif;
    int ret = 0;
    int len, wid;
    float res;

    *letleg = LETTER;
    if ((tif = TIFFOpen(oldname, "r"))) {
        if (TIFFGetField(tif, TIFFTAG_XRESOLUTION, &res)) ret = (int)res;

        if ((!TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &len)) ||
            (!TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &wid))) {
            fprintf(stderr, "Required TIFF tag not set for %s\n", oldname);
            ret = -1;
        }

        if ((ret == 0) &&
            (plusminus(len, LET_300_LEN, ((float)LET_300_LEN * 0.10))) &&
            (plusminus(wid, LET_300_WID, ((float)LET_300_LEN * 0.10)))) {
            ret = 300;
        }

        if ((ret == 0) &&
            (plusminus(len, LEG_300_LEN, ((float)LEG_300_LEN * 0.10))) &&
            (plusminus(wid, LEG_300_WID, ((float)LEG_300_LEN * 0.10)))) {
            *letleg = LEGAL;
            ret = 300;
        }

        if ((ret == 0) &&
            (plusminus(len, LET_200_LEN, ((float)LET_200_LEN * 0.10))) &&
            (plusminus(wid, LET_200_WID, ((float)LET_200_LEN * 0.10)))) {
            ret = 200;
        }

        if ((ret == 0) &&
            (plusminus(len, LEG_200_LEN, ((float)LEG_200_LEN * 0.10))) &&
            (plusminus(wid, LEG_200_WID, ((float)LEG_200_LEN * 0.10)))) {
            *letleg = LEGAL;
            ret = 200;
        }

        TIFFClose(tif);
    } else {
        fprintf(stderr, "File %s is not a TIFF image file.\n", oldname);
        ret = -2;
    }

    *ilen = len;
    *iwid = wid;
    return(ret);
}