LoginSignup
4
0

More than 5 years have passed since last update.

macOS 10.14 + phpenv + php-build で configure: error: Please reinstall libedit - I cannot find readline.h

Posted at

macOS 10.14 + phpenv (v0.9.0-rc.1) + php-build (v0.11.0dev) で PHP 7.2.11 をインストールしようとしたら、下記のエラーが出た。

configure: error: Please reinstall libedit - I cannot find readline.h

brew で libedit をインストールしてもエラーは変わらず、 php-build の default_configure_options に --with-libedit--without-libedit--with-readline--without-readline や、それぞれに brew でインストールしたパスを設定したりしてみても状況は変わらず、いろいろ調べている過程で php-build のソースを確認したら、 macOS の場合、 default_configure_options の設定を消したり追加したり上書きしたりしていた。

# Mac OSX stores some libraries (for example `libpng`)
# in `/usr/X11/lib` instead of `/usr/lib`.
#
# This currently builds PHP without the `gettext` and `readline`
# extensions, as I've currently not got them to work on my machine.
if is_osx; then |
    configure_option -D "--with-gettext"
    configure_option -D "--with-readline"
    configure_option "--with-libedit"

    configure_option -R "--with-png-dir" "/usr/X11"
fi

default_configure_options で設定しても上記が優先されていて、 --without-libedit --with-libedit といった状態になっていた( /var/tmp/php-build/source/7.2.11/config.log で確認)。

さらにいろいろ調べたところ、インストール時に PHP_BUILD_CONFIGURE_OPTS で設定を追加できるらしく( PHP_BUILD_CONFIGURE_OPTS の存在はどこで知ったかは失念)、 PHP_BUILD_CONFIGURE_OPTS に brew でインストールした libedit のパスを設定したら、無事、 PHP 7.2.11 をインストールすることができた。

$ PHP_BUILD_CONFIGURE_OPTS="--with-libedit=$(brew --prefix libedit)" phpenv install 7.2.11

参考

4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0