#68 Compiling io_lib-1.11.0 on 64-bit linux gives warnings

closed-fixed
None
5
2008-02-26
2008-02-21
Dan Blick
No

When compiling on 64-bit Linux (I use Fedora 8), I get lots of warnings during compilation such as:

gcc -g -O2 -L/usr/lib -o srf2fasta srf2fasta.o ../io_lib/libread.a -L/usr/lib -lz -lcurl -lm
/usr/bin/ld: skipping incompatible /usr/lib/libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/libz.a when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/libz.a when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/libcurl.so when searching for -lcurl
/usr/bin/ld: skipping incompatible /usr/lib/libcurl.so when searching for -lcurl
/usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm
/usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm

I have libz installed in /usr/lib64.

I recommend you fix this by adding:

AC_CHECK_LIB(z, compress,
[AC_CHECK_HEADER(zlib.h, [have_libz=yes],
[have_libz="no (requires zlib http://www.gzip.org/zlib/\)"])],
[have_libz="no (requires zlib http://www.gzip.org/zlib/\)"])

I'm attaching a patch I generated with this process:

> cd io_lib
> autoscan .
> cat configure.scan >> configure.in

configure.in was edited to remove redundancies, producing current configure.in

I replaced:

ZLIB_CHECK_CONFIG(,,[have_curl=yes], [have_curl=no])

with

AC_CHECK_LIB(z, compress,
[AC_CHECK_HEADER(zlib.h, [have_libz=yes],
[have_libz="no (requires zlib http://www.gzip.org/zlib/\)"])],
[have_libz="no (requires zlib http://www.gzip.org/zlib/\)"])

This is the way it's done in Cairo, a very well-polished GPL'ed program that also depends on libz.

cf: http://gitweb.freedesktop.org/?p=cairo;a=blob;h=dd233e7b499a1e612426319dd34320fdae99ad7c;hb=70bb2abed04ed25abccbb2d6a5bdc58136701b0a;f=configure.in#l134

> aclocal -I /usr/share/autoconf --install
> sed -i 's/@LIBZ@/-lz/g' progs/Makefile.am
> sed -i 's/@LIBZ@/-lz/g' io_lib-config.in

> autoreconf -f -i

Discussion

  • Dan Blick
    Dan Blick
    2008-02-21

    Patch to fix build process on x64

     
    Attachments
  • James Bonfield
    James Bonfield
    2008-02-25

    • assigned_to: nobody --> peterrice
     
  • James Bonfield
    James Bonfield
    2008-02-25

    Logged In: YES
    user_id=154581
    Originator: NO

    I'm not sure how this fixes things.

    The existing configure script supplies a --with-zlib=<dir> option, so is this not sufficient to use --with-zlib=/usr/lib64 on fedora? Your change appears to remove the ability to point configure to a different zlib implementation.

    I'm also not entirely sure of the wisdom of replacing all the @LIBZ@ links with explicit -lz. Granted it works, but on some compilers (eg Microsoft VC++) it's not -l to link a library. Not that the previous solution would solve that monstosity either, and I avoid it by using MinGW.

    I'm a bit confused why Fedora defaults to 32-bit libraries in /usr/lib. I'm assuming with "-L/usr/lib" the compiler would default to looking in /usr/lib64 instead? (I used Debian which has /usr/lib32, /usr/lib64 and /usr/lib, with the latter two being the same dir via symlinks.) So I think perhaps the correct solution is to make ZLIB_CHECK_CONFIG do a AC_CHECK_LIB before attempting to manually searching with $arg_with /usr/lib and /usr/local/lib. That way if the compiler's default libraries are not /usr/lib it'll work better.

    James

     
  • James Bonfield
    James Bonfield
    2008-02-25

    • assigned_to: peterrice --> jkbonfield
     
  • James Bonfield
    James Bonfield
    2008-02-25

    Logged In: YES
    user_id=154581
    Originator: NO

    Here's a suggested new patch.

    Can you test it please?

    Thanks,

    James
    File Added: patch.txt

     
  • James Bonfield
    James Bonfield
    2008-02-25

    Logged In: YES
    user_id=154581
    Originator: NO

    Here's a suggested new patch.

    Can you test it please?

    Thanks,

    James
    File Added: patch.txt

     
  • James Bonfield
    James Bonfield
    2008-02-25

    Fedora zlib patch

     
    Attachments
  • Dan Blick
    Dan Blick
    2008-02-25

    Logged In: YES
    user_id=1540225
    Originator: YES

    Hi James,

    Your patch (267919) fixed my warning messages. Thanks!

     
  • James Bonfield
    James Bonfield
    2008-02-26

    • status: open --> closed-fixed