[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Library path with AC_CHECK_LIB
From: |
moseley |
Subject: |
Re: Library path with AC_CHECK_LIB |
Date: |
Wed, 11 Jun 2003 08:01:39 -0700 |
User-agent: |
Mutt/1.5.4i |
Hi, I'd like to ask about this again, as I'm waiting to release on this
problem.
The problem is that configure[1] is finding[2] libz and adding it to my
link line[3] but when linking libz is not found.
libz is in /usr/local/lib, but that is not a compiled in path for ld.
%/usr/ccs/bin/ld -V
ld: Software Generation Utilities - Solaris/ELF (3.0)
This is on Solaris 2.6.
# Generated by GNU Autoconf 2.57.
I'm wondering if this is just a single broken machine or if we will have
problems on other Solaris machines.
If I grab conftest.c out of configure and manually compile:
%gcc -o conftest -g -O2 conftest.c -lz -lm || echo "NO!!"
%./conftest
ld.so.1: ./conftest: fatal: libz.so: open failed: No such file or directory
Killed
%ldd conftest
libz.so => (file not found)
libm.so.1 => /usr/lib/libm.so.1
libc.so.1 => /usr/lib/libc.so.1
libdl.so.1 => /usr/lib/libdl.so.1
Is that expected that gcc wouldn't report an error back to configure?
I don't understand what gcc uses to link, but it seems like gcc thinks
/usr/local/lib is a standard search path. But when /usr/ccs/bin/ld is
used to link[3] /usr/local/lib is NOT a standard search path.
Is there something that needs to be done on this Solaris machine to get
the standard search paths in sync? A global LD_LIBRARY_PATH is one way,
but there seems to be arguments against that.
I suppose that check for solaris in [1] below is there to add -R.
%truss -f -t open gcc -o conftest -g -O2 conftest.c -lz -lm
26700: open("/usr/ccs/bin/libz.so", O_RDONLY) Err#2 ENOENT
26700: open("/usr/ccs/bin/libz.a", O_RDONLY) Err#2 ENOENT
26700: open("/usr/ccs/lib/libz.so", O_RDONLY) Err#2 ENOENT
26700: open("/usr/ccs/lib/libz.a", O_RDONLY) Err#2 ENOENT
26700: open("/usr/local/lib/libz.so", O_RDONLY) = 7
Now try with Solaris' ld:
%truss -f -t open /usr/ccs/bin/ld -o conftest conftest.o -lz -lm -lc
28657: open("/dev/zero", O_RDONLY) = 3
28657: open("/usr/lib/libc.so.1", O_RDONLY) = 4
28657: open("/usr/lib/libdl.so.1", O_RDONLY) = 4
28657: open("/usr/platform/SUNW,Ultra-Enterprise/lib/libc_psr.so.1", O_RDONLY)
= 4
28657: open("conftest.o", O_RDONLY) = 3
28657: open("/usr/lib/libld.so.2", O_RDONLY) = 3
28657: open("/dev/zero", O_RDWR) = 3
28657: open("/usr/lib/libelf.so.1", O_RDONLY) = 3
28657: open("/usr/lib/libldstab.so.1", O_RDONLY) = 3
28657: open("/dev/zero", O_RDONLY) = 3
28657: open("conftest", O_RDWR|O_CREAT|O_TRUNC, 0777) = 3
28657: open("conftest.o", O_RDONLY) = 4
28657: open("/usr/ccs/lib/libz.so", O_RDONLY) Err#2 ENOENT
28657: open("/usr/ccs/lib/libz.a", O_RDONLY) Err#2 ENOENT
28657: open("/usr/lib/libz.so", O_RDONLY) Err#2 ENOENT
28657: open("/usr/lib/libz.a", O_RDONLY) Err#2 ENOENT
ld: fatal: library -lz: not found
BTW - Is there a better way to optionally include a library than [1]
below?
Thanks,
[1] ---------
(this is an updated version from my previous post)
Autoconf 2.57
dnl Checks for zlib library. -- from libxml2 configure.in
_cppflags="${CPPFLAGS}"
_ldflags="${LDFLAGS}"
AC_ARG_WITH(zlib,
[ --with-zlib[[=DIR]] use libz in DIR],[
if test "$withval" != "no" -a "$withval" != "yes"; then
Z_DIR=$withval
CPPFLAGS="${CPPFLAGS} -I$withval/include"
LDFLAGS="${LDFLAGS} -L$withval/lib"
fi
])
if test "$with_zlib" = "no"; then
echo "Disabling compression support"
else
AC_CHECK_HEADERS(zlib.h,
AC_CHECK_LIB(z, gzread,[
AC_DEFINE(HAVE_ZLIB,[],[Do we have zlib])
if test "x${Z_DIR}" != "x"; then
Z_CFLAGS="-I${Z_DIR}/include"
Z_LIBS="-L${Z_DIR}/lib -lz"
[case ${host} in
*-*-solaris*)
Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
;;
esac]
else
Z_LIBS="-lz"
fi]))
fi
AC_SUBST(Z_CFLAGS)
AC_SUBST(Z_LIBS)
CPPFLAGS=${_cppflags}
LDFLAGS=${_ldflags}
[2] ------------
configure:11574: checking zlib.h usability
configure:11587: gcc -c -g -O2 conftest.c >&5
configure:11590: $? = 0
configure:11593: test -s conftest.o
configure:11596: $? = 0
configure:11606: result: yes
configure:11610: checking zlib.h presence
configure:11621: gcc -E conftest.c
configure:11627: $? = 0
configure:11646: result: yes
configure:11682: checking for zlib.h
configure:11689: result: yes
configure:11697: checking for gzread in -lz
configure:11728: gcc -o conftest -g -O2 conftest.c -lz -lm >&5
configure:11731: $? = 0
configure:11734: test -s conftest
configure:11737: $? = 0
configure:11749: result: yes
[3] -------------
/usr/ccs/bin/ld -G -h libswish-e.so.2 -o .libs/libswish-e.so.2.0.0 search.lo
swish2.lo swish_words.lo proplimit.lo rank.lo db_read.lo result_sort.lo hash.lo
compress.lo db_native.lo ramdisk.lo check.lo error.lo list.lo mem.lo
swstring.lo docprop.lo metanames.lo headers.lo swish_qsort.lo date_time.lo
double_metaphone.lo stemmer.lo soundex.lo -z allextract
replace/.libs/libreplace.al snowball/.libs/libsnowball.al -z defaultextract
-lz -lm -lc
ld: fatal: library -lz: not found
--
Bill Moseley
address@hidden
- Library path with AC_CHECK_LIB, Bill Moseley, 2003/06/04
- Re: Library path with AC_CHECK_LIB, Assar Westerlund, 2003/06/07
- Re: Library path with AC_CHECK_LIB, moseley, 2003/06/07
- Re: Library path with AC_CHECK_LIB, Assar Westerlund, 2003/06/07
- Re: Library path with AC_CHECK_LIB, Bill Moseley, 2003/06/07
- Re: Library path with AC_CHECK_LIB,
moseley <=
- Re: Library path with AC_CHECK_LIB, Lars Hecking, 2003/06/11
- Re: Library path with AC_CHECK_LIB, Paul Eggert, 2003/06/11
- Re: Library path with AC_CHECK_LIB, Bill Moseley, 2003/06/11