macOS Sierraで phpenv install 7.1.2
したら見慣れないエラーでしばらく格闘してしまったので備忘録
おまじない
brew install openssl libxml2 autoconf automake libjpeg libpng libmcrypt
export PHP_BUILD_CONFIGURE_OPTS=--with-openssl=/usr/local/opt/openssl --with-libxml-dir=/usr/local/opt/libxml2
export PHP_BUILD_EXTRA_MAKE_ARGUMENTS=-j4
Homebrewのopenssl、libxml2を参照するようにconfigureオプションを修正しておく
エラー
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: archive member: ext/opcache/.libs/opcache.a(libssl.a) fat file for cputype (7) cpusubtype (3) is not an object file (bad magic number)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar: internal ranlib command failed
make: *** [ext/opcache/opcache.la] Error 1
make: *** Waiting for unfinished jobs....
エラー(末尾)
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/signal.h:103:39: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
void psignal(unsigned int, const char *);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/signal.h:106:31: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int sigvec(int, struct sigvec *, struct sigvec *);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/signal.h:106:48: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int sigvec(int, struct sigvec *, struct sigvec *);
^
346 warnings generated.
→Homebrewのopensslを--universal
オプション付きでインストールしている
無印で再インストール
コマンド
brew uninstall --ignore-dependencies openssl
brew install openssl
エラー
configure: error: cannot find sources (README.GIT-RULES) in . or ..
→ソースコードが不完全
キャッシュディレクトリを削除してDLから再試行する
[Preparing]:
で始まる行のパスを削除
コマンド
rm -rf /var/folders/z0/q7xv_xd91kx44v_cnmn4yd780000gn/T/php-build/source/5.6.30
エラー
configure: error: in `/var/folders/z0/q7xv_xd91kx44v_cnmn4yd780000gn/T/php-build/source/7.1.2':
configure: error: C compiler cannot create executables
See `config.log' for more details
→brewのopensslが破損している
コマンド
brew reinstall openssl