Opened 11 years ago

Closed 11 years ago

#558 closed defect (fixed)

Flaws in configure script

Reported by: Peter Owned by: Jari Häkkinen
Priority: major Milestone: yat 0.5.5
Component: build Version: 0.5.4
Keywords: Cc:

Description

I have a system with gsl installed in /usr/local/gsl-x86_64/ and boost installed in /usr/local/boost-gcc4.

I try

./configure --with-gsl-prefix=/usr/local/gsl-x86_64/ \
--with-boost=/usr/local/boost-gcc4/
...
configure: WARNING:
        cBLAS not found. The C implementation of Basic Linear Algebra
        Subprograms (cBLAS) library cannot be found. Please make sure
        cBLAS is installed.
configure: WARNING:
        GSL found but not the required version. Please install
        GSL version 1.8 or later
configure: error: in `/home/johanssp/projects/yat-0.5.4':

OK, it doesn't even find libgslcblas. Hm, likely because gsl-config is not used in the search. I try to add the appropriate LDFLAGS

./configure --with-gsl-prefix=/usr/local/gsl-x86_64/ \
--with-boost=/usr/local/boost-gcc4/ LDFLAGS=/usr/local/gsl-x86_64
...
checking for library containing cblas_sdsdot... no
checking for library containing ATL_sdsdot... no
checking for library containing cblas_dswap... -lgslcblas
checking for gsl-config... /usr/local/gsl-x86_64//bin/gsl-config
checking for GSL - version >= 1.8... no
*** Could not run GSL test program, checking why...
*** The test program compiled, but did not run. This usually means
*** that the run-time linker is not finding GSL or finding the wrong
...
checking if std::numeric_limits<>::has_quiet_NaN is true... no
checking if std::numeric_limits<>::has_infinity is true... no

OK, now the linker finds libgslcblas and it also finds libgsl but there is some problem with the runtime linker. But then also the NaN and infinity tests fail. A check in the config.log file reveals that

configure:18859: checking if std::numeric_limits<>::has_quiet_NaN is true
configure:18934: g++ -o conftest   -I/usr/local/boost-gcc4//include/boost-1_34 -L/usr/local/gsl-x86_64/lib/ conftest.cpp -lgslcblas -lm  >&5
configure:18938: $? = 0
configure:18944: ./conftest
./conftest: error while loading shared libraries: libgslcblas.so.0: cannot open shared object file: No such file or directory

so the type tests fail because the runtime linker could not find libgslcblas. Perhaps the type test should occur before testing for libraries?

Next, I tried

./configure --with-gsl-prefix=/usr/local/gsl-x86_64/ \
--with-boost=/usr/local/boost-gcc4/ LDFLAGS=/usr/local/gsl-x86_64 \
LD_LIBRARY_PATH=/usr/local/gsl-x86_64/lib
...
checking for gsl-config... /usr/local/gsl-x86_64//bin/gsl-config
...
configure:   CPPFLAGS=
configure:   AM_CPPFLAGS=-I$(top_srcdir)  -DHAVE_INLINE=1 -DGSL_RANGE_CHECK_OFF 
-DNDEBUG  -I/usr/local/include -I/usr/local/boost-gcc4//include/boost-1_34
configure:   CXXFLAGS=
configure:   AM_CXXFLAGS= -Wall -pedantic -O3 

The problem here is that I get -I/usr/local/include in AM_CPPFLAGS rather while I expected -I/usr/local/gsl-x86_64/include. Why is that? A quick check in the resulting makefile tells that GSL_CFLAGS is -I/usr/local/gsl-x86_64/include. That is funny because GSL_CFLAGS is assigned as:

GSL_CFLAGS=`$GSL_CONFIG --cflags` 

and in configure.ac there is a line

YAT_CPP_ADD_FLAG([CPPFLAGS], [`gsl-config --cflags`])

that is supposed to add the correct value to CPPFLAGS (and downstream propagated to AM_CPPFLAGS).

In summary, I suggest the following:

1) blas detection fails although --with-gsl-prefix is given, but that information is not used to find libgslcblas. I think this is fixed in the trunk, but should we fix it also for 0.5.5?

2) tests for NaN and friends should occur before detection of libraries.

3) GSL fails due to problem that runtime linker cannot find libgsl, although everything compiled/linked with no problems. I think this is a flaw and it is a flaw in m4 macro AX_PATH_GSL that probably should be reported upstream. Especially since there is no problem after the configure. I link the tests with no problem and no need to set LD_LIBRARY_PATH. This is thanks to libtool, which adds appropriate -rpath to the linker.

4) We should clearly use $GSL_CONFIG rather than gsl-config. Hm OK, seems like that has been fixed in pre0.5.5 (r2007).

Thoughts?

Change History (4)

comment:1 Changed 11 years ago by Peter

(In [2040]) refs #558. tests for Nan and infinity now occur before libs tests

comment:2 Changed 11 years ago by Peter

(In [2041]) refs #558. do not test for existence of libgslcblas but rely on gsl test that is more clever in finding the correct location.

comment:3 Changed 11 years ago by Peter

(In [2042]) refs #558. forgot to append -lgslcblas to LIBS in change in r2041

comment:4 Changed 11 years ago by Peter

Resolution: fixed
Status: newclosed

(In [2043]) fixes #558

Replaced GSL runtime test with a link test. I tried to keep the error messages as before, but I pass them through AC_MSG_WARN while some were previously printed from the test program and some were created through echo calls.

Note: See TracTickets for help on using tickets.