[GRASSLIST:6027] Re: compilation: grass5.0.2

Glynn Clements glynn.clements at virgin.net
Fri Apr 11 14:21:31 EDT 2003


[BTW, it's only r.mapcalc which actually uses readline.]

Buchan Milne wrote:

> > > First of all. Congratulations for grass5.0.2!
> > > 
> > > The ./configure can't find the readline libs.
> > > 
> > > But I had installed grass5.0.0pre with readline and I've got libreadline.a in
> > > /usr/lib and a libreadline.so.4.2 in /lib.
> > > 
> > > Could you help me with this?
> >
> >
> > Failure to detect readline normally occurs because readline requires
> > some other library (e.g. libncurses, libtermcap or libtinfo).
> > Unfortunately, there isn't any obvious way of detecting which
> > additional libraries we should attempt to use.
> >
> > For the time being, you have to either:
> 
> Then why does grass 5.0.0 detect it on the same machine?

5.0.0 also included tried with and without $TERMLIB. Unfortunately,
$TERMLIB was basically some random library which happened to provide
tgetent.

The TERMLIB checks have been completely removed in 5.0.2. This
(gratuitous) dependency was responsible for the Linux binary packages
not working on various Linux distributions, because the binaries
needed libtermcap but not all distributions provided it (or the user
never installed it because none of the vendor's packages require it).

> checking whether to use Readline... yes
> checking for location of Readline includes...
> checking for readline/readline.h... yes
> checking for readline/history.h... yes
> checking for location of Readline library...
> checking for readline in -lreadline... no

Without $TERMLIB

> checking for readline in -lreadline... yes

With $TERMLIB

> Error from config.log in 5.0.2:

> configure:5251: checking for location of Readline library
> configure:5276: checking for readline in -lreadline
> configure:5293: gcc -o conftest -O2 -fomit-frame-pointer -pipe
> - -march=i586 -mcpu
> =pentiumpro     conftest.c -lreadline   1>&5
> /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2.2/../../../libreadline.so:
> undefined reference to `tgetnum'

libreadline needs one of the libraries which access the
termcap/terminfo database. But there's no way to tell which one;
libtermcap, libtinfo, libcurses, libncurses and libtermlib are all
plausible; many systems will have two or more libraries which provide
those functions, with no way to tell exactly which one should be used
(using the wrong one tends to break stuff).

For the time being, --with-readline will only work on systems where
libreadline is a shared library with dependency information, e.g.:

$ ldd /usr/lib/libreadline.so
	libtermcap.so.2 => /lib/libtermcap.so.2 (0x4002c000)
	libc.so.6 => /lib/libc.so.6 (0x40030000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

In the longer term, we need either:

a) an elaborate set of tests, which produces the right answer on
all platforms, both with and without curses (curses may provide these
functions itself, or it may require a specific additional library;
linking against libtermcap when curses wants libtinfo, or vice-versa,
will break things), or

b) one or more configure switches so that the user can choose which
libraries are used; the problem there is dealing with the "bug"
reports when the user picks the wrong one.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-user mailing list