Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCRE issue when installing mongodb #1405

Closed
theofidry opened this issue Mar 28, 2023 · 3 comments
Closed

PCRE issue when installing mongodb #1405

theofidry opened this issue Mar 28, 2023 · 3 comments
Assignees

Comments

@theofidry
Copy link

Bug Report

I've trying to install the mongodb extension with https://github.com/phpbrew/phpbrew:

$ phpbrew ext install mongodb

But it currently fails with:

...
In file included from /Users/tfidry/.phpbrew/build/php-8.1.17/ext/mongodb/src/MongoDB/Cursor.c:18:
In file included from /Users/tfidry/.phpbrew/php/php-8.1.17/include/php/ext/spl/spl_iterators.h:22:
/Users/tfidry/.phpbrew/php/php-8.1.17/include/php/ext/pcre/php_pcre.h:23:10: fatal error: 'pcre2.h' file not found
#include "pcre2.h"
         ^~~~~~~~~
1 error generated.
gmake: *** [Makefile:994: src/MongoDB/Cursor.lo] Error 1
gmake: Leaving directory '/Users/tfidry/.phpbrew/build/php-8.1.17/ext/mongodb'

I find the error curious because my PHP binary does work correctly and the pcre extension is listed in php -m.

Note that the PHP binary was compiled with '--with-external-pcre=/opt/homebrew/opt/pcre2'. Maybe it's not the best way neither I'm not sure...

So currently I do not know if the issue is with the way PCRE is compiled with the PHP binary and does not work for PHP alone or if the way the mongodb extensions tries to detect PCRE fails.

Environment

OSX 11.6 M1
PHP 8.1.17

@alcaeus
Copy link
Member

alcaeus commented Mar 28, 2023

I haven't had time to dig into this, but I've been compiling the extension with CFLAGS=-I/opt/homebrew/include for a while now. Does this happen for any other extensions that make use of pcre2.h or just ours?

@alcaeus alcaeus self-assigned this Mar 28, 2023
@theofidry
Copy link
Author

Does this happen for any other extensions that make use of pcre2.h or just ours?

I have no idea honestly.

Part of the issue I guess is I'm not sure how to diagnose this.

For more context the way I currently installed PHP was:

phpbrew install --stdout --jobs=$(nproc) \
    8.1 \
    +default \
    +intl=shared,$(brew --prefix icu4c) \
    +mysql \
    +pgsql \
    +openssl="$(brew --prefix openssl@3)" \
    +curl="$(brew --prefix curl)" \
    +iconv="$(brew --prefix libiconv)" \
    +bz2="$(brew --prefix bzip2)" \
    +zlib="$(brew --prefix zlib)" \
    +fpm \
    -- \
        --with-sodium \
        --with-external-pcre=$(brew --prefix pcre2)

In case you are not familiar with phpbrew, the "special" line here is --with-external-pcre=$(brew --prefix pcre2) which is passed as such to the configure when compiling the PHP binary.

Without it, I always had to disable the JIT (passing --without-pcre-jit). So I guess it kinda works, doing a regex also works. But I'm not familiar enough with the internals to tell if that really means that PCRE is working for my PHP binary.

@theofidry
Copy link
Author

Ok installing PHP again with +pcre="$(brew --prefix pcre2)" fixed it. I'm not clear what the difference is and neither if that was a problem for the PHP binary itself, and much less how to check it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants