I can't install rdkafka via pecl under the php7.1 on Mac M1 - homebrew-php

Describe the bug I can't install rdkafka via pecl under the php7.1 on Mac M1. Error is: checking build system type... Invalid configuration `arm64-apple-darwin20.5.0': machine 'arm64-apple' not recognized

PHP versions 7.1

To Reproduce 1. Install arm64 version homebrew 2. Install the homebrew-php provided by you tap shivammathur/homebrew-php and install php@7.1 arm64 3. Install rdkafka by pecl then meet a error

Expected behavior The rdkafka will be installed by pecl success.

Screenshots/Logs checking if compiler supports -Wl,-rpath,... yes checking build system type... Invalid configuration `arm64-apple-darwin20.5.0': machine `arm64-apple' not recognized configure: error: /bin/sh /private/tmp/pear/temp/rdkafka/config.sub arm64-apple-darwin20.5.0 failed ERROR: `/private/tmp/pear/temp/rdkafka/configure --with-php-config=/opt/homebrew/opt/php@7.1/bin/php-config' failed Actually, I can't install any libs by pecl.

Additional context I try to use brew install memcached@7.1 --build-from-source another extension from shivammathur/homebrew-extensions, and it works.

And could you fix this pecl issue ? Or could you please add rdkafka@7.1 into your extensions and give some more details to help my to build and install php c extension manually?

Asked Oct 02 '21 11:10
avatar ninjachen
ninjachen

3 Answer:

Thank you shivammathur!! Could you give some more information to help me to understand this issue?

1
Answered Jun 15 '21 at 14:50
avatar  of ninjachen
ninjachen
$cc -v
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: arm64-apple-darwin20.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
1
Answered Jun 15 '21 at 14:51
avatar  of ninjachen
ninjachen

@ninjachen The issue is that your autoconf auxiliary file config.sub is old and does not recognize macos arm. Make sure you have the latest autoconf and Xcode cli tools, and then try again.

  • Update Xcode CLI tools
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
  • Install rdkafka extension.
brew update 
brew reinstall autoconf
brew install librdkafka
pecl download rdkafka-5.0.0
tar xf  rdkafka-5.0.0.tgz
cd rdkafka-5.0.0
phpize
./configure --with-rdkafka="$(brew --prefix librdkafka)" --with-php-config="$(which php-config)"
make
make install
1
Answered Jun 15 '21 at 16:13
avatar  of shivammathur
shivammathur