CakePHP 3 を Macos (High Sierra) で使おうとして苦労している件。 以下は未解決だけど、記録のために残す。 CakePHP を composer で入れてプロジェクトを作成するところで引っかかったのが最初。 PHP extension の intl がないのが理由。CakePHP サイトにもこれが必要なのは書かれてあるので、そこは仕方ない。 High Sierra にバンドルされている PHP は 7.1.14 なので、brew で intl を探すと、7.0 用はあったが、7.1 向けのものは見つからなかった。 そこで、brew で PHP 7.0 を入れた。バンドル版とは干渉しないようにインストールしてくれるのがありがたい。最後に /usr/local/bin/php(symblic link)を作ると動く。 そうして brew で php70-intl を入れる。これで、揃ったと思ったら動かない。intl が要求する icu ライブラリのバージョンが合わないのだ。 php70-intl が要求しているのはバージョン60(例:icui18n.60.dylib)で、brew で入れた icu4c のはバージョンが61になっている。 60シリーズのライブラリ一式全部に61のシンボリックリンク張ってごまかそうとしたけど、通らなかった。 とにかく intl extension を整えるという目的に立ち返って、別の方法を試すことにした。 以下はその順番と結果。
実際のコンソールログ †intl を pecl でインストールしようとする --> autoconf がないと言われる †$ pecl install intl downloading intl-3.0.0.tgz ... Starting to download intl-3.0.0.tgz (248,200 bytes) ......done: 248,200 bytes 150 source files, building running: phpize Configuring for: PHP Api Version: 20160303 Zend Module Api No: 20160303 Zend Extension Api No: 320160303 Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script. ERROR: `phpize' failed brew で autoconf を入れる --> OK †$ brew install autoconf ==> Downloading https://homebrew.bintray.com/bottles/autoconf-2.69.high_sierra.bottle.4.tar.gz Already downloaded: /Users/bear/Library/Caches/Homebrew/autoconf-2.69.high_sierra.bottle.4.tar.gz ==> 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 改めて intl を pecl でインストールしようとする --> icu がないと言われる †$ pecl install intl downloading intl-3.0.0.tgz ... Starting to download intl-3.0.0.tgz (248,200 bytes) ....................................................done: 248,200 bytes 150 source files, building running: phpize Configuring for: PHP Api Version: 20160303 Zend Module Api No: 20160303 Zend Extension Api No: 320160303 Specify where ICU libraries and headers can be found [DEFAULT] : building in /private/tmp/pear/install/pear-build-kumasru7xJ/intl-3.0.0 running: /private/tmp/pear/install/intl/configure --with-php-config=/usr/bin/php-config --with-icu-dir=DEFAULT checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for a sed that does not truncate output... /usr/bin/sed checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking whether cc understands -c and -o together... yes checking for system library directory... lib checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking build system type... x86_64-apple-darwin17.5.0 checking host system type... x86_64-apple-darwin17.5.0 checking target system type... x86_64-apple-darwin17.5.0 checking for PHP prefix... /usr checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib checking for PHP extension directory... /usr/lib/php/extensions/no-debug-non-zts-20160303 checking for PHP installed headers prefix... /usr/include/php checking if debug is enabled... no checking if zts is enabled... no checking for re2c... no configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk... no checking for nawk... no checking for awk... awk checking if awk is broken... no checking whether to enable internationalization support... yes, shared checking for icu-config... no checking for location of ICU headers and libraries... not found configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works. ERROR: `/private/tmp/pear/install/intl/configure --with-php-config=/usr/bin/php-config --with-icu-dir=DEFAULT' failed brew で icu4c を入れる --> OK †$ brew install icu4u Error: No available formula with the name "icu4u" ==> Searching for a previously deleted formula (in the last month)... Warning: homebrew/core is shallow clone. To get complete history run: git -C "$(brew --repo homebrew/core)" fetch --unshallow Error: No previously deleted formula found. ==> Searching for similarly named formulae... ==> Searching local taps... Error: No similarly named formulae found. ==> Searching taps... ==> Searching taps on GitHub... Error: No formulae found in taps. kuma:~ kuma$ brew search icu ==> Searching local taps... icu4c ploticus ==> Searching taps on GitHub... ==> Searching blacklisted, migrated and deleted formulae... kuma:~ kuma$ brew install 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 再度 intl を pect でインストールする --> php_smart_str.h がないと言われて止まる †$ pecl install intl downloading intl-3.0.0.tgz ... Starting to download intl-3.0.0.tgz (248,200 bytes) ......done: 248,200 bytes 150 source files, building running: phpize Configuring for: PHP Api Version: 20160303 Zend Module Api No: 20160303 Zend Extension Api No: 320160303 Specify where ICU libraries and headers can be found [DEFAULT] : /usr/local/opt/icu4c building in /private/tmp/pear/install/pear-build-kumakiQ7TY/intl-3.0.0 running: /private/tmp/pear/install/intl/configure --with-php-config=/usr/bin/php-config --with-icu-dir=/usr/local/opt/icu4c checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for a sed that does not truncate output... /usr/bin/sed checking for cc... cc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking whether cc understands -c and -o together... yes checking for system library directory... lib checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking build system type... x86_64-apple-darwin17.5.0 checking host system type... x86_64-apple-darwin17.5.0 checking target system type... x86_64-apple-darwin17.5.0 checking for PHP prefix... /usr checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib checking for PHP extension directory... /usr/lib/php/extensions/no-debug-non-zts-20160303 checking for PHP installed headers prefix... /usr/include/php checking if debug is enabled... no checking if zts is enabled... no checking for re2c... no configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk... no checking for nawk... no checking for awk... awk checking if awk is broken... no checking whether to enable internationalization support... yes, shared checking for location of ICU headers and libraries... /usr/local/Cellar/icu4c/61.1 checking for ICU 4.0 or greater... found 61.1 checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking how to run the C++ preprocessor... g++ -E checking for ld used by cc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -B checking whether ln -s works... yes checking how to recognize dependent libraries... pass_all checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking how to run the C++ preprocessor... g++ -E checking the maximum length of command line arguments... 196608 checking command to parse /usr/bin/nm -B output from cc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking for dsymutil... dsymutil checking for nmedit... nmedit checking for -single_module linker flag... yes checking for -exported_symbols_list linker flag... yes checking if cc supports -fno-rtti -fno-exceptions... yes checking for cc option to produce PIC... -fno-common checking if cc PIC flag -fno-common works... yes checking if cc static flag -static works... no checking if cc supports -c -o file.o... yes checking whether the cc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... darwin17.5.0 dyld checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no creating libtool appending configuration tag "CXX" to libtool checking for ld used by g++... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes checking for g++ option to produce PIC... -fno-common checking if g++ PIC flag -fno-common works... yes checking if g++ static flag -static works... no checking if g++ supports -c -o file.o... yes checking whether the g++ linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... darwin17.5.0 dyld (cached) (cached) checking how to hardcode library paths into programs... immediate configure: creating ./config.status config.status: creating config.h running: make /bin/sh /private/tmp/pear/install/pear-build-kumakiQ7TY/intl-3.0.0/libtool --mode=compile cc -I/usr/local/Cellar/icu4c/61.1/include -Wno-write-strings -I. -I/private/tmp/pear/install/intl -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-kumakiQ7TY/intl-3.0.0/include -I/private/tmp/pear/install/pear-build-kumakiQ7TY/intl-3.0.0/main -I/private/tmp/pear/install/intl -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/Cellar/icu4c/61.1/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/install/intl/php_intl.c -o php_intl.lo mkdir .libs cc -I/usr/local/Cellar/icu4c/61.1/include -Wno-write-strings -I. -I/private/tmp/pear/install/intl -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-kumakiQ7TY/intl-3.0.0/include -I/private/tmp/pear/install/pear-build-kumakiQ7TY/intl-3.0.0/main -I/private/tmp/pear/install/intl -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/Cellar/icu4c/61.1/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/install/intl/php_intl.c -fno-common -DPIC -o .libs/php_intl.o In file included from /private/tmp/pear/install/intl/php_intl.c:25: In file included from /private/tmp/pear/install/intl/php_intl.h:34: /private/tmp/pear/install/intl/intl_error.h:24:10: fatal error: 'ext/standard/php_smart_str.h' file not found #include <ext/standard/php_smart_str.h> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. make: *** [php_intl.lo] Error 1 ERROR: `make' failed |