Macのphpenvでinstallするとエラーになる時の対処法
$ phpenv install 7.3.11
...
-----------------------------------------
configure: error: Cannot find OpenSSL's <evp.h>
-----------------------------------------
こんなエラー
opensslは入ってるはず。。。
$ brew ls openssl
/usr/local/Cellar/openssl/1.0.2s/.bottle/etc/ (8 files)
/usr/local/Cellar/openssl/1.0.2s/bin/c_rehash
/usr/local/Cellar/openssl/1.0.2s/bin/openssl
/usr/local/Cellar/openssl/1.0.2s/include/openssl/ (75 files)
/usr/local/Cellar/openssl/1.0.2s/lib/libcrypto.1.0.0.dylib
/usr/local/Cellar/openssl/1.0.2s/lib/libssl.1.0.0.dylib
/usr/local/Cellar/openssl/1.0.2s/lib/engines/ (12 files)
/usr/local/Cellar/openssl/1.0.2s/lib/pkgconfig/ (3 files)
/usr/local/Cellar/openssl/1.0.2s/lib/ (4 other files)
/usr/local/Cellar/openssl/1.0.2s/share/man/ (1683 files)
linkを試みる
$ brew link openssl
Warning: Refusing to link macOS-provided software: openssl
If you need to have openssl first in your PATH run:
echo 'set -g fish_user_paths "/usr/local/opt/openssl/bin" $fish_user_paths' >>
~/.config/fish/config.fish
For compilers to find openssl you may need to set:
set -gx LDFLAGS "-L/usr/local/opt/openssl/lib"
set -gx CPPFLAGS "-I/usr/local/opt/openssl/include"
For pkg-config to find openssl you may need to set:
set -gx PKG_CONFIG_PATH "/usr/local/opt/openssl/lib/pkgconfig"
リンクできない。。。
というわけでコンパイラにオプションを渡さないといけない。
ここで"PHP_BUILD_CONFIGURE_OPTS"を使う。
fishだとこんな感じ
$ env PHP_BUILD_CONFIGURE_OPTS=--with-openssl=(brew --prefix openssl) phpenv install 7.3.11
無事インストールできた!