Ubuntu 20.04 で phpenv にて PHP をインストールしようとした際に oniguruma が not found になった場合

結論

$ sudo apt install -y libonig-dev

(参考)エラー時に表示されるメッセージ

$ phpenv install 8.1.2
[Info]: Loaded extension plugin
[Info]: Loaded apc Plugin.
[Info]: Loaded composer Plugin.
[Info]: Loaded github Plugin.
[Info]: Loaded uprofiler Plugin.
[Info]: Loaded xdebug Plugin.
[Info]: Loaded xhprof Plugin.
[Info]: Loaded zendopcache Plugin.
[Info]: php.ini-production gets used as php.ini
[Info]: Building 8.1.2 into /home/xxxxx/.phpenv/versions/8.1.2
[Skipping]: Already downloaded and extracted https://www.php.net/distributions/php-8.1.2.tar.bz2
[Preparing]: /tmp/php-build/source/8.1.2

-----------------
|  BUILD ERROR  |
-----------------

Here are the last 10 lines from the log:

-----------------------------------------
configure: error: Package requirements (oniguruma) were not met:

No package 'oniguruma' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables ONIG_CFLAGS
and ONIG_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
-----------------------------------------

The full Log is available at '/tmp/php-build.8.1.2.20220214093733.log'.
[Warn]: Aborting build.

gyazo.com

Powered by はてなブログ