From:             leonard-php-bugs at ottolander dot nl
Operating system: CentOS-4
PHP version:      5.2CVS-2009-07-08 (CVS)
PHP Bug Type:     Compile Failure
Bug description:  Using bundled pcre fails if no unbundled headers are 
available on the system

Description:
------------
Building 5.2.9 on CentOS-4, although later versions until CVS today are
affected. The OS is not really relevant, just the reason there are no
unbundled headers available as there's a version mismatch with the bundled
headers.

Using the bundled pcre library by not supplying any pcre configure
options. When the unbundled (upgraded/matching) headers are available on
the system the build succeeds. However, if no unbundled headers are
available httpd.h cannot find the bundled pcreposix.h (and other headers).

This is *not* an apache issue, the issue is a missing include path in the
build.

If you compare ext/pcre/config0.m4 an include path is provided in case of
an external pcre (although on CentOS it will be found in /usr/include no
matter if a path is specifically provided):

if test "$PHP_PCRE_REGEX" != "no"; then
  if test "$PHP_PCRE_REGEX" = "yes"; then
... (no PHP_ADD_INCLUDE here)
  else
...
    PHP_ADD_INCLUDE($PCRE_INCDIR)
...
  fi

Fix with this patch which provides the include path (ignore the line
wraps, it's just a single line addition):
--- php-5.2.9/ext/pcre/config0.m4.000   2008-12-29 16:27:11.000000000 +0100
+++ php-5.2.9/ext/pcre/config0.m4       2009-07-08 13:27:11.000000000 +0200
@@ -13,6 +13,7 @@ if test "$PHP_PCRE_REGEX" != "no"; then
   if test "$PHP_PCRE_REGEX" = "yes"; then
     PHP_NEW_EXTENSION(pcre, pcrelib/pcre_chartables.c pcrelib/pcre_ucd.c
pcrelib/pcre_compile.c pcrelib/pcre_config.c pcrelib/pcre_exec.c
pcrelib/pcre_fullinfo.c pcrelib/pcre_get.c pcrelib/pcre_globals.c
pcrelib/pcre_info.c pcrelib/pcre_maketables.c pcrelib/pcre_newline.c
pcrelib/pcre_ord2utf8.c pcrelib/pcre_refcount.c pcrelib/pcre_study.c
pcrelib/pcre_tables.c pcrelib/pcre_try_flipped.c pcrelib/pcre_valid_utf8.c
pcrelib/pcre_version.c pcrelib/pcre_xclass.c php_pcre.c,
$ext_shared,,-...@ext_srcdir@/pcrelib)
     PHP_ADD_BUILD_DIR($ext_builddir/pcrelib)
+    PHP_ADD_INCLUDE([$ext_srcdir/pcrelib])
     PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcrelib/])
     AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
   else


Reproduce code:
---------------
Make sure you REMOVE any unbundled pcre headers from the system.
/usr/include is in the include path and thus the necessary unbundled
headers will be found so you wont see the build fail.

Configure without any pcre related options to use the bundled version.


Expected result:
----------------
Headers found, build succeeds. It does with the patch.

Actual result:
--------------
/bin/sh /usr/src/redhat/BUILD/php-5.2.9/build-apache/libtool --silent
--preserve-dup-deps --mode=compile gcc  -I/usr/include/httpd  -DLINUX=2
-D_REENTRANT -D_GNU_SOURCE -I/usr/include/apr-0   -I/usr/include/apr-0 
-Isapi/apache2handler/
-I/usr/src/redhat/BUILD/php-5.2.9/sapi/apache2handler/ -DPHP_ATOM_INC
-I/usr/src/redhat/BUILD/php-5.2.9/build-apache/include
-I/usr/src/redhat/BUILD/php-5.2.9/build-apache/main
-I/usr/src/redhat/BUILD/php-5.2.9 -I/usr/include/libxml2
-I/usr/kerberos/include
-I/usr/src/redhat/BUILD/php-5.2.9/build-apache/ext/date/lib
-I/usr/src/redhat/BUILD/php-5.2.9/ext/date/lib
-I/usr/src/redhat/BUILD/php-5.2.9/build-apache/TSRM
-I/usr/src/redhat/BUILD/php-5.2.9/build-apache/Zend
-I/usr/src/redhat/BUILD/php-5.2.9/main
-I/usr/src/redhat/BUILD/php-5.2.9/Zend
-I/usr/src/redhat/BUILD/php-5.2.9/TSRM
-I/usr/src/redhat/BUILD/php-5.2.9/build-apache/    -I/usr/include -O2 -g
-pipe -m32 -march=i386 -mtune=pentium4 -fno-strict-aliasing  -prefer-pic -c
/usr/src/redhat/BUILD/php-5.2.9/sapi/apache2handler/mod_php5.c -o
sapi/apache2handler/mod_php5.lo 
In file included from
/usr/src/redhat/BUILD/php-5.2.9/sapi/apache2handler/php_apache.h:24,
                 from
/usr/src/redhat/BUILD/php-5.2.9/sapi/apache2handler/mod_php5.c:26:
/usr/include/httpd/httpd.h:43:23: pcreposix.h: No such file or directory
make: *** [sapi/apache2handler/mod_php5.lo] Error 1


-- 
Edit bug report at http://bugs.php.net/?id=48853&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48853&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48853&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48853&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48853&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48853&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48853&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48853&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48853&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48853&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48853&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48853&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48853&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48853&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48853&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48853&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48853&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48853&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48853&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48853&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48853&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48853&r=mysqlcfg

Reply via email to