php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60370 phar extension does not understand --with-pcre-dir
Submitted: 2011-11-24 04:33 UTC Modified: 2018-06-24 04:22 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: a11 at bsdpower dot com Assigned: bishop (profile)
Status: No Feedback Package: PHAR related
PHP Version: 5.3.8 OS: FreeBSD 8.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
49 + 17 = ?
Subscribe to this entry?

 
 [2011-11-24 04:33 UTC] a11 at bsdpower dot com
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-01-08 01:55 UTC] bishop@php.net
-Status: Open +Status: Feedback
 [2018-01-08 01:55 UTC] bishop@php.net
Thanks for working to incorporate phar into FreeBSD. It looks like this may no longer be an issue, as of the archiver/php71-phar port. If this does still occur in current PHP ports (7.1+), can you please supply a complete configure command line, the result of running configure, and the result of running make?
 [2018-01-08 02:03 UTC] bishop@php.net
-Assigned To: +Assigned To: bishop
 [2018-06-24 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 20:01:32 2024 UTC