From:             
Operating system: FreeBSD 8.2
PHP version:      5.3.8
Package:          PHAR related
Bug Type:         Bug
Bug description:phar extension does not understand --with-pcre-dir

Description:
------------
I am creating a FreeBSD port for the phar extension. FreeBSD has one port
for the core php and one port for each extension.

It seems that phar requires pcre, from the following build output:

===>  Building for php5-phar-5.3.8
/bin/sh
/home/build/ports/nfs/ports/archivers/php5-phar/work/php-5.3.8/ext/phar/libtool
--mode=compile cc  -I.
-I/home/build/ports/nfs/ports/archivers/php5-phar/work/php-5.3.8/ext/phar
-DPHP_ATOM_INC
-I/home/build/ports/nfs/ports/archivers/php5-phar/work/php-5.3.8/ext/phar/include
-I/home/build/ports/nfs/ports/archivers/php5-phar/work/php-5.3.8/ext/phar/main
-I/home/build/ports/nfs/ports/archivers/php5-phar/work/php-5.3.8/ext/phar
-I/usr/local/include/php -I/usr/local/include/php/main
-I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend
-I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib 
-DHAVE_CONFIG_H  -O2 -pipe -march=native -fno-strict-aliasing   -c
/home/build/ports/nfs/ports/archivers/php5-phar/work/php-5.3.8/ext/phar/util.c
-o util.lo
mkdir .libs
 cc -I.
-I/home/build/ports/nfs/ports/archivers/php5-phar/work/php-5.3.8/ext/phar
-DPHP_ATOM_INC
-I/home/build/ports/nfs/ports/archivers/php5-phar/work/php-5.3.8/ext/phar/include
-I/home/build/ports/nfs/ports/archivers/php5-phar/work/php-5.3.8/ext/phar/main
-I/home/build/ports/nfs/ports/archivers/php5-phar/work/php-5.3.8/ext/phar
-I/usr/local/include/php -I/usr/local/include/php/main
-I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend
-I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
-DHAVE_CONFIG_H -O2 -pipe -march=native -fno-strict-aliasing -c
/home/build/ports/nfs/ports/archivers/php5-phar/work/php-5.3.8/ext/phar/util.c
 -fPIC -DPIC -o .libs/util.o
In file included from /usr/local/include/php/ext/spl/spl_iterators.h:27,
                 from /usr/local/include/php/ext/spl/spl_array.h:26,
                 from
/home/build/ports/nfs/ports/archivers/php5-phar/work/php-5.3.8/ext/phar/phar_internal.h:59,
                 from
/home/build/ports/nfs/ports/archivers/php5-phar/work/php-5.3.8/ext/phar/util.c:23:
/usr/local/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such
file or directory
In file included from /usr/local/include/php/ext/spl/spl_iterators.h:27,
                 from /usr/local/include/php/ext/spl/spl_array.h:26,
                 from
/home/build/ports/nfs/ports/archivers/php5-phar/work/php-5.3.8/ext/phar/phar_internal.h:59,
                 from
/home/build/ports/nfs/ports/archivers/php5-phar/work/php-5.3.8/ext/phar/util.c:23:
/usr/local/include/php/ext/pcre/php_pcre.h:37: error: expected '=', ',',
';', 'asm' or '__attribute__' before '*' token
/usr/local/include/php/ext/pcre/php_pcre.h:38: error: expected '=', ',',
';', 'asm' or '__attribute__' before '*' token
/usr/local/include/php/ext/pcre/php_pcre.h:44: error: expected
specifier-qualifier-list before 'pcre'
*** Error code 1
1 error
*** Error code 1

Other extensions, for example zip, handle the required CFLAGS/LDFLAGS for
pcre as follows:

.if ${PHP_MODNAME} == "zip"
CONFIGURE_ARGS+=--enable-zip \
                --with-zlib-dir=/usr \
                --with-pcre-dir=${LOCALBASE}
.endif

For phar, I tried adding the same --with-pcre-dir and it produced the
failing build output above. I had to set CFLAGS and LDFLAGS in environment
as follows:

.if ${PHP_MODNAME} == "phar"
CONFIGURE_ARGS+=--enable-phar
# does not work
#               --with-pcre-dir=${LOCALBASE}
CFLAGS+=        -I${LOCALBASE}/include
LDFLAGS+=       -L${LOCALBASE}/lib
.endif

Grepping php source tree for `with-pcre` reveals that zip extension
mentions it in config.m4 whereas phar extension does not.

I checked current snapshot of 5.3 and it has the same results for grepping
for `with-pcre`.

I tried compiling e.g. the zip extension from php source (not going through
FreeBSD ports system) but even with --with-pcre-dir it would not find
pcre.h. But build of zip does work from FreeBSD ports.

Test script:
---------------
cd ext/phar
phpize
./configure --with-pcre-dir=/usr/local

...
configure: WARNING: unrecognized options: --with-pcre-dir


Expected result:
----------------
--with-pcre-dir sets CFLAGS and LDLFAGS appropriately for phar extension to
build.

Actual result:
--------------
phar build fails when it cannot find pcre.h.

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

Reply via email to