SV: [R] compilation failed for package

geir.systad@nina.no
Tue, 21 Sep 2004 09:04:49 -0000

Thanks to Roger Bivand, my problem was solved. binutils 2.14 was updatet to
binutils 2.15, as indicated under.

Geir Helge Systad
Norwegian Institute for Nature Research
Arctic Ecology, Polarmilj??senteret, N-9296 Troms??, Norway
Adress aug-04 to feb-05:
Albert Pettersonsvei 13, N-5750 Odda
fax      +47 85 03 82 14
phone    +47 53 64 24 94
mobil    +47 91 63 70 55
E-mail: geir.systad at nina.no Internett: http://www.ninaniku.no

-----Opprinnelig melding-----
Fra:	Roger Bivand [mailto:Roger.Bivand at nhh.no]
Sendt:	ti 21.09.2004 10:20
Til:	Systad, Geir
Kopi:	r-help at stat.math.ethz.ch
Emne:	Re: [R] compilation failed for package
On Mon, 20 Sep 2004 geir.systad at nina.no wrote:

> Hello, I am new to R on Linux (and to LINUX), running a 1.9.1 on a Linux
> MDK10.0. When updating or installing different packages, I get messages
> like this (under), the package doesn't install. Can anyone help me? I
> know this is all to little information, but I don't know were to start.
> I think there is something wrong in how or were the C++ or fortran
> compilator is installed?? Thanks, Geir S.

After some offline exchanges, the problem has been resolved. This Mandrake
10.0 installation had R installed from binary, had gcc 3.4.1, but (most
likely) binutils 2.14 that did not recognise the new --as-needed flag. For
this reason, update.packages() - this was the survival case mentioned in
the post - and install.packages() failed on compilation. The fact that
such a build system is broken is demonstrated by:

$ cat << EOF > hello.c
#include <stdio.h>
int main(void)
{
  printf("Hello World!\n");
  exit(0);
}
EOF
$ gcc -o hello hello.c
/usr/bin/ld: unrecognized option '--as-needed'
/usr/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status

Resolution by updating binutils or installing older gcc-* RPMs instead of
3.4.1.

>
>
> gcc -shared -L/usr/local/lib -o survival.so agexact.o agfit2.o agfit3.o
agfit5.o agfit_null.o agmart2.o agmart.o agscore.o agsurv1.o agsurv2.o agsurv3.o
char_date.o chinv2.o chinv3.o cholesky2.o cholesky3.o chsolve2.o chsolve3.o
coxdetail.o coxfit2.o coxfit5.o coxmart.o coxph_wtest.o cox_Rcallback.o
coxscho.o coxscore.o dmatrix.o doloop.o pyears1.o pyears2.o pyears3.o pystep.o
surv_callback.o survdiff2.o survfit2.o survfit3.o survindex2.o survindex3.o
survreg2.o survreg3.o survreg4.o survreg5.o
> /usr/bin/ld: unrecognized option '--as-needed'
> /usr/bin/ld: use the --help option for usage information
> collect2: ld returned 1 exit status
> make: *** [survival.so] Error 1
> ERROR: compilation failed for package 'survival'
> ** Removing '/usr/lib/R/library/survival'
> ** Restoring previous '/usr/lib/R/library/survival'
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>

--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no