[R] Fortran linking problems

ripley@stats.ox.ac.uk ripley at stats.ox.ac.uk
Mon Jan 20 08:57:03 CET 2003

Did you build R yourself, or install an rpm?  It looks like your
installation is missing libreadline, and it was there when R was built.
I'm surprised then that R would run, but maybe it is somewhere that the 
standard LD_LIBRARY_PATH does not find.

You need readline and perhaps readline-devel (if it exists)
installed, and they should have been dependencies of the R rpm (if that
is what you used).

I believe that -lreadline is not needed (and this is solved in R-devel),
so you could just edit R_HOME/etc/Makeconf and remove -lreadline (and
-lnurses) from FLIBS.

On Mon, 20 Jan 2003, Angel Lopez-Urrutia wrote:

> In a box running Mandrake 9 with R 1.6.2 I get problems when trying to 
> install packages Matrix and Akima.
> It seems my gcc compiler and fortran do not talk to each other.

> The errors are:
> * Installing *source* package 'Matrix' ...
> checking for gcc... gcc
> checking for C compiler default output... a.out
> checking whether the C compiler works... yes
> checking whether we are cross compiling... no
> checking for suffix of executables...
> checking for suffix of object files... o
> checking whether we are using the GNU C compiler... yes
> checking whether gcc accepts -g... yes
> checking for gcc option to accept ANSI C... none needed
> checking whether we are using the GNU Fortran 77 compiler... yes
> checking whether g77 accepts -g... yes
> checking how to get verbose linking output from g77... -v
> checking for Fortran 77 libraries... -L/usr/local/lib 
> -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2 
> -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2/../../.. -lreadline -ldl 
> -lncurses -lfrtbegin -lg2c -lm -lgcc_s
> checking for dummy main to link with Fortran 77 libraries... unknown
> configure: error: linking to Fortran libraries from C fails
> ERROR: configuration failed for package 'Matrix'

In cases like that, look in config.log.  The error message is terse, 
because it is repeating a test done when R was installed.


> gcc -shared -L/usr/local/lib -o akima.so akima.new.o idbvip.o idcldp.o 
> idgrid.o idlctn.o idpdrv.o idptip.o idptli.o idsfft.o idtang.o idxchg.o 
> tripack.o ttidbs.o  -L/usr/local/lib 
> -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2 
> -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2/../../.. -lreadline -ldl 
> -lncurses -lfrtbegin -lg2c -lm -lgcc_s -L/usr/lib/R/bin -lR
> /usr/bin/ld: cannot find -lreadline
> collect2: ld returned 1 exit status
> make: *** [akima.so] Error 1
> ERROR: compilation failed for package 'akima'

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list