Re: [pcre-dev] pcre-7.x issue

Top Page

Reply to this message
Author: Philip Hazel
To: Christoph Mende
CC: pcre-dev
Subject: Re: [pcre-dev] pcre-7.x issue
This message is copied to pcre-dev@??? in case anybody on that list
has any comments to add.

On Sun, 15 Jul 2007, Christoph Mende wrote:

> Hi, there is an issue in PCRE 7.x, some libs are not compiled using
> -fPIC, even though this is _required_ on archs like amd64. It seems
> like you've already been contacted about this issue by Simon Cooper
> (who wrote a patch, that's currently used in Gentoo's libpcre package
> for versions 7.1 and 7.2), but answered him, that adding -fPIC makes
> PCRE unportable and that it's not needed on most archs. Former
> statement is not true, 99% of the packages in the Gentoo tree use -fPIC
> and they work wonderfully on 32bit and 64bit, big endian and little
> endian archs which include x86, amd64, ppc{,64}, sparc, alpha, ...

Yes, but they all use gcc. (I am, as it happens, a Gentoo user myself).
The point is that -fPIC is gcc-specific. PCRE is widely used on many
architectures, many operating systems, and with *many compilers*. I have
access to a Solaris box with Sun's compilers installed. As far as I can
tell from the man page, -fPIC is not a valid option for them. Instead,
the man page says:

When building shared dynamic libraries with -xarch=v9 or v9a
on 64-bit Solaris 7, the -xcode=pic13 or -xcode=pic32 option
MUST also be specified.

However, it is of course the case that the "configure" system does check
for gcc. I will see if I can figure out how to make use of this so that
it sets up -fPIC as a default in CFLAGS if and only if gcc is in use. If
this can easily be done, then I will consider including it in 7.3.

But isn't it straightforward just to add CFLAGS=-fPIC ${CFLAGS} to the
building process in Gentoo? What have I missed?


Philip Hazel, University of Cambridge Computing Service.