phpmacoshomebrewphp-extensionpecl

When installing php oauth package: Couldn't find pcre.h, try installing the libpcre development/headers package


I need to install oauth (pecl install oauth) for a 3rd party package. I have both pcre & pcre2 installed using Homebrew but still oauth complains about not finding pcre.h. I'm on macOS Ventura 13.1 with an M1 Pro. The wanted php version is 7.3 but all php versions have the same issue. The pcre.h does exist ánd is located under /opt/homebrew/Cellar/pcre/8.45/include/pcre.h.

pcre installs

[23-01-10 19:16] ~ brew reinstall pcre
==> Fetching pcre
==> Downloading https://ghcr.io/v2/homebrew/core/pcre/manifests/8.45
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pcre/blobs/sha256:542a6e5dcf5f1ac65929
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:54
######################################################################## 100.0%
==> Reinstalling pcre
==> Pouring pcre--8.45.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/pcre/8.45: 204 files, 4.6MB
==> Running `brew cleanup pcre`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
[23-01-10 19:16] ~ brew reinstall pcre2
==> Fetching pcre2
==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/manifests/10.42
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/blobs/sha256:8423a338c590ab1a6f2
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:84
######################################################################## 100.0%
==> Reinstalling pcre2
==> Pouring pcre2--10.42.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/pcre2/10.42: 230 files, 6.2MB
==> Running `brew cleanup pcre2`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

pecl oauth install output

[23-01-10 19:16] ~ pecl install oauth
downloading oauth-2.0.7.tgz ...
Starting to download oauth-2.0.7.tgz (78,926 bytes)
..................done: 78,926 bytes
6 source files, building
running: phpize
Configuring for:
PHP Api Version:         20180731
Zend Module Api No:      20180731
Zend Extension Api No:   320180731
configure.ac:7: warning: $as_echo is obsolete; use AS_ECHO(["message"]) instead
aclocal.m4:2705: PHP_CONFIG_NICE is expanded from...
configure.ac:7: the top level
configure.ac:149: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:149: You should run autoupdate.
./lib/autoconf/c.m4:72: AC_LANG_C is expanded from...
aclocal.m4:6063: _LT_AC_LANG_C_CONFIG is expanded from...
aclocal.m4:6062: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
aclocal.m4:3406: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:3388: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:3375: AC_PROG_LIBTOOL is expanded from...
configure.ac:149: the top level
configure.ac:149: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:149: You should run autoupdate.
./lib/autoconf/c.m4:72: AC_LANG_C is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
aclocal.m4:3897: _LT_AC_LOCK is expanded from...
aclocal.m4:4520: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
aclocal.m4:6063: _LT_AC_LANG_C_CONFIG is expanded from...
aclocal.m4:6062: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
aclocal.m4:3406: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:3388: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:3375: AC_PROG_LIBTOOL is expanded from...
configure.ac:149: the top level
configure.ac:149: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:149: You should run autoupdate.
./lib/autoconf/general.m4:2920: AC_TRY_LINK is expanded from...
lib/m4sugar/m4sh.m4:692: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:699: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
aclocal.m4:3897: _LT_AC_LOCK is expanded from...
aclocal.m4:4520: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
aclocal.m4:6063: _LT_AC_LANG_C_CONFIG is expanded from...
aclocal.m4:6062: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
aclocal.m4:3406: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:3388: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:3375: AC_PROG_LIBTOOL is expanded from...
configure.ac:149: the top level
configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
aclocal.m4:4520: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
aclocal.m4:6063: _LT_AC_LANG_C_CONFIG is expanded from...
aclocal.m4:6062: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
aclocal.m4:3406: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:3388: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:3375: AC_PROG_LIBTOOL is expanded from...
configure.ac:149: the top level
configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
aclocal.m4:4520: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
aclocal.m4:6063: _LT_AC_LANG_C_CONFIG is expanded from...
aclocal.m4:6062: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
aclocal.m4:3406: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:3388: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:3375: AC_PROG_LIBTOOL is expanded from...
configure.ac:149: the top level
configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile' does not exist
aclocal.m4:5253: _LT_AC_TAGCONFIG is expanded from...
aclocal.m4:3406: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:3388: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:3375: AC_PROG_LIBTOOL is expanded from...
configure.ac:149: the top level
configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: output file \`$ofile' does not exist
aclocal.m4:5253: _LT_AC_TAGCONFIG is expanded from...
aclocal.m4:3406: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:3388: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:3375: AC_PROG_LIBTOOL is expanded from...
configure.ac:149: the top level
configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile' does not look like a libtool script
aclocal.m4:5253: _LT_AC_TAGCONFIG is expanded from...
aclocal.m4:3406: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:3388: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:3375: AC_PROG_LIBTOOL is expanded from...
configure.ac:149: the top level
configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: output file \`$ofile' does not look like a libtool script
aclocal.m4:5253: _LT_AC_TAGCONFIG is expanded from...
aclocal.m4:3406: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:3388: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:3375: AC_PROG_LIBTOOL is expanded from...
configure.ac:149: the top level
configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'
aclocal.m4:5253: _LT_AC_TAGCONFIG is expanded from...
aclocal.m4:3406: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:3388: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:3375: AC_PROG_LIBTOOL is expanded from...
configure.ac:149: the top level
configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'
aclocal.m4:5253: _LT_AC_TAGCONFIG is expanded from...
aclocal.m4:3406: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:3388: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:3375: AC_PROG_LIBTOOL is expanded from...
configure.ac:149: the top level
configure.ac:149: warning: back quotes and double quotes must not be escaped in: tag name \"$tagname\" already exists
aclocal.m4:5253: _LT_AC_TAGCONFIG is expanded from...
aclocal.m4:3406: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:3388: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:3375: AC_PROG_LIBTOOL is expanded from...
configure.ac:149: the top level
configure.ac:149: warning: The macro `AC_LANG_CPLUSPLUS' is obsolete.
configure.ac:149: You should run autoupdate.
./lib/autoconf/c.m4:262: AC_LANG_CPLUSPLUS is expanded from...
aclocal.m4:6145: _LT_AC_LANG_CXX_CONFIG is expanded from...
aclocal.m4:6144: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
aclocal.m4:5253: _LT_AC_TAGCONFIG is expanded from...
aclocal.m4:3406: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:3388: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:3375: AC_PROG_LIBTOOL is expanded from...
configure.ac:149: the top level
configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
aclocal.m4:4520: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
aclocal.m4:6145: _LT_AC_LANG_CXX_CONFIG is expanded from...
aclocal.m4:6144: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
aclocal.m4:5253: _LT_AC_TAGCONFIG is expanded from...
aclocal.m4:3406: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:3388: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:3375: AC_PROG_LIBTOOL is expanded from...
configure.ac:149: the top level
configure.ac:149: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
aclocal.m4:4520: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
aclocal.m4:6145: _LT_AC_LANG_CXX_CONFIG is expanded from...
aclocal.m4:6144: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
aclocal.m4:5253: _LT_AC_TAGCONFIG is expanded from...
aclocal.m4:3406: AC_LIBTOOL_SETUP is expanded from...
aclocal.m4:3388: _AC_PROG_LIBTOOL is expanded from...
aclocal.m4:3375: AC_PROG_LIBTOOL is expanded from...
configure.ac:149: the top level
building in /private/tmp/pear/temp/pear-build-tommyquissensDhzMOp/oauth-2.0.7
running: /private/tmp/pear/temp/oauth/configure --with-php-config=/opt/homebrew/opt/php@7.3/bin/php-config
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether cc accepts -g... yes
checking for cc option to enable C11 features... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... arm-apple-darwin22.2.0
checking host system type... arm-apple-darwin22.2.0
checking target system type... arm-apple-darwin22.2.0
checking for PHP prefix... /opt/homebrew/Cellar/php@7.3/7.3.33_3
checking for PHP includes... -I/opt/homebrew/Cellar/php@7.3/7.3.33_3/include/php -I/opt/homebrew/Cellar/php@7.3/7.3.33_3/include/php/main -I/opt/homebrew/Cellar/php@7.3/7.3.33_3/include/php/TSRM -I/opt/homebrew/Cellar/php@7.3/7.3.33_3/include/php/Zend -I/opt/homebrew/Cellar/php@7.3/7.3.33_3/include/php/ext -I/opt/homebrew/Cellar/php@7.3/7.3.33_3/include/php/ext/date/lib
checking for PHP extension directory... /opt/homebrew/Cellar/php@7.3/7.3.33_3/pecl/20180731
checking for PHP installed headers prefix... /opt/homebrew/Cellar/php@7.3/7.3.33_3/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 3.0 (ok)
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for oauth support... yes, shared
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for pcre.h... no
configure: error: Couldn't find pcre.h, try installing the libpcre development/headers package
ERROR: `/private/tmp/pear/temp/oauth/configure --with-php-config=/opt/homebrew/opt/php@7.3/bin/php-config' failed

Solution

  • Using macOS Monterey 12.6 on an M1 Pro MacBook Pro, here are the steps necessary to install oauth extension for PHP 8.1 using brew:

    brew install pcre
    brew install pcre2
    sudo ln -s /opt/homebrew/include/pcre.h /usr/local/include/
    sudo ln -s /opt/homebrew/include/pcre2.h /usr/local/include/
    sudo pecl install oauth
    

    (if /usr/local/include/ doesn't exist, you can go ahead & create it)

    source: https://stackoverflow.com/a/74051552/3360802