You need to rebuild libpcre with position independent code. The straightforward way to do that is to build or install the libpcre shared objects (e.g. libpcre.so) which are built with -fPIC.
Since the library archive was in /usr/lib/x86_64-linux-gnu, the shared objects might be there also. Try adding -L/usr/lib/x86_64-linux-gnu to LDFLAGS of php. This will also save you from symlinking to /usr.
I'm trying to compile PHP myself as I want to use PHPBrew to switch between multiple versions of PHP.
I already solved a ton of problems in the process, but with this particular one I can't get any further. I'm getting this error message in the make process:
/usr/bin/ld: /usr/libpcre.a(pcre_exec.o): relocation R_X86_64_32S against `_pcre_ucd_stage1' can not be used when making a shared object; recompile with -fPIC
/usr/libpcre.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [libphp5.5.5.la] Fehler 1
I needed to add a symlink from /usr/libpcre.a -> /usr/lib/x86_64-linux-gnu/libpcre.a before, as otherwise he would complain about not beeing able to find libpcre.a.
I also tried to add "EXTRACFLAGS=-fPIC" to make, but it wouldn't change anything. It's the first time I'm compiling something, so I'm not even sure if I get the basics right.
This is under Ubuntu 13.10 (not seeing the same problems on 12.04). This is my PHPBrew command:
phpbrew install 5.5.5 +default+mysql+pdo+apxs2
Wich results in the following configure options being generated: