I am trying to install the PHP Intl extension on my new Mac (El Capitan 10.11.4) using PECL, but there is a linking error during the
Here are the steps I took:
Installed PEAR to run on Mac
Compiled and installed the ICU library (version 51.2) into
Ran this command:
sudo pecl install intland there was an error (see below). I also tried compiling the extension directly from the PHP source code (“ext” folder) and received the same error message.
I am getting the following error:
ld: file not found: libicudata.51.dylib for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [intl.la] Error 1 ERROR: 'make' failed
It looks like:
The file is missing (even though it knows the correct ICU library version to look for). Maybe it truly can’t find the file. The
-Lswitch and related switches appear to point to the correct path
Then, there is also some sort of architecture mismatch. So, I ran
file libicudata.51.dyliband it appears to be the right architecture.
Here is what
$ file /usr/local/lib/libicudata.51.dylib /usr/local/lib/libicudata.51.dylib: Mach-O 64-bit dynamically linked shared library x86_64
Has anyone run across this before? Or know how to compile PHP’s Intl extension on the new Mac Book Pro (El Capitan 10.11.4)? I a hoping for some hints on where to look next, because I am a bit stumped here.
I fixed this problem,here is my environment:
OS : El Capitan 10.11.4
PHP : php-7.0.5
icu : 55.1
the key point is reinstall ICU using
./configure --prefix=/opt/oss/icu --enable-release --enable-shared --enable-rpath --enable-tools
If you want to know why,please run as root
otool -L $YOUR_ICU_PREFIX/lib/libicudata.dylib
to check if the first library is absolute path.
Maybe you can try just this:
brew install php56-intl
You might consider looking at these threads (https://github.com/Homebrew/homebrew-php/issues/1701) and (https://github.com/Homebrew/homebrew-php/issues/1710). I tried to reproduce your error but I failed. The most probable reason would be an icu4c that is not linked.
brew link --force icu4c
I tried using php70 and
sudo pecl install intl
failed. I tried using php56, everything ran smoothly.
php -v master, something like this should show up
C02QH2D7G8WM:workspace userone$ php -v master PHP 5.6.20 (cli) (built: Apr 1 2016 08:53:48) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
brew install homebrew/php/php56-intl