phpbrew ext install bz2 on OSX can't find BZip2

Created on 18 Apr 2018  路  6Comments  路  Source: phpbrew/phpbrew

Output

...checking for BZip2 support... yes, shared
checking for BZip2 in default path... not found
configure: error: Please reinstall the BZip2 distribution
Error: Command failed: ./configure --with-php-config=/Users/sam/.phpbrew/php/php-7.1.14/bin/php-config returns: checking for BZip2 in default path... not found

Expected Result

Command

phpbrew -d ext install bz2 --with-bz2=/usr/local/Cellar/

Build Log

Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303

Platform

OS: OSX 10.13.3

Running PHP: php-7.1.14

Installing PHP:
extension only

BZip2 is enabled on my $PATH in the same terminal this command was run.
-> BZip2
-> BZip2: I won't write compressed data to a terminal.
-> BZip2: For help, type: `BZip2 --help'.

tried command modifying the directory:
phpbrew -d ext install bz2 --with-bz2-dir=/usr/local/Cellar/

Do not see this issue in searches.

Improvement Variants

Most helpful comment

You can use brew --prefix bzip2 to get the path to bzip2 if you installed it with homebrew. Here's how I'm compiling PHP 7.1 on macOS 10.14:

phpbrew install --jobs=$(sysctl -n hw.ncpu) $1 \
    +default+mysql \
    +iconv="$(brew --prefix libiconv)" \
    +bz2="$(brew --prefix bzip2)" \
    +zlib="$(brew --prefix zlib)"

All 6 comments

Just ran into a similar issue on OSX trying to install a php version.

Installing it this way helped:

phpbrew install 7.1 +bz2=/usr/local/Cellar/bzip2/1.0.6_1

So, I guess you just have to be a bit more specific about bzip location. 1.0.6_1 is just a version of bzip that I happen to have installed, check what's in your /usr/local/Cellar/bzip2/.

Hope this helps :)

I tried to phpbrew install 7.2.10 +default and encountered the same error on OS 10.14.

The workaround indicated by vicmiletsky worked fine for bzip2. However, a similar error occurred for zlib this time.

checking for the location of zlib... configure: error: zip support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located

Please checkout the build log file for more details:
     tail /Users/matsui/.phpbrew/build/php-7.2.10/build.log

In the same way, specifying the location with the +zlib option has worked as well.

phpbrew install 7.2.10 +default +bz2=/usr/local/Cellar/bzip2/1.0.6_1 +zlib=/usr/local/Cellar/zlib/1.2.11

You can use brew --prefix bzip2 to get the path to bzip2 if you installed it with homebrew. Here's how I'm compiling PHP 7.1 on macOS 10.14:

phpbrew install --jobs=$(sysctl -n hw.ncpu) $1 \
    +default+mysql \
    +iconv="$(brew --prefix libiconv)" \
    +bz2="$(brew --prefix bzip2)" \
    +zlib="$(brew --prefix zlib)"

For Mojave 10.14.5, I must run the below command first

brew install zlib bzip2 libiconv curl

then run

phpbrew install 7.1.21 +default +bz2=/usr/local/opt/bzip2 +zlib=/usr/local/opt/zlib

reference

In addition to @larsnystrom 's comment, I had to install libzip

brew install libzip

and it worked

Fixed by #1118.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

luohengyi picture luohengyi  路  5Comments

Exaltia picture Exaltia  路  4Comments

cnmade picture cnmade  路  6Comments

sam452 picture sam452  路  3Comments

mcpeng picture mcpeng  路  5Comments