CakePHP

3系をInstallマニュアルに従ってmacosにインストールする

CakePHP 3.x を入れようとしたら、要求ライブラリ(extension)にintlがあるので、brewで入れたところ、icuライブラリを読み込めないとエラーが出た。

ライブラリのバージョン違いのようなので、PHP自身も7.0に入れ直したけどダメ。icuライブラリも入れ直したけどダメ。

上記の実際

まず、intl ライブラリを入れるところ。

$ brew install php70-intl
Updating Homebrew...
==> Installing php70-intl from homebrew/php
==> Installing dependencies for homebrew/php/php70-intl: icu4c
==> Installing homebrew/php/php70-intl dependency: icu4c
==> Downloading https://homebrew.bintray.com/bottles/icu4c-61.1.high_sierra.bottle.tar.gz
Already downloaded: /Users/bear/Library/Caches/Homebrew/icu4c-61.1.high_sierra.bottle.tar.gz
==> Pouring icu4c-61.1.high_sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/icu4c/lib
    CPPFLAGS: -I/usr/local/opt/icu4c/include

==> Summary
🍺  /usr/local/Cellar/icu4c/61.1: 249 files, 67.2MB
==> Installing homebrew/php/php70-intl
==> Downloading https://homebrew.bintray.com/bottles-php/php70-intl-7.0.27_24.high_sierra.bottle.tar.gz
Already downloaded: /Users/bear/Library/Caches/Homebrew/php70-intl-7.0.27_24.high_sierra.bottle.tar.gz
==> Pouring php70-intl-7.0.27_24.high_sierra.bottle.tar.gz
==> Caveats
To finish installing intl for PHP 7.0:
  * /usr/local/etc/php/7.0/conf.d/ext-intl.ini was created,
   do not forget to remove it upon extension removal.
  * Validate installation via one of the following methods:
  *
  * Using PHP from a webserver:
  * - Restart your webserver.
  * - Write a PHP page that calls "phpinfo();"
  * - Load it in a browser and look for the info on the intl module.
  * - If you see it, you have been successful!
  *
  * Using PHP from the command line:
  * - Run `php -i "(command-line 'phpinfo()')"`
  * - Look for the info on the intl module.
  * - If you see it, you have been successful!
==> Summary
🍺  /usr/local/Cellar/php70-intl/7.0.27_24: 7 files, 503.7KB

で、確認してみると、こうなる。

$ php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php70-intl/7.0.27_24/intl.so' - dlopen(/usr/local/Cellar/php70-intl/7.0.27_24/intl.so, 9): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib
 Referenced from: /usr/local/Cellar/php70-intl/7.0.27_24/intl.so
 Reason: image not found in Unknown on line 0
PHP 7.1.14 (cli) (built: Feb  7 2018 18:33:30) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

ここで、見つからないと言われているライブラリファイルは "/usr/local/opt/icu4c/lib/icui18n.60.dylib" で、確かにこいつは存在しない。あるのは、バージョンが60じゃなくて61のとかだ。

かといって、icu4c を入れ直しても状況は変わらない。

どうすりゃいいんだろうな。これ。

Web漁って、ソースからのre-installをやってみた。

$ brew reinstall --build-from-source php70-intl
==> Reinstalling homebrew/php/php70-intl 
==> Installing dependencies for homebrew/php/php70-intl: autoconf
==> Installing homebrew/php/php70-intl dependency: autoconf
==> Downloading https://homebrew.bintray.com/bottles/autoconf-2.69.high_sierra.bottle.4.tar.gz
######################################################################## 100.0%
==> Pouring autoconf-2.69.high_sierra.bottle.4.tar.gz
==> Caveats
Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/autoconf
==> Summary
🍺  /usr/local/Cellar/autoconf/2.69: 71 files, 3.0MB
==> Installing homebrew/php/php70-intl
==> Downloading https://php.net/get/php-7.0.27.tar.bz2/from/this/mirror
==> Downloading from https://secure.php.net/get/php-7.0.27.tar.bz2/from/this/mirror
######################################################################## 100.0%
==> /usr/local/opt/php70/bin/phpize
==> ./configure --prefix=/usr/local/Cellar/php70-intl/7.0.27_24 --with-php-config=/usr/local/opt/php70/bin/php-config --enable-intl --with-icu-dir=/usr/local/opt/icu4c
==> make
Last 15 lines from /Users/bear/Library/Logs/Homebrew/php70-intl/03.make:
clang -I/usr/local/Cellar/icu4c/61.1/include -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/private/tmp/php70-intl-20180330-8964-9sz73/php-7.0.27/ext/intl -DPHP_ATOM_INC -I/private/tmp/php70-intl-20180330-8964-9sz73/php-7.0.27/ext/intl/include -I/private/tmp/php70-intl-20180330-8964-9sz73/php-7.0.27/ext/intl/main -I/private/tmp/php70-intl-20180330-8964-9sz73/php-7.0.27/ext/intl -I/usr/local/Cellar/php70/7.0.27_19/include/php -I/usr/local/Cellar/php70/7.0.27_19/include/php/main -I/usr/local/Cellar/php70/7.0.27_19/include/php/TSRM -I/usr/local/Cellar/php70/7.0.27_19/include/php/Zend -I/usr/local/Cellar/php70/7.0.27_19/include/php/ext -I/usr/local/Cellar/php70/7.0.27_19/include/php/ext/date/lib -I/usr/local/Cellar/icu4c/61.1/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/php70-intl-20180330-8964-9sz73/php-7.0.27/ext/intl/collator/collator_class.c  -fno-common -DPIC -o collator/.libs/collator_class.o
clang -I/usr/local/Cellar/icu4c/61.1/include -Wno-write-strings -D__STDC_LIMIT_MACROS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/private/tmp/php70-intl-20180330-8964-9sz73/php-7.0.27/ext/intl -DPHP_ATOM_INC -I/private/tmp/php70-intl-20180330-8964-9sz73/php-7.0.27/ext/intl/include -I/private/tmp/php70-intl-20180330-8964-9sz73/php-7.0.27/ext/intl/main -I/private/tmp/php70-intl-20180330-8964-9sz73/php-7.0.27/ext/intl -I/usr/local/Cellar/php70/7.0.27_19/include/php -I/usr/local/Cellar/php70/7.0.27_19/include/php/main -I/usr/local/Cellar/php70/7.0.27_19/include/php/TSRM -I/usr/local/Cellar/php70/7.0.27_19/include/php/Zend -I/usr/local/Cellar/php70/7.0.27_19/include/php/ext -I/usr/local/Cellar/php70/7.0.27_19/include/php/ext/date/lib -I/usr/local/Cellar/icu4c/61.1/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/php70-intl-20180330-8964-9sz73/php-7.0.27/ext/intl/collator/collator_sort.c  -fno-common -DPIC -o collator/.libs/collator_sort.o
/private/tmp/php70-intl-20180330-8964-9sz73/php-7.0.27/ext/intl/intl_convertcpp.cpp:28:25: error: unknown type name 'UnicodeString'
int intl_stringFromChar(UnicodeString &ret, char *str, size_t str_len, UErrorCode *status)
                         ^
/private/tmp/php70-intl-20180330-8964-9sz73/php-7.0.27/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
                   ^
4 errors generated.
make: *** [intl_convertcpp.lo] Error 1 
make: *** Waiting for unfinished jobs....

READ THIS: https://docs.brew.sh/Troubleshooting

These open issues may also help:
Unable to install php70-intl.so https://github.com/Homebrew/homebrew-php/issues/4831

いやー、こんなの見ても意味が分からないわ。


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS