2004.10.24 07:37 "[Tiff] [request] add --rpath for jpeg and zlib", by Norihiko Murase

2004.10.24 07:37 "[Tiff] [request] add --rpath for jpeg and zlib", by Norihiko Murase

Hi,

I tried building tiff-3.7.0 under the following environment:

CPU: i386 family
OS: FreeBSD 4.8-RELEASE
Compiler: gcc-2.95.4 (/usr/bin/gcc)

However, the built tools (such as tiffsplit) load the shared libraries jpeg and zlib INCORRECTLY!

% ldd tiff-3.7.0/tools/.libs/tiffsplit
tiff-3.7.0/tools/.libs/tiffsplit:
    libtiff.so.3 => /usr/local/tiff/lib/libtiff.so.3 (0x28067000)
    libz.so => /usr/lib/libz.so (0x280a9000)
    libm.so.2 => /usr/lib/libm.so.2 (0x280b6000)
    libc.so.4 => /usr/lib/libc.so.4 (0x280d1000)

They should have loaded /usr/local/zlib/lib/libz.so, NOT that in /usr/lib.

I did build tiff-3.7.0 in the following method:

[01]% gzip -cd tiff-3.7.0.tar.gz | gtar xf -
[02]% cd tiff-3.7.0
[03]% patch -p1 < ../patch_1
    The patch 'patch_1' is described at
    http://remotesensing.org/pipermail/tiff/2004-October/000620.html
[04]% patch < ../patch_2
    The patch 'patch_2' is described at
    http://remotesensing.org/pipermail/tiff/2004-October/000657.html
[05]% ./configure \
        --prefix=/usr/local/tiff \
        --disable-old-jpeg \
        --with-zlib-include-dir=/usr/local/zlib/include \
        --with-zlib-lib-dir=/usr/local/zlib/lib \
        --with-jpeg-include-dir=/usr/local/jpeg/include \
        --with-jpeg-lib-dir=/usr/local/jpeg/lib
[06]% gmake

# NOTE that I specified the library path for jpeg and zlib.

The tools (such as tiffsplit) built in this method should have loaded

/usr/local/zlib/lib

However, the following libraries are loaded:

/usr/lib/libz.so

as the above result of ldd command tells.

The solution for this problem is to add the --rpath option when you build libtiff.so and the tools.

-L/usr/local/jpeg/lib -Wl,--rpath -Wl,/usr/local/jpeg/lib
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-L/usr/local/zlib/lib -Wl,--rpath -Wl,/usr/local/zlib/lib
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
... -ljpeg -lz -lm -Wl,--rpath -Wl,/usr/local/tiff/lib

P.S. Thank you very much for fixing the bug on the '--disable-old-jpeg' option in the configure script!! :-) :-)

---
Norihiko Murase <skeleten [AT] shillest.net>