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

Pecl install fails on M2 Macbook with pcre2 #329

Open
designermonkey opened this issue Sep 5, 2023 · 3 comments
Open

Pecl install fails on M2 Macbook with pcre2 #329

designermonkey opened this issue Sep 5, 2023 · 3 comments

Comments

@designermonkey
Copy link

  1. What did you do? If possible, provide a simple script for reproducing the error.
~ pecl install openswoole

  1. What did you expect to see?

I don't know what correct output should be.

  1. What did you see instead?
downloading openswoole-22.0.0.tgz ...
Starting to download openswoole-22.0.0.tgz (1,244,040 bytes)
.....................................................................................................................................................................................................................................................done: 1,244,040 bytes
482 source files, building
running: phpize
Configuring for:
PHP Api Version:         20220829
Zend Module Api No:      20220829
Zend Extension Api No:   420220829
cp: /private/tmp/pear/temp/openswoole/build/php.m4: Permission denied
cp: /private/tmp/pear/temp/openswoole/build/shtool: Permission denied
cp: /private/tmp/pear/temp/openswoole/build/libtool.m4: Permission denied
cp: /private/tmp/pear/temp/openswoole/build/ax_check_compile_flag.m4: Permission denied
cp: /private/tmp/pear/temp/openswoole/build/ax_gcc_func_attribute.m4: Permission denied
cp: /private/tmp/pear/temp/openswoole/build/php_cxx_compile_stdcxx.m4: Permission denied
cp: /private/tmp/pear/temp/openswoole/build/pkg.m4: Permission denied
cp: /private/tmp/pear/temp/openswoole/build/config.guess: Permission denied
cp: /private/tmp/pear/temp/openswoole/build/config.sub: Permission denied
cp: /private/tmp/pear/temp/openswoole/build/ltmain.sh: Permission denied
cp: /private/tmp/pear/temp/openswoole/build/Makefile.global: Permission denied
cp: /private/tmp/pear/temp/openswoole/build/gen_stub.php: Permission denied
cp: /private/tmp/pear/temp/openswoole/run-tests.php: Permission denied
config.m4:327: warning: The macro `AC_PROG_CC_C99' is obsolete.
config.m4:327: You should run autoupdate.
./lib/autoconf/c.m4:1659: AC_PROG_CC_C99 is expanded from...
config.m4:327: the top level
enable sockets supports? [no] : yes
enable openssl support? [no] : 
enable http2 support? [no] :  
enable mysqlnd support? [no] : 
enable hook curl support? [no] : 
enable postgres support? [no] : 
building in /private/tmp/pear/temp/pear-build-porterjxIzEnV/openswoole-22.0.0
running: /private/tmp/pear/temp/openswoole/configure --with-php-config=/opt/homebrew/opt/php/bin/php-config --enable-sockets=yes --enable-openssl=no --enable-http2=no --enable-mysqlnd=no --enable-hook-curl=no --with-postgres=no
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 pkg-config... /opt/homebrew/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
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 for system library directory... lib
checking if compiler supports -Wl,-rpath,... yes
checking build system type... aarch64-apple-darwin22.6.0
checking host system type... aarch64-apple-darwin22.6.0
checking target system type... aarch64-apple-darwin22.6.0
checking for PHP prefix... /opt/homebrew/Cellar/php/8.2.10
checking for PHP includes... -I/opt/homebrew/Cellar/php/8.2.10/include/php -I/opt/homebrew/Cellar/php/8.2.10/include/php/main -I/opt/homebrew/Cellar/php/8.2.10/include/php/TSRM -I/opt/homebrew/Cellar/php/8.2.10/include/php/Zend -I/opt/homebrew/Cellar/php/8.2.10/include/php/ext -I/opt/homebrew/Cellar/php/8.2.10/include/php/ext/date/lib
checking for PHP extension directory... /opt/homebrew/Cellar/php/8.2.10/pecl/20220829
checking for PHP installed headers prefix... /opt/homebrew/Cellar/php/8.2.10/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking enable debug log... no
checking enable trace log... no
checking enable sockets support... yes
checking enable openssl support... no
checking enable HTTP2 support... no
checking openswoole support... yes, shared
checking enable mysqlnd support... no
checking enable PostgreSQL support... no
checking enable c-ares support... no
checking dir of openssl... no
checking dir of jemalloc... no
checking enable asan... no
checking whether to enable coverage testing... no
checking whether to enable developer build flags... no
checking whether to enable Coroutine Hooks for CURL build flags... no
checking whether to enable thread context... no
checking if compiling with clang... yes
checking for accept4 in -lc... no
checking for signalfd in -lc... no
checking for eventfd in -lc... no
checking for epoll_create in -lc... no
checking for poll in -lc... yes
checking for sendfile in -lc... yes
checking for kqueue in -lc... yes
checking for backtrace in -lc... yes
checking for daemon in -lc... yes
checking for mkostemp in -lc... yes
checking for inotify_init in -lc... no
checking for malloc_trim in -lc... no
checking for inotify_init1 in -lc... no
checking for ptrace in -lc... yes
checking for getrandom in -lc... no
checking for arc4random in -lc... yes
checking for pthread_rwlock_init in -lpthread... yes
checking for pthread_spin_lock in -lpthread... no
checking for pthread_mutex_timedlock in -lpthread... no
checking for pthread_barrier_init in -lpthread... no
checking for pthread_mutexattr_setpshared in -lpthread... yes
checking for pthread_mutexattr_setrobust in -lpthread... no
checking for pthread_mutex_consistent in -lpthread... no
checking for pcre_compile in -lpcre... yes
checking for ares_gethostbyname in -lcares... no
checking for gzgets in -lz... yes
checking for BrotliEncoderCreateInstance in -lbrotlienc... no
checking for php_sockets.h... ok, found in /opt/homebrew/Cellar/php/8.2.10/include/php
checking for cpu affinity... no
checking for socket REUSEPORT... yes
checking for futex... no
checking for ucontext... yes
checking for g++... g++
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking for valgrind... no
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 struct cmsghdr... yes
checking for hstrerror... yes
checking for socketpair... yes
checking for if_nametoindex... yes
checking for if_indextoname... yes
checking for netdb.h... yes
checking for netinet/tcp.h... yes
checking for sys/un.h... yes
checking for sys/sockio.h... yes
checking for field ss_family in struct sockaddr_storage... yes
checking if getaddrinfo supports AI_V4MAPPED... yes
checking if getaddrinfo supports AI_ALL... yes
checking if getaddrinfo supports AI_IDN... no
checking if gethostbyname2_r is supported... no
checking for valgrind... no
checking for clock_gettime in -lc... yes
checking openssl fallback dir... checking openswoole coverage... enabled
checking whether the compiler supports GNU C++... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking for g++ option to enable C++11 features... (cached) none needed
checking how to run the C++ preprocessor... g++ -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for ld used by cc... /Library/Developer/CommandLineTools/usr/bin/ld
checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
checking for /Library/Developer/CommandLineTools/usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for dlfcn.h... yes
checking how to run the C++ preprocessor... g++ -E
checking the maximum length of command line arguments... 786432
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common
checking if cc PIC flag -fno-common works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin22.6.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /Library/Developer/CommandLineTools/usr/bin/ld
checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
checking whether the g++ linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fno-common
checking if g++ PIC flag -fno-common works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin22.6.0 dyld
(cached) (cached) checking how to hardcode library paths into programs... immediate
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/temp/pear-build-porterjxIzEnV/openswoole-22.0.0/libtool --mode=compile g++ -I. -I/private/tmp/pear/temp/openswoole -I/private/tmp/pear/temp/pear-build-porterjxIzEnV/openswoole-22.0.0/include -I/private/tmp/pear/temp/pear-build-porterjxIzEnV/openswoole-22.0.0/main -I/private/tmp/pear/temp/openswoole -I/opt/homebrew/Cellar/php/8.2.10/include/php -I/opt/homebrew/Cellar/php/8.2.10/include/php/main -I/opt/homebrew/Cellar/php/8.2.10/include/php/TSRM -I/opt/homebrew/Cellar/php/8.2.10/include/php/Zend -I/opt/homebrew/Cellar/php/8.2.10/include/php/ext -I/opt/homebrew/Cellar/php/8.2.10/include/php/ext/date/lib -I/private/tmp/pear/temp/openswoole -I/private/tmp/pear/temp/openswoole/include -I/private/tmp/pear/temp/openswoole/ext-src -I/private/tmp/pear/temp/openswoole/thirdparty/hiredis  -DHAVE_CONFIG_H  -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11    -DENABLE_PHP_SWOOLE -DZEND_COMPILE_DL_EXT=1 -c /private/tmp/pear/temp/openswoole/ext-src/php_swoole
.cc -o ext-src/php_swoole.lo  -MMD -MF ext-src/php_swoole.dep -MT ext-src/php_swoole.lo
mkdir ext-src/.libs
 g++ -I. -I/private/tmp/pear/temp/openswoole -I/private/tmp/pear/temp/pear-build-porterjxIzEnV/openswoole-22.0.0/include -I/private/tmp/pear/temp/pear-build-porterjxIzEnV/openswoole-22.0.0/main -I/private/tmp/pear/temp/openswoole -I/opt/homebrew/Cellar/php/8.2.10/include/php -I/opt/homebrew/Cellar/php/8.2.10/include/php/main -I/opt/homebrew/Cellar/php/8.2.10/include/php/TSRM -I/opt/homebrew/Cellar/php/8.2.10/include/php/Zend -I/opt/homebrew/Cellar/php/8.2.10/include/php/ext -I/opt/homebrew/Cellar/php/8.2.10/include/php/ext/date/lib -I/private/tmp/pear/temp/openswoole -I/private/tmp/pear/temp/openswoole/include -I/private/tmp/pear/temp/openswoole/ext-src -I/private/tmp/pear/temp/openswoole/thirdparty/hiredis -DHAVE_CONFIG_H -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11 -DENABLE_PHP_SWOOLE -DZEND_COMPILE_DL_EXT=1 -c /private/tmp/pear/temp/openswoole/ext-src/php_swoole.cc -MMD -MF ext-src/php_swoole.dep -MT ext-src/php_swoole.lo  -fno-common -DPIC -o ext-src/.libs/php
_swoole.o
In file included from /private/tmp/pear/temp/openswoole/ext-src/php_swoole.cc:16:
In file included from /private/tmp/pear/temp/openswoole/ext-src/php_swoole_cxx.h:20:
In file included from /private/tmp/pear/temp/openswoole/ext-src/php_swoole_coroutine.h:25:
/private/tmp/pear/temp/openswoole/include/swoole_coroutine_channel.h:153:20: warning: variable 'co' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
        } else if (type == CONSUMER) {
                   ^~~~~~~~~~~~~~~~
/private/tmp/pear/temp/openswoole/include/swoole_coroutine_channel.h:158:16: note: uninitialized use occurs here
        return co;
               ^~
/private/tmp/pear/temp/openswoole/include/swoole_coroutine_channel.h:153:16: note: remove the 'if' if its condition is always true
        } else if (type == CONSUMER) {
               ^~~~~~~~~~~~~~~~~~~~~~
/private/tmp/pear/temp/openswoole/include/swoole_coroutine_channel.h:148:22: note: initialize the variable 'co' to silence this warning
        Coroutine *co;
                     ^
                      = nullptr
In file included from /private/tmp/pear/temp/openswoole/ext-src/php_swoole.cc:20:
/opt/homebrew/Cellar/php/8.2.10/include/php/ext/pcre/php_pcre.h:23:10: fatal error: 'pcre2.h' file not found
#include "pcre2.h"
         ^~~~~~~~~
1 warning and 1 error generated.
make: *** [ext-src/php_swoole.lo] Error 1
ERROR: `make' failed
  1. What version of OpenSwoole are you using (show your php --ri openswoole)?

Not relevant

  1. What is your machine environment used (show your uname -a & php -v & gcc -v) ?
~ uname -a
Darwin Micron-MBP-QRJ4N3JML6.local 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:21:53 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6020 arm64

~ php -v
PHP 8.2.10 (cli) (built: Sep  1 2023 00:17:29) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.10, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.10, Copyright (c), by Zend Technologies

~ gcc -v
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

I use homebrew, if that is relevant.

@designermonkey
Copy link
Author

designermonkey commented Sep 5, 2023

export CPPFLAGS="$CPPFLAGS -I$(brew --prefix pcre2)/include -L$(brew --prefix pcre2)/lib"

Seems to have fixed it.

On a side note, a similar problem applies with openssl, fixed with the following:

export LDFLAGS="$LDFLAGS -I$(brew --prefix openssl)/include -L$(brew --prefix openssl)/lib"
export CPPFLAGS="$CPPFLAGS -I$(brew --prefix openssl)/include -L$(brew --prefix openssl)/lib"

@designermonkey designermonkey changed the title Pecl install fails on M2 Macbook Pecl install fails on M2 Macbook with pcre2 Sep 5, 2023
@designermonkey
Copy link
Author

Now there is a problem with mkdir at the end of the build :( I need sudo for it to work, but sudo means the build fails with the same issues above.

@david-d-h
Copy link

david-d-h commented Nov 8, 2023

I've had this before too, this fixed the problem for me. It's annoying to have to use a workaround, but it works. https://freek.dev/2151-fixing-the-dreaded-pcre2h-file-not-found-error-when-installing-imagick

As for the openssl error, it might be the same fix. Haven't tried.

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