IT

dyld : 라이브러리가로드되지 않음 : Mac에서 brew를 사용하여 노드를 설치 한 후 PHP를 실행하는 /usr/local/opt/icu4c/lib/libicui18n.62.dylib 오류

lottoking 2020. 5. 16. 10:39
반응형

dyld : 라이브러리가로드되지 않음 : Mac에서 brew를 사용하여 노드를 설치 한 후 PHP를 실행하는 /usr/local/opt/icu4c/lib/libicui18n.62.dylib 오류


homebrew (Mojave)를 사용하여 노드를 설치 한 후 PHP가 작동을 멈추고 실행하려고 php -v하면이 오류가 발생합니다.

php -v
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found

노드와 icu4c를 모두 제거하려고 시도했지만 문제가 지속됩니다.


필자의 경우 icu4c가 버전 63으로 업그레이드되었지만 로컬에 설치된 postgres 이미지가 여전히 icu4c 62.1을 참조했기 때문에 발생했습니다. 따라서 사용 된 icu4c 버전을 변경해야했습니다.

 brew info icu4c
 brew switch icu4c <version>

version설치된 버전은 어디에서 반환됩니까?info


참고 -이렇게하면 PHP 버전이 업그레이드됩니다.

방금이 같은 문제가있었습니다. Homebrew를 업그레이드하고 정리하는 것이 저에게 효과적이었습니다. 이 오류는 패키지 버전이 일치하지 않아 나에게 나타났습니다. 위의 해결책 중 어느 것도 내 오류를 해결하지 못했지만 다음 homebrew 명령을 실행하면 효과가 없습니다.

brew upgrade

주의 -모든 추출 패키지를 업그레이드합니다. 특정 패키지 만 업그레이드하려면 구체적이어야합니다.

brew upgrade // for upgrading all packages -- this is the command I used

brew upgrade {package} // for upgrading a specific package

그리고

brew cleanup

@Grey Black과 같이 icu4c의 v62.1을 실제로 설치해야한다는 것이 밝혀졌습니다. 다른 일이 없었습니다.

그러나 brew switch icu4c 62.1이전에 62.1을 설치 한 경우에만 작동합니다. 더 많은 레그 워크가 없다면 Homebrew 를 사용하면 이전 버전의 수식을 쉽게 설치할 수 없습니다 .

내가 한 방법은 다음과 같습니다.

  1. 먼저 Homebrew 저장소의 깊은 복제본이 필요합니다. 시간이 다소 걸릴 수 있습니다.git -C $(brew --repo homebrew/core) fetch --unshallow
  2. brew log icu4c62.1을 참조하는 커밋을 추적하기 위해; 575eb4b트릭을 수행합니다.
  3. cd $(brew --repo homebrew/core)
  4. git checkout 575eb4b -- Formula/icu4c.rb
  5. brew uninstall --ignore-dependencies icu4c
  6. brew install icu4c이제 올바른 버전의 종속성이 있어야합니다! 이제는 ...
  7. git reset && git checkout . 수정 된 레시피를 정리하십시오.

macOS버전으로 업그레이드 한 후에도 같은 문제가 발생했습니다 10.13.6. 나는 실행할 수 없습니다 composerphp명령. 잠시 연구하고 온라인으로 게시 된 다양한 솔루션을 시도한 후 php를 다시 설치하면 homebrew효과가있었습니다.

brew reinstall php@7.1

Ryan의 의견에 따라 3 월 14 일에 추가됨

위 명령에서 대체 php -v할 올바른 수식 ( https://formulae.brew.sh/formula/php )을 실행하여 현재 사용중인 버전을 얻으십시오 @7.1.


실제로이 솔루션이 아직 발표되지 않았다는 사실에 놀랐으며 가장 쉬운 솔루션이라고 생각합니다.

GitHub로 이동하여 icu4c필요한 버전과 일치하는 brewfile 버전을 찾은 다음 파일의 원시 버전을 가져옵니다 (위의 링크를 클릭 View File한 다음을 클릭 Raw).

그런 다음 해당 URL에서 다시 설치하십시오.

예를 들어, version 62.1:

brew reinstall https://raw.githubusercontent.com/Homebrew/homebrew-core/575eb4bbef683551e19f329f60456b13a558132f/Formula/icu4c.rb

실행 npm version하고 동일한 오류가 표시되는지 확인하십시오.

그렇다면 노드 버전을 업그레이드하십시오 brew upgrade npm.

==> Upgrading 1 outdated package, with result:
npm 8.1.2 -> 10.3.0
==> Upgrading npm
==> Installing dependencies for node: icu4c
==> Installing node dependency: icu4c

크레딧


이것은 나를 위해 그것을 고쳤다 :

brew upgrade node

그냥 brew remove phpbrew install php작동도하지 않았다 brew reinstall php. 내 해결책은 다음과 같습니다.

brew remove php
cd /usr/local/Cellar
rm -rf php/
brew install php
brew doctor
brew cleanup

이제 php -v나에게 :

PHP 7.3.2 (cli) (built: Feb 14 2019 10:08:45) ( NTS )

icu4c이전 (사전 컴파일 된) PHP가 연결할 수 있는 이전 버전을 설치하는 것 보다 최신 라이브러리에 연결하기 위해 이전 PHP를 다시 컴파일하는 것이 좋습니다.

brew uninstall php@7.2
brew install --build-from-source php@7.2

This will build php and link it to the newer library. I found reinstall didn't quite work; the new install choked when the destination folder already existed.

I also did brew link --force php@7.2 for my environment.


Leland's answer worked for me, but I had to change steps 4 and 6 to:

4) git checkout -B icu4c-62.1 575eb4b

6) brew reinstall Formula/icu4c.rb


I had problems because my version of PHP (7.3) was expecting icu4c 63 and brew would only install 64.

https://stackoverflow.com/a/55828190/2000947 helped me install 63.


In order to downgrade, i had to recompile from source (MacOS Mojave)

$ wget https://ssl.icu-project.org/files/icu4c/62.1/icu4c-62_1-src.tgz
$ tar xvfz icu4c-62_1-src.tgz
$ cd icu/sources
$ ./configure
$ make
$ make install

Seems like it is impossible to link icu4c using brew after latest OS X update. Which makes things more interesting. The only solution I found working for me:

  1. Download and compile icu4c 62.1 to /usr/local/icu4c/62.1
mkdir ~/sources
cd ~/sources
wget http://download.icu-project.org/files/icu4c/62.1/icu4c-62_1-src.tgz
tar xvzf icu4c-62_1-src.tgz
cd icu/source/

sudo mkdir /usr/local/icu4c/62.1
./configure --prefix=/usr/local/icu4c/62.1
make
sudo make install
  1. Link libs:
ln -s /usr/local/icu4c/62.1/lib/*.dylib /usr/local/include/
  1. Set DYLD_LIBRARY_PATH in ~/.bash_profile:
export DYLD_LIBRARY_PATH=/usr/local/include

Got this error, too, after installing php 7.3. I had it resolved upgrading just my old php's versions (5.6 and 7.0, not from the official repos).

The maintainers had compiled new php versions against the current icu4c.

In my case, PHP 7 got from 0.31 to 0.33, and the problem was solved.


On MacOS Mojave, only way I could fix it was with brew upgrade

참고URL : https://stackoverflow.com/questions/53828891/dyld-library-not-loaded-usr-local-opt-icu4c-lib-libicui18n-62-dylib-error-run

반응형