phpenv: All latest versions fail to build/install on OSX 10.14 Mojave

I tried to install the latest versions available on php-build but without luck. I tried to install:

5.6.38
7.0.32
7.1.22
7.2.10

and they all come back with

-----------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
configure: error: Cannot find libz
-----------------------------------------

or

-----------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
configure: error: Cannot find zlib
-----------------------------------------

depending by the version.

Command Line Tools are installed and they are up to date, definitely something to investigate further.

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 3
  • Comments: 59 (36 by maintainers)

Most upvoted comments

macOS 10.15 Catalina

$ brew install autoconf bison bzip2 curl icu4c libedit libjpeg libiconv libpng libxml2 libzip openssl re2c tidy-html5 zlib

$ PATH="$(brew --prefix icu4c)/bin:$(brew --prefix icu4c)/sbin:$(brew --prefix libiconv)/bin:$(brew --prefix curl)/bin:$(brew --prefix libxml2)/bin:$(brew --prefix bzip2)/bin:$(brew --prefix bison)/bin:$PATH" \
PHP_BUILD_CONFIGURE_OPTS="--with-zlib-dir=$(brew --prefix zlib) --with-bz2=$(brew --prefix bzip2) --with-curl=$(brew --prefix curl) --with-iconv=$(brew --prefix libiconv) --with-libedit=$(brew --prefix libedit)" \
phpenv install 7.3.9

$ php -v
PHP 7.3.9 (cli) (built: Sep 10 2019 17:45:01) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.9, Copyright (c) 1998-2018 Zend Technologies

Ok for the time being I managed to get 7.2.10 to build and install with the following command line:

$ CONFIGURE_OPTS="--with-zlib-dir=$(brew --prefix zlib) --with-bz2=$(brew --prefix bzip2) --with-iconv=$(brew --prefix libiconv) --with-readline=$(brew --prefix readline) --with-libedit=$(brew --prefix libedit) --with-tidy=$(brew --prefix tidy-html5)" phpenv install 7.2.10

and installing any missing package via homebrew.

It goes on the right track but then it hits the next hurdle:

[Info]: Appending build output to /tmp/php-build.7.2.10.20181011142200.log
[Info]: Loaded extension plugin
[Info]: Loaded apc Plugin.
[Info]: Loaded composer Plugin.
[Info]: Loaded github Plugin.
[Info]: Loaded uprofiler Plugin.
[Info]: Loaded xdebug Plugin.
[Info]: Loaded xhprof Plugin.
[Info]: Loaded zendopcache Plugin.
[Info]: php.ini-production gets used as php.ini
[Info]: Building 7.2.10 into /Users/marco.debortoli/.phpenv/versions/7.2.10
[Skipping]: Already downloaded and extracted https://secure.php.net/distributions/php-7.2.10.tar.bz2
[Preparing]: /var/tmp/php-build/source/7.2.10

-----------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
configure: WARNING: unrecognized options: --with-mcrypt
configure: error: Please reinstall the BZip2 distribution
-----------------------------------------

The full Log is available at '/tmp/php-build.7.2.10.20181011142200.log'.
[Warn]: Aborting build.

It really looks like the latest OSX version messed up path management and such. Also I checked your fix and I suppose it should be more specific and target OSX 10.13 and above. Your fork always worked find up until the previous version.

Thanks @naviapis that worked a treat

why not mention this configure options on documentations

@debo phpenv install 8.2.8 gave me configure: error: Please reinstall the BZip2 distribution. Installing over the local MacOS version with Homebrew and replacing it in PATH had no effect. I also tried naviapis’s solution and it also didn’t work, but I don’t remember if it was still the BZip2 error.

I see this issue over in php-build: https://github.com/php-build/php-build/issues/543, with no movement since 2019 😞 is that where I should be looking?

I can confirm that on my personal laptop with the latest Xcode everything works fine again.