新しいVPSにanyenvからphpenvを入れようとしたら色々なエラーが出たのでそれぞれの対処メモを残しておきます。phpビルドの話なのでanyenvはあんまり関係ありません。
Contents
- 1 yum installするパッケージまとめ
- 2 色々なエラー
- 2.1 tar (child): bzip2: exec 不能: そのようなファイルやディレクトリはありません
- 2.2 ./buildconf: そのようなファイルやディレクトリはありません
- 2.3 configure: WARNING: This bison version is not supported for regeneration of the Zend/PHP parsers (found: none, min: 204, excluded: ).
- 2.4 configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
- 2.5 configure: error: xml2-config not found. Please check your libxml2 installation.
- 2.6 configure: WARNING: unrecognized options: –with-mcrypt
- 2.7 configure: error: Cannot find OpenSSL’s <evp.h>
- 2.8 configure: error: Please reinstall the BZip2 distribution
- 2.9 configure: error: cURL version 7.10.5 or later is required to compile php with cURL support
- 2.10 configure: error: jpeglib.h not found.
- 2.11 configure: error: png.h not found.
- 2.12 configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
- 2.13 configure: error: Please reinstall readline – I cannot find readline.h
- 2.14 configure: error: Cannot find libtidy
- 2.15 configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
- 2.16 configure: WARNING: Use of bundled libzip is deprecated and will be removed.
- 2.17 WARNINGしかない、もしくはWARNINGすら無くビルドログも空なのにBUILD ERRORになる
yum installするパッケージまとめ
以下の各項目で必要なパッケージのまとめです。
1 2 | $ sudo yum install bzip2 bzip2-devel bison re2c libxml2-devel openssl-devel libcurl-devel libjpeg-devel libpng-devel libicu-devel readline-devel libtidy-devel libxslt-devel |
色々なエラー
tar (child): bzip2: exec 不能: そのようなファイルやディレクトリはありません
1 2 | $ sudo yum install bzip2 |
./buildconf: そのようなファイルやディレクトリはありません
1 2 | /home/***/.anyenv/envs/phpenv/plugins/php-build/bin/php-build: 行 548: ./buildconf: そのようなファイルやディレクトリはありません |
上のbzip2を入れてphpenv installをやり直したらなんか謎にこんなエラーが出て止まるようになりました
詳細はよくわからないですがキャッシュ的な何かの問題らしく、/tmp/php-build を削除してやり直したら出なくなりました。
1 2 | rm -rf /tmp/php-build |
参考:./buildconf: No such file or directory · Issue #80 · phpenv/phpenv
configure: WARNING: This bison version is not supported for regeneration of the Zend/PHP parsers (found: none, min: 204, excluded: ).
1 2 | $ sudo yum install bison |
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
1 2 | $ sudo yum install re2c |
configure: error: xml2-config not found. Please check your libxml2 installation.
1 2 | $ sudo yum install bison re2c libxml2-devel |
configure: WARNING: unrecognized options: –with-mcrypt
phpenvが7.2に無いビルドオプションを指定しているというだけで実害は無いので無視しても良さそう。
気になる場合は
.anyenv/envs/phpenv/plugins/php-build/share/php-build/default_configure_options
から–with-mcryptを削除。
configure: error: Cannot find OpenSSL’s <evp.h>
1 2 | $ sudo yum install openssl-devel |
configure: error: Please reinstall the BZip2 distribution
1 2 | $ sudo yum install bzip2-devel |
configure: error: cURL version 7.10.5 or later is required to compile php with cURL support
1 2 | $ sudo yum install libcurl-devel |
configure: error: jpeglib.h not found.
1 2 | $ sudo yum install libjpeg-devel |
configure: error: png.h not found.
1 2 | $ sudo yum install libpng-devel |
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
1 2 | $ sudo yum install libicu-devel |
configure: error: Please reinstall readline – I cannot find readline.h
1 2 | $ sudo yum install readline-devel |
configure: error: Cannot find libtidy
1 2 | $ sudo yum install libtidy-devel |
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
1 2 | $ sudo yum install libxslt-devel |
configure: WARNING: Use of bundled libzip is deprecated and will be removed.
全文:
1 2 3 4 5 6 | configure: WARNING: ======================================================== configure: WARNING: Use of bundled libzip is deprecated and will be removed. configure: WARNING: Some features such as encryption and bzip2 are not available. configure: WARNING: Use system library and --with-libzip is recommended. configure: WARNING: ======================================================== |
libzip-develを入れて前述のdefault_configure_optionsに–with-libzipを追加したところ
configure: error: system libzip must be upgraded to version >= 0.11
とCentOSリポジトリの最新なのにlibzipが古すぎると言われ、めんどくさそうなので放置しました。WARNINGだし…。
WARNINGしかない、もしくはWARNINGすら無くビルドログも空なのにBUILD ERRORになる
phpenv install -v 7.2.10 でmakeの出力を確認したところ、VPSのメモリが少ないためメモリ不足でエラーになっていました。
1 2 3 4 5 6 7 | virtual memory exhausted: メモリを確保できません cc: コンパイラ内部エラー: 強制終了 (プログラム cc1) Please submit a full bug report, with preprocessed source if appropriate. See <http://bugzilla.redhat.com/bugzilla> for instructions. make: *** [ext/fileinfo/libmagic/apprentice.lo] エラー 1 |
ファイルシステム上にスワップファイルを作成してメモリ不足を補います。とりあえず1Gのスワップファイルを作成します。
参考:How To Add Swap on CentOS 7 | DigitalOcean
1 2 3 4 5 6 7 | $ sudo fallocate -l 1G /swapfile $ sudo chmod 600 /swapfile $ sudo mkswap /swapfile スワップ空間バージョン1を設定します、サイズ = 1048572 KiB ラベルはありません, UUID=9eb6795d-43a4-4400-86e8-1b0ee835aee2 $ sudo swapon /swapfile |
確認
1 2 3 4 | swapon -s Filename Type Size Used Priority /swapfile file 1048572 0 -1 |
これでビルド通りました!
ちなみに作成したスワップファイルを削除する場合は
1 2 3 | $ sudo swapoff /swapfile $ sudo rm /swapfile |
でとするようです。(fstabを記入した場合はそれも消す)