From atp at piskorski.com  Wed Oct 24 21:00:25 2007
From: atp at piskorski.com (atp at piskorski.com)
Date: Wed, 24 Oct 2007 21:00:25 +0200 (CEST)
Subject: [Rd] R trunk (2.7) build fails with -fpic, needs -fPIC (PR#10372)
Message-ID: <20071024190025.794E6282EFF1@mail.pubhealth.ku.dk>

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/



[Rd] R trunk (2.7) build fails with -fpic, needs -fPIC (PR#10372)
atp at piskorski.com