[Rd] How to compile all code with the -fPIC flag? (PR#2601)

ripley@stats.ox.ac.uk ripley@stats.ox.ac.uk
Mon Mar 3 18:29:03 2003


Please do read about BUGS in the R FAQ, and ask on R-devel.  This is a bug 
in your setup, not in R, and R-bugs is not the place to ask for help.

open.o is not part of the non-existent lapack.o!  R uses Lapack.lo
compiled from Lapack.c, *with* -FPIC flags.  The problem is not in R.  
open.o is, I believe, part of libg2c, and it seems that your -lg2c (right
there on the link line) is not relocatable.

I see you are using `2.96'.  (RH8.0 on i386 uses gcc 3.2 on the machine I
just checked.)  I suggest you try a current *released* version of gcc as
on many platforms they do now have a shared libg2c.


On Mon, 3 Mar 2003 nganm@mail.nih.gov wrote:

> Full_Name: Michael Ngan
> Version: R-1.6.2
> OS: Red Hat Linux 8.0, Itanium2
> Submission from: (NULL) (156.40.36.177)
> 
> I trying to compile R-1.6.2 on Red Hat Linux 8.0 running on the Itanium2(IA64)
> platform and encountered the following message:
> 
> make[1]: Entering directory `/home/nganm/R-1.6.2/src/modules/lapack'
> gcc -shared -L/usr/local/lib -o lapack.so  Lapack.lo double.lo  cmplx.lo  
> -lbla
> s -L/usr/local/lib -L/usr/lib/gcc-lib/ia64-redhat-linux/2.96
> -L/usr/lib/gcc-lib/
> ia64-redhat-linux/2.96/../../.. -lreadline -ldl -lncurses -lg2c -lm -lpcre
> -lbz2
>  -lz -lreadline -ldl -lncurses -lm
> /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen
> /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen
> /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen
> /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen
> /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen
> /usr/bin/ld: open.o: @gprel relocation against dynamic symbol f__buflen
> collect2: ld returned 1 exit status
> make[1]: *** [lapack.so] Error 1
> make[1]: Leaving directory `/home/nganm/R-1.6.2/src/modules/lapack'
> make: *** [R] Error 2
> 
> I have traced the problem to be: lapack.o is not compiled with the -fPIC flag,
> but ld is trying to link it with code that is compiled with -fPIC. So, I need to
> get gcc to compile lapack.c with the -fPIC. I don't know where to change the
> Makefile or Makeconf. Please help.

However did you come to that conclusion: the errors are clearly reported 
to be in open.o.

-- 
Brian D. Ripley,                  ripley@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