Re: R-beta: R-0.61.3 with readline]

Peter Dalgaard BSA (p.dalgaard@biostat.ku.dk)
12 May 1998 19:47:54 +0200


To: Jan Kutylowski <janku@ifi.uio.no>
Subject: Re: R-beta: R-0.61.3 with readline]
From: Peter Dalgaard BSA <p.dalgaard@biostat.ku.dk>
In-Reply-To: Jan Kutylowski's message of Tue, 12 May 1998 18:35:06 +0200 (MET DST)
Date: 12 May 1998 19:47:54 +0200

Jan Kutylowski <janku@ifi.uio.no> writes:

> Hi,
> 
> Originally on Solaris I get 
> 
> 	checking for main in -lreadline... no 
> 
> and also 
> 	checking for readline/history.h... no
> 

Um, I think you said that the 1st one gave "yes" first time around???

> You kindly suggests:
> 
> <I bet the problem is that gcc cannot find the include files for
> <readline. [I think so too.] The way to fix that is
> <
> <a) figure out where readline.h is at. Let's say it's in
> </opt/gnu/readline/readline.h 
> 
> My readline.h is in 
> 
> /home/frey/b/janku/lib/sun4/readline
> 
> so I follow your suggestion
> 
> <b) modify the makefile so that while compiling system.c, gcc will look
> <in the relevant directory. That would be: modify src/unix/Makefile so
> <that the relevant lines say
> <
> <system.o:       system.c ../include/Defn.h
> <               $(CC) $(CFLAGS) -I/opt/gnu -c system.c
> <
> 
> I modify Makefile.in (before ./configure) so I have relavant line in my
> Makefile in that directory (after I say distclean and run ./configure again)
> 
> system.o:	system.c ../include/Defn.h
> 		$(CC) $(CFLAGS) -I/home/frey/b/janku/lib/sun4 -c system.c
> 
> 
> Then I say  ./configure again. I expect 'yes' attached to lreadline
> and history.h, but this is _not_ the case. If I compile, than if I recall
> correctly system.c cannot find history.h and I get an error.
> 

? Strange. I would expect ok compile, but no readline functionality at
the end.

> 
> So your suggestion is not sufficient if one starts from the scratch (two 
> 'no' at the outset). 
> 

No. Not surprising.


> After some trials and errors I modify config.site by adding following
> options to C-compiler (gnumake and gcc)
> 
> CFLAGS="-g -L/home/frey/b/janku/lib/sun4/readline -I/home/frey/b/janku/lib/sun4"
> 
> I say make distclean, ./configure again: this time I get yes to 
> the first question (lreadline), no to the second (history.h). I say
> make and get following error:
>
> ++++++++++
> .o optimize.o options.o par.o paste.o plot.o plot3d.o plotmath.o print.o printarray.o printvector.o printutils.o random.o relop.o saveload.o scan.o seq.o sort.o source.o split.o subassign.o subscript.o subset.o summary.o unique.o util.o version.o ../lib/libgraphics.a ../lib/libunix.a ../lib/libappl.a ../lib/libmath.a  -L/usr/openwin/lib -R/usr/openwin/lib -lX11 -lsocket  -lnsl -ldl -lreadline -ltermcap -lm 
> ld: fatal: library -lreadline: not found
> ld: fatal: File processing errors. No output written to R.binary
> make[2]: *** [R.binary] Error 1
> make[2]: Leaving directory `/home/frey/b/janku/lib/sun4/R0613/src/main'
> make[1]: *** [build] Error 2
> make[1]: Leaving directory `/home/frey/b/janku/lib/sun4/R0613/src'
> make: *** [install] Error 2
> vanaheim: R0613>
> +++++++++++
> 
> Why this error? 

This is because the -L/home/frey/b/janku/lib/sun4/readline doesn't
appear on the linking command.

> What should I do to get both YES in the autoconfig step?

First check that you actually *have* readline/history.h...

> 
> I am not a programmer and can get some help locally in principle. 
> 
> Any suggestions?
> 
> A. Jan Kutylowski
> Buskerud College

Probably it isn't easy to persuade autoconf to do the right thing. A
better plan should be this:

Start with a clean source tree

(1)
make acclean # just so there are no config.cache or similar files
             # floating around

(2)
../configure

(3)
edit src/include/Platform.h to contain

#define HAVE_LIBREADLINE 1
#define HAVE_READLINE_HISTORY_H 1

(4)
edit src/unix/Makefile to contain

system.o:       system.c ../include/Defn.h
                $(CC) $(CFLAGS) -I/home/frey/b/janku/lib/sun4/ -c system.c

(5)
edit src/main/Makefile to contain

LIBS=-ldl  -ltermcap -lm -L/home/frey/b/janku/lib/sun4/readline -lreadline

#(not quite sure whether it must go last, and whether that might cause
trouble)

> (P.S. The list is so knowledgeable and I am so ashamed of not meeting
> the expectations of knowing how to include the readline that I take
> permission to send it to your address directly.)

Wrong. It could be useful to many people, so I'm Cc-ing this back
to R-help.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._