とつぜんPHPコマンドでエラーが起き出して調べてみました。
環境
- macOS High Sierra 10.13.4
- homebrew 1.6.0
- phpenv v0.0.4-dev
現象
php -vやcomposer -vで下記のようなエラーが起きた
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.xx.dylib
xxのところのバージョンを失念してしまいました。
58かなー、61かなー。
なのでphpをインストールしなおそうとしたら
$ phpenv install 7.2.0
下記のようなエラーが
-----------------
| BUILD ERROR |
-----------------
Here are the last 10 lines from the log:
-----------------------------------------
^
/var/tmp/php-build/source/7.2.0/ext/intl/intl_convertcpp.cpp:59:40: error: unknown type name 'UnicodeString'; did you mean 'icu_61::UnicodeString'?
zend_string* intl_charFromString(const UnicodeString &from, UErrorCode *status)
^~~~~~~~~~~~~
icu_61::UnicodeString
/usr/local/Cellar/icu4c/61.1/include/unicode/unistr.h:286:20: note: 'icu_61::UnicodeString' declared here
class U_COMMON_API UnicodeString : public Replaceable
^
22 warnings and 4 errors generated.
make: *** [ext/intl/intl_convertcpp.lo] Error 1
-----------------------------------------
原因と対処
このサイトに書いてあるままに。
PHPインストール時のerror: unknown type name 'UnicodeString'を解消する