atp at piskorski.com
2007-Oct-24 19:00 UTC
[Rd] R trunk (2.7) build fails with -fpic, needs -fPIC (PR#10372)
On Linux x86-64 (Ubuntu 6.06), the latest R sources from the Subversion trunk fail to build with the following "recompile with -fPIC" error: $ ./configure --with-x=yes --prefix=$inst_dir --enable-R-shlib --with-tcltk=/usr/lib/tcl8.4 --with-tcl-config=/usr/lib/tcl8.4/tclConfig.sh $ make /usr/bin/ld: ../appl/approx.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC ../appl/approx.o: could not read symbols: Bad value This is easy to fix by changing 4 lines in the configure script from "-fpic" to -fPIC", as shown in the patch below. I saw this failure on an Intel x86-64 server, running Ubuntu 6.06: $ uname -srvm Linux 2.6.20.4 #1 SMP PREEMPT Sat Mar 31 07:46:01 EDT 2007 x86_64 $ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=6.06 DISTRIB_CODENAME=dapper DISTRIB_DESCRIPTION="Ubuntu 6.06.1 LTS" $ grep name /proc/cpuinfo model name : Intel(R) Xeon(TM) CPU 3.80GHz model name : Intel(R) Xeon(TM) CPU 3.80GHz $ dpkg -l libc6 ||/ Name Version Description +++-========-====================-================================================ ii libc6 2.3.6-0ubuntu20.4 GNU C Library: Shared libraries and Timezone data $ apt-cache show libc6 | grep Architecture | uniq Architecture: amd64 Here's a patch which fixes the problem: $ svn diff configure Index: configure ==================================================================--- configure (revision 43265) +++ configure (working copy) @@ -32806,7 +32806,7 @@ cpicflags="-fPIC" ;; *) - cpicflags="-fpic" + cpicflags="-fPIC" ;; esac shlib_ldflags="-shared" @@ -32817,7 +32817,7 @@ fpicflags="-fPIC" ;; *) - fpicflags="-fpic" + fpicflags="-fPIC" ;; esac fi @@ -32827,7 +32827,7 @@ cxxpicflags="-fPIC" ;; *) - cxxpicflags="-fpic" + cxxpicflags="-fPIC" ;; esac shlib_cxxldflags="-shared" @@ -47768,7 +47768,7 @@ fcpicflags="-fPIC" ;; *) - fcpicflags="-fpic" + fcpicflags="-fPIC" ;; esac fi -- Andrew Piskorski <atp at piskorski.com> http://www.piskorski.com/
Peter Dalgaard
2007-Oct-24 22:19 UTC
[Rd] R trunk (2.7) build fails with -fpic, needs -fPIC (PR#10372)
atp at piskorski.com wrote:> On Linux x86-64 (Ubuntu 6.06), the latest R sources from the > Subversion trunk fail to build with the following "recompile with > -fPIC" error: > > $ ./configure --with-x=yes --prefix=$inst_dir --enable-R-shlib --with-tcltk=/usr/lib/tcl8.4 --with-tcl-config=/usr/lib/tcl8.4/tclConfig.sh > $ make > > /usr/bin/ld: ../appl/approx.o: relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC > ../appl/approx.o: could not read symbols: Bad value > > This is easy to fix by changing 4 lines in the configure script from > "-fpic" to -fPIC", as shown in the patch below. > > I saw this failure on an Intel x86-64 server, running Ubuntu 6.06: > > $ uname -srvm > Linux 2.6.20.4 #1 SMP PREEMPT Sat Mar 31 07:46:01 EDT 2007 x86_64 > > $ cat /etc/lsb-release > DISTRIB_ID=Ubuntu > DISTRIB_RELEASE=6.06 > DISTRIB_CODENAME=dapper > DISTRIB_DESCRIPTION="Ubuntu 6.06.1 LTS" > > $ grep name /proc/cpuinfo > model name : Intel(R) Xeon(TM) CPU 3.80GHz > model name : Intel(R) Xeon(TM) CPU 3.80GHz > > $ dpkg -l libc6 > ||/ Name Version Description > +++-========-====================-================================================> ii libc6 2.3.6-0ubuntu20.4 GNU C Library: Shared libraries and Timezone data > > $ apt-cache show libc6 | grep Architecture | uniq > Architecture: amd64 > > Here's a patch which fixes the problem: > > > $ svn diff configure > Index: configure > ==================================================================> --- configure (revision 43265) > +++ configure (working copy) > @@ -32806,7 +32806,7 @@ > cpicflags="-fPIC" > ;; > *) > - cpicflags="-fpic" > + cpicflags="-fPIC" > ;; > esac > shlib_ldflags="-shared" > @@ -32817,7 +32817,7 @@ > fpicflags="-fPIC" > ;; > *) > - fpicflags="-fpic" > + fpicflags="-fPIC" > ;; > esac > fi > @@ -32827,7 +32827,7 @@ > cxxpicflags="-fPIC" > ;; > *) > - cxxpicflags="-fpic" > + cxxpicflags="-fPIC" > ;; > esac > shlib_cxxldflags="-shared" > @@ -47768,7 +47768,7 @@ > fcpicflags="-fPIC" > ;; > *) > - fcpicflags="-fpic" > + fcpicflags="-fPIC" > ;; > esac > fi > >Fedora 7 seems perfectly happy with -fpic, and that patch looks unhealthy (for one thing, you shouldn't mess with that script directly, but use autoconf and aclocal on oter source files, for another, you are prescribing that -fPIC is to be used for all architectures. Whic compiler/linker is this? -- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
Andrew Piskorski
2007-Oct-24 23:13 UTC
[Rd] R trunk (2.7) build fails with -fpic, needs -fPIC (PR#10372)
On Thu, Oct 25, 2007 at 12:19:13AM +0200, Peter Dalgaard wrote:> Fedora 7 seems perfectly happy with -fpic,Well, Ubuntu 6.06 x86-64 sure seems to hate it, but all I know about -fpic vs. -fPIC is what I read here: http://gcc.gnu.org/onlinedocs/gcc-4.0.3/gcc/Code-Gen-Options.html#index-fpic-1556 http://gcc.gnu.org/onlinedocs/gcc-4.2.2/gcc/Code-Gen-Options.html#index-fpic-1667> Whic compiler/linker is this?$ gcc --version | grep gcc gcc (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5) $ ld --version | grep ld GNU ld version 2.16.91 20060118 Debian GNU/Linux $ COLUMNS=140 dpkg -l binutils gcc-4.0 +++-==========-=============================-=============================================ii binutils 2.16.1cvs20060117-1ubuntu2.1 The GNU assembler, linker and binary utilities ii gcc-4.0 4.0.3-1ubuntu5 The GNU C compiler -- Andrew Piskorski <atp at piskorski.com> http://www.piskorski.com/
Apparently Analagous Threads
- R-devel/Linux x64/Sun Studio 12: Problem with Matrix
- problem building R 2.9.1 from source on RHEL 4 (x86_64)
- Compiling R on Linux with SunStudio 12.1: "wide-character type" problems
- Compiling libR as a standalone C library for java+jni (-fPIC)
- R-2.3.0 make error