arnaud-lb / php-rdkafka

Production-ready, stable Kafka client for PHP
MIT License
2.09k stars 265 forks source link

Can't install extension on macOS via PECL #549

Open djklim87 opened 7 months ago

djklim87 commented 7 months ago

Description

Install librdkafka

brew install librdkafka  
Warning: librdkafka 2.3.0 is already installed and up-to-date.
To reinstall 2.3.0, run:
  brew reinstall librdkafka

Install extension

pecl install rdkafka   
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading rdkafka-6.0.3.tgz ...
Starting to download rdkafka-6.0.3.tgz (55,561 bytes)
.............done: 55,561 bytes
72 source files, building
running: phpize
Configuring for:
PHP Api Version:         20230831
Zend Module Api No:      20230831
Zend Extension Api No:   420230831
librdkafka installation path? [autodetect] : 
building in /private/tmp/pear/temp/pear-build-djklim87ZbvEud/rdkafka-6.0.3
running: /private/tmp/pear/temp/rdkafka/configure --with-php-config=/opt/homebrew/opt/php/bin/php-config --with-rdkafka
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... /usr/local/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 egrep -e... (cached) /usr/bin/grep -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-darwin23.3.0
checking host system type... aarch64-apple-darwin23.3.0
checking target system type... aarch64-apple-darwin23.3.0
checking for PHP prefix... /opt/homebrew/Cellar/php/8.3.2
checking for PHP includes... -I/opt/homebrew/Cellar/php/8.3.2/include/php -I/opt/homebrew/Cellar/php/8.3.2/include/php/main -I/opt/homebrew/Cellar/php/8.3.2/include/php/TSRM -I/opt/homebrew/Cellar/php/8.3.2/include/php/Zend -I/opt/homebrew/Cellar/php/8.3.2/include/php/ext -I/opt/homebrew/Cellar/php/8.3.2/include/php/ext/date/lib
checking for PHP extension directory... /opt/homebrew/Cellar/php/8.3.2/pecl/20230831
checking for PHP installed headers prefix... /opt/homebrew/Cellar/php/8.3.2/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 for rdkafka support... yes, shared
checking for librdkafka/rdkafka.h" in default path... found in /usr/local
checking for rd_kafka_new in -lrdkafka... no
configure: error: wrong rdkafka lib version or lib not found
ERROR: `/private/tmp/pear/temp/rdkafka/configure --with-php-config=/opt/homebrew/opt/php/bin/php-config --with-rdkafka' failed

php-rdkafka Version

rdkafka-6.0.3

librdkafka Version

librdkafka 2.3.0

PHP Version

8.3.2

Operating System

MacOS

Kafka Version

No response

akandels commented 3 months ago

Your error is it can't find librdkafka (a C-extension, installed separately). Install it first: https://formulae.brew.sh/formula/librdkafka

Then, when you re-run your PECL install, when prompted, enter the path to where librdkafka installed (depends on your Mac arch, but my M2 ended up at /opt/homebrew/Cellar/librdkafka/2.5.0). The default "detect" was not able to resolve this path and I had to type it.