From p.dalgaard at biostat.ku.dk  Thu Oct 25 00:19:13 2007
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Thu, 25 Oct 2007 00:19:13 +0200
Subject: [Rd] R trunk (2.7) build fails with -fpic,
	needs -fPIC (PR#10372)
In-Reply-To: <20071024190025.794E6282EFF1@mail.pubhealth.ku.dk>
References: <20071024190025.794E6282EFF1@mail.pubhealth.ku.dk>
Message-ID: <471FC4E1.6080102@biostat.ku.dk>

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



[Rd] R trunk (2.7) build fails with -fpic, needs -fPIC (PR#10372)
Peter Dalgaard