autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Library linking problem


From: Dr. David Kirkby
Subject: Library linking problem
Date: Fri, 14 Feb 2003 18:22:25 +0000

I'm trying to do a check to see whether a the GNU Scientific library
is present. I hope to do this by checking for two libraries and two
headers and if all 4 exist, I can assume the installation is not too
broken. 

A problem occurs on one system (Sun SPARCstation 20 running Debian
Linux 3.2, gcc 2.95.4, /bin/sh linked to bash). The configure script
runs okay on another computer which has the gsl libraries installed
(Sun Ultra 80 running Solaris 8, with /bin/sh being Sun's sh. The
script also runs okay on a couple of machines that don't have the
libraries installed. 

On the troublesome computer, the configure script seems to find the
gsl libraries and headers: 


checking for main in -lm... yes
checking for memalign in -lc... yes
checking for cblas_scasum in -lgslcblas... yes
checking for main in -lgsl... yes
<snip>
checking gsl/gsl_sf_ellint.h usability... yes
checking gsl/gsl_sf_ellint.h presence... yes
checking for gsl/gsl_sf_ellint.h... yes
checking gsl/gsl_sf_bessel.h usability... yes
checking gsl/gsl_sf_bessel.h presence... yes
checking for gsl/gsl_sf_bessel.h... yes
checking whether byte ordering is bigendian... yes
checking for int... yes
checking size of int... configure: error: cannot compute sizeof (int),
77
make: *** No targets specified and no makefile found.  Stop.
select: Bad file number

but a check of the size of an integer fails, soon after the libraries
were found. Prior to checking for the libraries the only flags passed
to gcc when compiling conftest.c are -g and -O2. However, after these
libraries have been tested for (and found) the extra options -lgsl
-lgslcblas get added, as one would expect. 

The relavant part of config.log is below. Note that when compling on
lines 4327, 4363 and 4526, the only flags to gcc are -g and -O2.
However, after I had inserted the checks for the librararies, it adds
the flags -lgsl -lgslcblas -lm. 

configure:4297: checking whether byte ordering is bigendian
configure:4327: gcc -c -g -O2  conftest.c >&5
configure:4330: $? = 0
configure:4333: test -s conftest.o
configure:4336: $? = 0
configure:4363: gcc -c -g -O2  conftest.c >&5
configure:4366: $? = 0
configure:4369: test -s conftest.o
configure:4372: $? = 0
configure:4480: result: yes
configure:4499: checking for int
configure:4526: gcc -c -g -O2  conftest.c >&5
configure:4529: $? = 0
configure:4532: test -s conftest.o
configure:4535: $? = 0
configure:4545: result: yes
configure:4548: checking size of int
configure:4826: gcc -o conftest -g -O2   conftest.c -lgsl -lgslcblas
-lm  >&5
configure:4829: $? = 0
configure:4831: ./conftest
./conftest: error while loading shared libraries: libgsl.so.0: cannot
open shared object file: No such file or directory
configure:4834: $? = 127
configure: program exited with status 127
configure: failed program was:
#line 4784 "configure"


It seems to suggested the library libgsl.so.0 is missing. However, has
it not already checked and found that it? The library is in fact in
/usr/local/lib, although it links to another file, which links to
another before the library 

$ ls -l /usr/local/lib/libgsl.so.0
lrwxrwxrwx    1 root     staff          31 Feb 10 00:03
/usr/local/lib/libgsl.so.0 -> ../stow/gsl-1.2/lib/libgsl.so.0

$ ls -l /usr/local/stow/gsl-1.2/lib/libgsl.so.0
lrwxrwxrwx    1 root     staff          15 Feb  9 20:20
/usr/local/stow/gsl-1.2/lib/libgsl.so.0 -> libgsl.so.0.3.0

$ ls -l /usr/local/stow/gsl-1.2/lib/libgsl.so.0.3.0 
-rwxr-xr-x    1 root     staff     5452813 Feb  9 20:20
/usr/local/stow/gsl-1.2/lib/libgsl.so.0.3.0

This is my configure.in (the relavant parts only). Any suggestions
welcome. I've tried playing with the order of checking the two
libraries, adding the 4th option to link another library when checking
with AC_CHECK_LIB ... I seem to be getting nowhere fast. I tried
adding the LDFLAGS optoin on the command line to configure to make it
look in /usr/local/lib, but that failed, but I would have thought it
looked there anyway. 

AC_INIT(atlc, 5.0.0, address@hidden)
AM_INIT_AUTOMAKE(atlc, 5.0.0, address@hidden)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_RANLIB
AC_ISC_POSIX

dnl AC_OUTPUT_COMMANDS([exit])

dnl Checks for libraries.
AC_CHECK_LIB(m,main)
AC_CHECK_LIB(c,memalign, AC_DEFINE(HAVE_MEMALIGN))

gsl_libgsl=1
gsl_libcblas=1
AC_CHECK_LIB(gslcblas,cblas_scasum,,gsl_libcblas=0)
AC_CHECK_LIB(gsl,main,,gsl_libgsl=0)

dnl Checks for header files.

dnl AC_STDC_HEADERS
AC_HAVE_HEADERS(stdio.h math.h errno.h stdlib.h string.h thread.h
pthread.h pthreads.h mpi.h)
gsl_ellint=1
gsl_bessel=1
AC_HAVE_HEADERS(gsl/gsl_sf_ellint.h,,gsl_ellint=0)
AC_HAVE_HEADERS(gsl/gsl_sf_bessel.h,,gsl_bessel=0)

dnl checks for compiler characteristics
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(size_t)


dnl Check for a functioning gsl installation. 

if test $gsl_ellint = 1 && test $gsl_bessel = 1 && test $gsl_libcblas
= 1 && test $gsl_libgsl = 1; then
  AC_DEFINE(HAVE_GSL)
elif test $gsl_ellint = 0 || test $gsl_bessel = 0 || test
$gsl_libcblas = 0 || test $gsl_libgsl = 0; then
  AC_MSG_WARN([To get full functionality you should install the GNU 
  scientific library (gsl) available at http://sources.redhat.com/gsl.
Without
  gsl it will be impossible to evaluate the theoretical impedance of a
coupler
  using \"design_coupler\" or of a stripline using 
  \"usage_create_bmp_for_symmetrical_stripline\". Some self tests will
fail too.
  However, much of the atlc package will work without gsl.])
else                 
dnl some libraries/headers exist, but not all of them. 
  AC_MSG_WARN([Some of the gsl headers and libraries were found, but
  others were not. Since the installation appears to be broken, the
use of
  gsl will be disabled. Without gsl, it will be impossible to evaluate
the 
  theoretical impedance of a coupler using \"design_coupler\" or of a
stripline
  using \"usage_create_bmp_for_symmetrical_stripline\". Some self
tests will 
  fail too. However, much of the atlc package will work without gsl.])
fi

AC_OUTPUT([\
Makefile                                        \
src/Makefile                                    \
src/non_gui/Makefile                            \
src/gui/Makefile                                \
man/Makefile                                    \
man/man1/Makefile                               \
examples/Makefile                               \
tools/Makefile                                  \
tools/src/Makefile                              \
tests/Makefile                                  \
docs/html-docs/Makefile                         \
docs/html-docs/jpgs/Makefile                    \
docs/qex-december-1996/Makefile                 \
docs/theory/Makefile                            \
docs/Makefile                                   ])


-- 
Dr. David Kirkby,
Senior Research Fellow,
Department of Medical Physics,
University College London,
11-20 Capper St, London, WC1E 6JA.
Tel: 020 7679 6408 Fax: 020 7679 6269
Internal telephone: ext 46408
e-mail address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]