Fails to pecl install or build manually on M1 Mac running macOS Ventura
I don't know for certain if this is a problem to post here or as part of the homebrew for Gearman itself, my knowledge of C isn't good enough to tell me what the actual problem is, I'm just handy enough to be dangerous - but I have been fighting with getting the Gearman extension working on my M1 Mac for weeks.
It seems that no matter what I try it boils down to configure: error: Please install libgearman
I thought maybe it's something with my local machine, so I spun up a clean macOS on a UTM VM and tried it - log.txt here's the log of that. Same issue.
That log, above, on a clean install of macOS boils down to
(Click to Expand) Log Summary
% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
% brew update
% (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/admin/.zprofile
% eval "$(/opt/homebrew/bin/brew shellenv)"
% brew update
% brew install shivammathur/php/[email protected]
% brew install gearman
% sudo pecl install gearman
% brew install pecl
% php --version
% export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"
% export PATH="/opt/homebrew/opt/[email protected]/sbin:$PATH"
% pecl
% sudo pecl install gearman
Password:
sudo: pecl: command not found
admin@Admins-Virtual-Machine ~ % brew install pecl
==> Downloading https://formulae.brew.sh/api/formula.jws.json
==> Downloading https://formulae.brew.sh/api/cask.jws.json
######################################################################################################################### 100.0%
Warning: No available formula with the name "pecl". Did you mean pcl, ecl, peco, perl or pocl?
==> Searching for similarly named formulae and casks...
==> Formulae
stripe-cli pcl ecl peco perl pocl
To install stripe-cli, run:
brew install stripe-cli
==> Casks
pencil
To install pencil, run:
brew install --cask pencil
admin@Admins-Virtual-Machine ~ % php --version
zsh: command not found: php
admin@Admins-Virtual-Machine ~ % export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"
admin@Admins-Virtual-Machine ~ % export PATH="/opt/homebrew/opt/[email protected]/sbin:$PATH"
admin@Admins-Virtual-Machine ~ % pecl
Commands:
build Build an Extension From C Source
bundle Unpacks a Pecl Package
channel-add Add a Channel
channel-alias Specify an alias to a channel name
channel-delete Remove a Channel From the List
channel-discover Initialize a Channel from its server
channel-info Retrieve Information on a Channel
channel-login Connects and authenticates to remote channel server
channel-logout Logs out from the remote channel server
channel-update Update an Existing Channel
clear-cache Clear Web Services Cache
config-create Create a Default configuration file
config-get Show One Setting
config-help Show Information About Setting
config-set Change Setting
config-show Show All Settings
convert Convert a package.xml 1.0 to package.xml 2.0 format
cvsdiff Run a "cvs diff" for all files in a package
cvstag Set CVS Release Tag
download Download Package
download-all Downloads each available package from the default channel
info Display information about a package
install Install Package
list List Installed Packages In The Default Channel
list-all List All Packages
list-channels List Available Channels
list-files List Files In Installed Package
list-upgrades List Available Upgrades
login Connects and authenticates to remote server [Deprecated in favor of channel-login]
logout Logs out from the remote server [Deprecated in favor of channel-logout]
makerpm Builds an RPM spec file from a PEAR package
package Build Package
package-dependencies Show package dependencies
package-validate Validate Package Consistency
pickle Build PECL Package
remote-info Information About Remote Packages
remote-list List Remote Packages
run-scripts Run Post-Install Scripts bundled with a package
run-tests Run Regression Tests
search Search remote package database
shell-test Shell Script Test
sign Sign a package distribution file
svntag Set SVN Release Tag
uninstall Un-install Package
update-channels Update the Channel List
upgrade Upgrade Package
upgrade-all Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters]
Usage: pecl [options] command [command-options] <parameters>
Type "pecl help options" to list all options.
Type "pecl help shortcuts" to list all command shortcuts.
Type "pecl help version" or "pecl version" to list version information.
Type "pecl help <command>" to get the help for the specified command.
admin@Admins-Virtual-Machine ~ % sudo pecl install gearman
Password:
downloading gearman-2.1.2.tgz ...
Starting to download gearman-2.1.2.tgz (46,832 bytes)
.............done: 46,832 bytes
15 source files, building
running: phpize
Configuring for:
PHP Api Version: 20210902
Zend Module Api No: 20210902
Zend Extension Api No: 420210902
building in /private/tmp/pear/temp/pear-build-rootN6W8yE/gearman-2.1.2
running: /private/tmp/pear/temp/gearman/configure --with-php-config=/opt/homebrew/opt/[email protected]/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 pkg-config... no
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-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/[email protected]/8.1.29
checking for PHP includes... -I/opt/homebrew/Cellar/[email protected]/8.1.29/include/php -I/opt/homebrew/Cellar/[email protected]/8.1.29/include/php/main -I/opt/homebrew/Cellar/[email protected]/8.1.29/include/php/TSRM -I/opt/homebrew/Cellar/[email protected]/8.1.29/include/php/Zend -I/opt/homebrew/Cellar/[email protected]/8.1.29/include/php/ext -I/opt/homebrew/Cellar/[email protected]/8.1.29/include/php/ext/date/lib
checking for PHP extension directory... /opt/homebrew/Cellar/[email protected]/8.1.29/pecl/20210902
checking for PHP installed headers prefix... /opt/homebrew/Cellar/[email protected]/8.1.29/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 whether to enable gearman support... yes, shared
not found
configure: error: Please install libgearman
ERROR: `/private/tmp/pear/temp/gearman/configure --with-php-config=/opt/homebrew/opt/[email protected]/bin/php-config' failed
I've done a bunch of "debugging" with ChatGPT, as helpful as that might be - gearman.pc seems to be missing?
I tried just manually creating a
/opt/homebrew/opt/gearman/lib/pkgconfig/gearman.pc (the /opt/homebrew/opt/gearman/lib/pkgconfig directory already exists but only has a gearmand.pc)
My understanding is that libgearman should be installed with brew install gearman?
I don't know what the problem is - but it's broken on a clean install of macOS so I suspect I'm not (fully) the issue here?
Hi, @donatj. I know it's been 2 weeks since you opened this issue, so I'm guessing you either already found a solution or have moved on. I just happened to have added a GitHub Actions CI workflow that compiles and tests the PHP Gearman extension on the latest macOS, and it works, as you can see here:
https://github.com/esabol/pecl-networking-gearman/actions/runs/11269845628/job/31339294167
Looking at your log.txt, you (well, pecl) ran
/private/tmp/pear/temp/gearman/configure --with-php-config=/opt/homebrew/opt/[email protected]/bin/php-config
I suspect you need to run
/private/tmp/pear/temp/gearman/configure --with-php-config=/opt/homebrew/opt/[email protected]/bin/php-config --with-gearman=$(brew --prefix gearman)
I think you're probably going to have to configure and compile it manually instead of using pecl. I hope this helps!
@esabol Hah, so, actually no, I have not moved on. It's been a complete and total blocker for me trying to do some maintenance work on an old project.
Your suggested ./configure incantation did in fact compile successfully for me, and after a little fiddling appears to be working. Thank you so much!
For the future, is this something that can be fixed on the … pecl side? I've no idea who I need to poke to make this not a problem 😆
@dontj asked:
For the future, is this something that can be fixed on the … pecl side? I've no idea who I need to poke to make this not a problem 😆
Well, I would try changing this line:
https://github.com/php/pecl-networking-gearman/blob/a52052cdd712a95091ce926be3bcdca41c730696/config.m4#L16
to
for i in $PHP_GEARMAN /usr/local /usr /opt/local /opt/homebrew/opt/gearman; do
Can you make that change to the gearman configure file locally and test that, @donatj ?
Ideally, it should run $(brew --prefix gearman) instead of hardcoding /opt/homebrew/opt/gearman, but I'm not sure if one can do that in a configure script.
In case anyone else lands here like me after a ton of searching around, the "suggested ./configure incantation" process is referring to just manually installing the PHP gearman extension instead of using PECL. I'm on an M1 Mac also, using PHP 8.3, so adjust commands below based on your version. From this SO answer, first download latest version from http://pecl.php.net/package/gearman then:
tar xzf gearman-X.Y.tgz
cd gearman-X.Y
phpize
./configure --with-php-config=/opt/homebrew/opt/[email protected]/bin/php-config --with-gearman=$(brew --prefix gearman)
make
sudo make install
Then add extension="gearman.so" to the top of /opt/homebrew/etc/php/8.3/php.ini and restart PHP with brew services restart [email protected]
Hopefully that helps someone avoid the hour of head-keyboard-smash that I wasted trying to get PECL to work despite the repeated "Please install libgearman" response.