[R] install problem -- libg2c

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Sun Sep 26 12:31:28 CEST 1999

Tony Zhang <qz73804 at pegasus.cc.ucf.edu> writes:

> Hi, there
>      I'm totally new to this. I used to use SPLUS, but think maybe
> useful to try R at home.
> But seems it doesn't like me. I got error message says
>             ld: cannot open -lg2c: No such file or directory
>     My OS is openlinux 2.3. I use egcs-2.91.66.  I searched under
> /lib/egcs-2.91.66/ but found no libg2c.a. There's only a libgcc.a.
> Thought maybe g77 people changed its name from g2c to gcc, so I tried to
> change FLIBS in both MkRules and Makeconf.  This didn't work out.
>     My next try is to download egcs-g77 rpm from redhat. This one has
> file libg2c.a. However, it requires GLIBC_2.1 and GLIBC_2.0 (don't know
> why it needs both version). I have glibc from caldera installed
> already,  don't want to mess it up with redhat.
>      My last try is to cry for help at here.  Many thanks to any
> suggestion.

Yes, this is a pain. We've heard it before about openlinux, but didn't
seem to find a solution (or did we?). Some ideas:

Would it work to use f2c as your fortran compiler instead (configure

Are there any *f2c.* files lurking around? I haven't looked at egcs
sources since egcs-2.90.23, but it seems that they actually build
f2c.h and libf2c.a and RedHat renames them g2c to avoid name clashes
with the "real" f2c. 

If you have the install CD handy, perhaps try something like

find  /path/to/RPMS/ -name *.rpm -exec sh -c "rpm -qlp {} | grep [fg]2c"  \; -print

to see what package contains files named something with f2c or g2c.

There was a note from Jack Fenner on how to extract the libg2c.a file
from the RedHat RPM with rpm2cpio which seemed to work for him. He
ended his not with a request for instruction on how to use the
program, so I'm not sure it got tested very thoroughly... Anyways,
here's what he did:

I then encountered the linking same problem as you describe below. The
error message is saying that the compiler can't find the libg2c library,
which is its runtime library.  Apparently the g77 supplied by Caldera is
missing this important piece.  I downloaded egcs-1.1.2-12.i386.rpm from
the Red Hat web site, then did the following to extract and install libg2c:

1) rpm2cpio < egcs-1.1.2-12.i386.rpm > egcs-1.1.2-12.cpio

2) cpio -irv \*libg2c.a < egcs-1.1.2-12.cpio
- when prompted to rename it, I entered libg2c.a.  This created the
libg2c archive in my current directory.

3) mv libg2c.a /usr/lib/gcc-lib/i386-linux/egcs-2.91.66

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at 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 at stat.math.ethz.ch

More information about the R-help mailing list