[GRASSLIST:2171] r.in.gdal compile failure

Hi,

I've run into a problem with r.in.gdal while compiling 5.7 on Mac 10.2.8 - the compile links libgdal and I think that this fails to find libtiff and libpng, although these libraries are in /usr/local/lib.

r.in.gdal
gcc -L/usr/local/src/grass57_exp_2004_01_03/dist.powerpc-apple-darwin6.8/lib -L/usr/local/pgsql/lib/ -o /usr/local/src/grass57_exp_2004_01_03/dist.powerpc-apple-darwin6.8/etc/bin/cmd/r.in.gdal OBJ.powerpc-apple-darwin6.8/gbgetsymbol.o OBJ.powerpc-apple-darwin6.8/gdalbridge.o OBJ.powerpc-apple-darwin6.8/main.o -lgrass_gproj -lproj -L/usr/local/lib -lgdal.1.1 -lgrass_gis -lgrass_datetime -lintl -lgrass_I -lgrass_vask -lncurses -L/usr/local/lib -lgdal.1.1 -ldl > -lz
ld: warning can't open dynamic library: libtiff.dylib (checking for undefined symbols may be affected) (No such file or directory, errno = 2)
ld: warning can't open dynamic library: libpng.3.dylib (checking for undefined symbols may be affected) (No such file or directory, errno = 2)

I've tried recompiling gdal (latest cvs snapshot) using the --with-tiff=internal and --with-png=internal to try and get around the failure to find my installed versions but the error still occurs. As far as I can make out, the linker should be checking for the two dylibs in /usr/local/lib and I don't see why it isn't finding them.

As a side issue, the gdal compile requires libjpeg.dylib and I can't get jpeg-6b to produce dynamic libraries. I can get round this by using --with-jpeg=internal in the gdal configure but does anyone know how to build libjpeg.dylib?

Any suggestions?

Thanks,
David

As a side issue, the gdal compile requires libjpeg.dylib and I can't get jpeg-6b to produce dynamic libraries. I can get round this by using --with-jpeg=internal in the gdal configure but does anyone know how to build libjpeg.dylib?

Any suggestions?

There is a patch you can make to get libjpeg dynamic libraries. I don't have the details in my head, but look at my GRASS building intructions page for Mac OS X. The instructions are for GRASS 5.3, but the library build info works for 5.7.

<http://webpages.charter.net/kyngchaos/macosx/grassinstall.html&gt;

-----
William Kyngesburye <kyngchaos@charter.net>
http://webpages.charter.net/kyngchaos/

"I ache, therefore I am. Or in my case - I am, therefore I ache."

- Marvin

Hi everyone,

To answer my own post: I had r.in.gdal failing to compile because it failed to find libtiff and libpng. It turned out that I hadn't installed libpng properly (thanks to William K for notes on that and building libjpeg.dylib).

For libtiff, I had to edit [tiffsrc]/libtiff/Makefile.in - the shared library building command has the install_name hardcoded without a path (lines 216-218):

DARWINdso: ${OBJS}
        ${CC} -dynamiclib -undefined error \
          -install_name libtiff.@DSOSUF@ \

I changed this to:

DARWINdso: ${OBJS}
        ${CC} -dynamiclib -undefined error \
          -install_name /usr/local/lib/libtiff.@DSOSUF@ \

and then recompiled gdal. Now the otool listing shows paths for all the shared libraries:

bash-2.05a$ otool -L /usr/local/lib/libgdal.dylib
/usr/local/lib/libgdal.dylib:
        /usr/local/lib/libgdal.1.dylib (compatibility version 3.0.0, current version 3.9.0)
        /usr/local/lib/libiconv.2.dylib (compatibility version 5.0.0, current version 5.0.0)
        /usr/local/lib/libdl.1.dylib (compatibility version 1.0.0, current version 1.0.0)
        /usr/local/lib/libodbc.1.dylib (compatibility version 2.0.0, current version 2.0.0)
        /usr/local/lib/libjpeg.62.dylib (compatibility version 63.0.0, current version 63.0.0)
        /usr/local/lib/libtiff.dylib (compatibility version 0.0.0, current version 0.0.0)
        /usr/local/lib/libpng.3.dylib (compatibility version 3.0.0, current version 3.0.0)
        /usr/lib/libz.1.1.3.dylib (compatibility version 1.0.0, current version 1.1.3)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 63.0.0)

If this is total gibberish or likely to cause problems down the line, can someone please tell me!

Cheers,
David

On Friday, January 9, 2004, at 07:49 pm, William K wrote:

As a side issue, the gdal compile requires libjpeg.dylib and I can't get jpeg-6b to produce dynamic libraries. I can get round this by using --with-jpeg=internal in the gdal configure but does anyone know how to build libjpeg.dylib?

Any suggestions?

There is a patch you can make to get libjpeg dynamic libraries. I don't have the details in my head, but look at my GRASS building intructions page for Mac OS X. The instructions are for GRASS 5.3, but the library build info works for 5.7.

<http://webpages.charter.net/kyngchaos/macosx/grassinstall.html&gt;

-----
William Kyngesburye <kyngchaos@charter.net>
http://webpages.charter.net/kyngchaos/

"I ache, therefore I am. Or in my case - I am, therefore I ache."

- Marvin

That's strange. I didn't have to do this to libtiff to build gdal (tho I do fix the symlinks - the makefile creates a libtiff.so symlink, oops). Checking with otool, I see libgdal doesn't have a path for libtiff, but I've successfully imported TIFFs in GRASS with gdal.

I notice that you aren't using libgeotiff with gdal. The docs are kinda unclear if TIFF is supported with just libtiff, or if gdal needs geotiff as well. You certainly need it if you want to import georeferenced tiffs.

On Jan 12, 2004, at 9:43 AM, David Orme wrote:

Hi everyone,

To answer my own post: I had r.in.gdal failing to compile because it failed to find libtiff and libpng. It turned out that I hadn't installed libpng properly (thanks to William K for notes on that and building libjpeg.dylib).

For libtiff, I had to edit [tiffsrc]/libtiff/Makefile.in - the shared library building command has the install_name hardcoded without a path (lines 216-218):

DARWINdso: ${OBJS}
        ${CC} -dynamiclib -undefined error \
          -install_name libtiff.@DSOSUF@ \

I changed this to:

DARWINdso: ${OBJS}
        ${CC} -dynamiclib -undefined error \
          -install_name /usr/local/lib/libtiff.@DSOSUF@ \

and then recompiled gdal. Now the otool listing shows paths for all the shared libraries:

bash-2.05a$ otool -L /usr/local/lib/libgdal.dylib
/usr/local/lib/libgdal.dylib:
        /usr/local/lib/libgdal.1.dylib (compatibility version 3.0.0, current version 3.9.0)
        /usr/local/lib/libiconv.2.dylib (compatibility version 5.0.0, current version 5.0.0)
        /usr/local/lib/libdl.1.dylib (compatibility version 1.0.0, current version 1.0.0)
        /usr/local/lib/libodbc.1.dylib (compatibility version 2.0.0, current version 2.0.0)
        /usr/local/lib/libjpeg.62.dylib (compatibility version 63.0.0, current version 63.0.0)
        /usr/local/lib/libtiff.dylib (compatibility version 0.0.0, current version 0.0.0)
        /usr/local/lib/libpng.3.dylib (compatibility version 3.0.0, current version 3.0.0)
        /usr/lib/libz.1.1.3.dylib (compatibility version 1.0.0, current version 1.1.3)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 63.0.0)

If this is total gibberish or likely to cause problems down the line, can someone please tell me!

-----
William Kyngesburye <kyngchaos@charter.net>
http://webpages.charter.net/kyngchaos/

"Those people who most want to rule people are, ipso-facto, those least suited to do it."

- A rule of the universe, from the HitchHiker's Guide to the Galaxy