Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.61.dylib

 

前天mac用brew安装NodeJs时候 ,把icu4c这个目录中的lib/libicui18n.61.dylib搞丢了,nodeJs需要的可能是libicui18n.64.dylib这个版本,但是安装是时候把PHP依赖的libicui18n.61.dylib丢了,是删除了还是升级了,不知道,反正是没有了。在我运行PHP的包工具composer时候,运行命令:composer install,出现下面错误: 

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.61.dylib
  Referenced from: /usr/local/opt/[email protected]/bin/php
  Reason: image not found
Abort trap: 6

 解决方法:

1,下载libicui18n.61.dylib 这个包,地址:https://ssl.icu-project.org/files/icu4c/

      注意一定要是icu4c-61_1-src.tgz 这个,不要下zip的,zip是针对win系统的,会报错。如下:

localhost:Downloads fangliang$ ./icu/source/configure
-bash: ./icu/source/configure: /bin/sh^M: bad interpreter: No such file or directory

上面这个问题也可以解决:

先在控制台cd到报错的目录

vi configure
:set ff ?
如果出现fileforma=dos那么就基本可以确定是这个问题了。
:set fileformat=unix
:wq

 2, 下载到机器什么地方都可以,解压tar -xzvf icu4c-61_1-src.tgz

     1,配置,编译,安装。如下:

cd ./source
./configure
make
make install

在configure时候可能出现下面的错误:

configure: error: in `/Users/fangliang/Downloads/icu':
configure: error: C compiler cannot create executables
See `config.log' for more details

3,查看config.log,可能会看到这样的错误:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
configure:2971: $? = 1
configure:2960: clang -v >&5
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
configure:2971: $? = 1
configure:2960: clang -V >&5
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
configure:2971: $? = 1
configure:2960: clang -qversion >&5
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
configure:2971: $? = 1
configure:2991: checking whether the C compiler works
configure:3013: clang    conftest.c  >&5
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

4,证明xcrun没有安装。在终端执行xcrun,安装:

xcode-select --install

5,安装成功之后。

make 成功

make install 成功

6,验证PHP 

    PHP --version  可用

  composer install  可用

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章