[GRASS-user] grass-6.4.0RC5 configure problem

   It's been several years since I've used GRASS, but I need to define a
drainage basin and do some hydrological modeling. So I grabbed the tarball,
along with all the pre- and co-requisites. The latter group built and
installed without problems on my Slackware-12.2 system.

   GRASS, however, is being difficult. I run ./configure with these options:

--with-postgres \
--with-sqlite \
--with-cairo \
--with-freetype \
--with-readline \
--with-gdal=/usr/bin/gdal-config \
--with-python=/usr/bin/python-config \
--with-wxwidgets=/usr/bin/wx-config \
--with-includes=/usr/include/ \
--with-libs=/usr/lib/ \
--with-zlib-includes=/usr/include/ \
--with-readline-includes=/usr/include/readline/ \
--with-readline-libs=/usr/lib/ \
--with-jpeg-includes=/usr/include/ \
--with-jpeg-libs=/usr/lib \
--with-tiff-includes=/usr/include/ \
--with-tiff-libs=/usr/lib/ \
--with-png-includes=/usr/include/ \
--with-png-libs=/usr/lib/ \
--with-postgres-includes=/usr/include/postgresql/server/ \
--with-postgres-libs=/usr/lib/postgresql/ \
--with-sqlite-includes=/usr/include \
--with-sqlite-libs=/usr/lib/

and the process fails with this error:

checking whether to use Readline... yes
checking for location of Readline includes... /usr/include/readline/
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for location of Readline library... /usr/lib/
checking for readline in -lreadline... no
configure: error: *** Unable to locate Readline library.

   I specified the DIRS as /usr/lib/ because that's where it's located:

[rshepard@salmo ~]$ locate libreadline
/usr/lib/libreadline.so.4
/usr/lib/libreadline.so.5
/usr/lib/libreadline.so
/usr/lib/libreadline.a
/usr/lib/libreadline.so.4.3
/usr/lib/libreadline.so.5.2

   Why can't configure find the libraries in /usr/lib?

TIA,

Rich

Rich Shepard wrote:

   It's been several years since I've used GRASS, but I need to define a
drainage basin and do some hydrological modeling. So I grabbed the tarball,
along with all the pre- and co-requisites. The latter group built and
installed without problems on my Slackware-12.2 system.

   GRASS, however, is being difficult. I run ./configure with these options:

--with-postgres \
--with-sqlite \
--with-cairo \
--with-freetype \
--with-readline \
--with-gdal=/usr/bin/gdal-config \
--with-python=/usr/bin/python-config \
--with-wxwidgets=/usr/bin/wx-config \
--with-includes=/usr/include/ \
--with-libs=/usr/lib/ \
--with-zlib-includes=/usr/include/ \
--with-readline-includes=/usr/include/readline/ \
--with-readline-libs=/usr/lib/ \
--with-jpeg-includes=/usr/include/ \
--with-jpeg-libs=/usr/lib \
--with-tiff-includes=/usr/include/ \
--with-tiff-libs=/usr/lib/ \
--with-png-includes=/usr/include/ \
--with-png-libs=/usr/lib/ \
--with-postgres-includes=/usr/include/postgresql/server/ \
--with-postgres-libs=/usr/lib/postgresql/ \
--with-sqlite-includes=/usr/include \
--with-sqlite-libs=/usr/lib/

You should never specify /usr/lib or /usr/include; the compiler/linker
will search these directories automatically. Specifying them
explicitly will usually do nothing, but if it makes a difference
(usually with older versions of gcc on platforms where it isn't the
"official" compiler), it will usually make matters worse.

and the process fails with this error:

checking whether to use Readline... yes
checking for location of Readline includes... /usr/include/readline/
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for location of Readline library... /usr/lib/
checking for readline in -lreadline... no
configure: error: *** Unable to locate Readline library.

The most common reason for this error is that readline uses symbols
from the termcap, terminfo or curses libraries, but doesn't list the
library as a dependency, so you get unresolved symbols. You can
confirm this by looking at the end of the config.log file.

Either build your own readline library with complete dependency
information, or build GRASS without readline support. It's only used
by r.mapcalc and r3.mapcalc when reading expressions from stdin, and
if you're entering expressions which are complex enough to warrant
using readline, you would be better off storing them in a text file.

   I specified the DIRS as /usr/lib/ because that's where it's located:

[rshepard@salmo ~]$ locate libreadline
/usr/lib/libreadline.so.4
/usr/lib/libreadline.so.5
/usr/lib/libreadline.so
/usr/lib/libreadline.a
/usr/lib/libreadline.so.4.3
/usr/lib/libreadline.so.5.2

   Why can't configure find the libraries in /usr/lib?

configure detects libraries by attempting to link a test program. If
linking fails, the library is considered "not found", regardless of
why linking failed. It doesn't matter whether the library is entirely
absent or simply non-functional.

--
Glynn Clements <glynn@gclements.plus.com>

On Fri, 6 Nov 2009, Glynn Clements wrote:

You should never specify /usr/lib or /usr/include; the compiler/linker
will search these directories automatically. Specifying them explicitly
will usually do nothing, but if it makes a difference (usually with older
versions of gcc on platforms where it isn't the "official" compiler), it
will usually make matters worse.

Glynn,

   That has always been the case, and I wondered why the grass configure file
specified each of these directories separately. I figured there must be a
reason for that so I added each one. Never did this before unless the
headers and libraries were in non-standard directories.

Thanks,

Rich

On Fri, 6 Nov 2009, kingsley burlinson wrote:

Im not sure, but check which of your 2 readline versions libreadline.so is linked to
libreadline.so.5.2

Kingsley,

   Well, duh! Every now and then there's an old library version (in this case
4.3 from 2006) that is inadvertently left behind or added back when I
restore files from an upgrade. They sit there causing no problem until I
build an application that gets confused.

   That's what heppened here. It happens infrequently enough that I forget
the cause from one time to the next.

Thank you for the reminder,

Rich

On Thu, 5 Nov 2009, Rich Shepard wrote:

It's been several years since I've used GRASS, but I need to define a
drainage basin and do some hydrological modeling. So I grabbed the
tarball, along with all the pre- and co-requisites. The latter group built
and installed without problems on my Slackware-12.2 system.

   I removed the old readline library and re-ran configure without
specifying specific libraries and headers. The config.log shows symbol
errors in libreadline:

configure:7570: checking for location of Readline library
configure:7595: checking for readline in -lreadline
configure:7612: gcc -o conftest -g -O2 -I/usr/include/
-Wl,--export-dynamic -L/usr/lib/ conftest.c -lreadline 1>&5
/usr/lib//libreadline.so: undefined reference to `PC'
/usr/lib//libreadline.so: undefined reference to `Igetflag'
/usr/lib//libreadline.so: undefined reference to `Igetent'
/usr/lib//libreadline.so: undefined reference to `UP'
/usr/lib//libreadline.so: undefined reference to `Iputs'
/usr/lib//libreadline.so: undefined reference to `Igoto'
/usr/lib//libreadline.so: undefined reference to `Igetnum'
/usr/lib//libreadline.so: undefined reference to `BC'
/usr/lib//libreadline.so: undefined reference to `Igetstr'
collect2: ld returned 1 exit status
configure: failed program was:
#line 7601 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply. */
char readline();

   At some time in the distant past I had this happen with another build, but
it's been much too long for me to remember how to fix the problem. Your
continued advice is needed.

Rich

On Fri, Nov 6, 2009 at 3:49 PM, Rich Shepard <rshepard@appl-ecosys.com> wrote:

On Thu, 5 Nov 2009, Rich Shepard wrote:

It's been several years since I've used GRASS, but I need to define a
drainage basin and do some hydrological modeling. So I grabbed the
tarball, along with all the pre- and co-requisites. The latter group built
and installed without problems on my Slackware-12.2 system.

I removed the old readline library and re-ran configure without
specifying specific libraries and headers. The config.log shows symbol
errors in libreadline:

configure:7570: checking for location of Readline library
configure:7595: checking for readline in -lreadline
configure:7612: gcc -o conftest -g -O2 -I/usr/include/
-Wl,--export-dynamic -L/usr/lib/ conftest.c -lreadline 1>&5
/usr/lib//libreadline.so: undefined reference to `PC'
/usr/lib//libreadline.so: undefined reference to `Igetflag'
/usr/lib//libreadline.so: undefined reference to `Igetent'
/usr/lib//libreadline.so: undefined reference to `UP'
/usr/lib//libreadline.so: undefined reference to `Iputs'
/usr/lib//libreadline.so: undefined reference to `Igoto'
/usr/lib//libreadline.so: undefined reference to `Igetnum'
/usr/lib//libreadline.so: undefined reference to `BC'
/usr/lib//libreadline.so: undefined reference to `Igetstr'
collect2: ld returned 1 exit status
configure: failed program was:
#line 7601 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char readline();

At some time in the distant past I had this happen with another build, but
it's been much too long for me to remember how to fix the problem. Your
continued advice is needed.

As Glynn mentioned, readline is only used by r[3].mapcalc *if*
used interactively. My suggestion is to not configure with readline
as I consider it a waste of time.
I use r[3].mapcalc on command line which provides all needed readline
support with the advantage that "history" remembers my commands.
In other cases, I store the command in a text file and run it from
there.

So, just a recommendation to not configure with readline support as
you gain almost nothing.

Markus

On Fri, 6 Nov 2009, Markus Neteler wrote:

As Glynn mentioned, readline is only used by r[3].mapcalc *if* used
interactively. My suggestion is to not configure with readline as I
consider it a waste of time.

Hi Marcus,

   I did build without it. My immediate need is for terrain analyses
(defining watershed boundaries) and hydrologic modeling. I need to look
whether I need SWAT for that and, if so, there's a current interface to
GRASS-6.4.

Thanks,

Rich