PHP エラー対応「dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib」
MacのOSをmacOS High Sierraにアップデートする前に自分の設定情報を書き出ししておこうとしたらPHPでエラーしたので、作業メモを残します。
$ php --version
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib
Referenced from: /Users/f_prg/.phpenv/versions/7.2.1/bin/php
Reason: image not found
https://blog.tukae.lu/entry/2018/04/07/solve-unknown-type-name-UnicodeString
phpenvの再ビルドらしい。。。
[f_prg@f_prg_config] $ phpenv install 7.2.1
[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 7.2.1 into /Users/f_prg/.phpenv/versions/7.2.1
[Skipping]: Already downloaded and extracted https://secure.php.net/distributions/php-7.2.1.tar.bz2
[Preparing]: /var/tmp/php-build/source/7.2.1
[Compiling]: /var/tmp/php-build/source/7.2.1
-----------------
| BUILD ERROR |
-----------------
Here are the last 10 lines from the log:
-----------------------------------------
^
/var/tmp/php-build/source/7.2.1/ext/intl/intl_convertcpp.cpp:59:40: error: unknown type name 'UnicodeString'; did you mean 'icu_62::UnicodeString'?
zend_string* intl_charFromString(const UnicodeString &from, UErrorCode *status)
^~~~~~~~~~~~~
icu_62::UnicodeString
/usr/local/Cellar/icu4c/62.1/include/unicode/unistr.h:286:20: note: 'icu_62::UnicodeString' declared here
class U_COMMON_API UnicodeString : public Replaceable
^
22 warnings and 4 errors generated.
make: *** [ext/intl/intl_convertcpp.lo] Error 1
-----------------------------------------
The full Log is available at '/tmp/php-build.7.2.1.20180923123019.log'.
[Warn]: Aborting build.
[f_prg@Documents] $ CPPFLAGS+=' -DU_USING_ICU_NAMESPACE=1' phpenv install 7.2.1
[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 7.2.1 into /Users/f_prg/.phpenv/versions/7.2.1
[Skipping]: Already downloaded and extracted https://secure.php.net/distributions/php-7.2.1.tar.bz2
[Preparing]: /var/tmp/php-build/source/7.2.1
[Compiling]: /var/tmp/php-build/source/7.2.1
[xdebug]: Installing version 2.6.0beta1
[Skipping]: Already downloaded http://xdebug.org/files/xdebug-2.6.0beta1.tgz
[xdebug]: Compiling xdebug in /var/tmp/php-build/source/xdebug-2.6.0beta1
[xdebug]: Cleaning up.
[Info]: Enabling Opcache...
[Info]: Done
[Info]: The Log File is not empty, but the Build did not fail. Maybe just warnings got logged. You can review the log in /tmp/php-build.7.2.1.20180924055309.log
[Success]: Built 7.2.1 successfully.
お、できた。okok