Programing

dyld : 라이브러리가로드되지 않았습니다… 이유 : 이미지를 찾을 수 없습니다

lottogame 2020. 4. 30. 07:25
반응형

dyld : 라이브러리가로드되지 않았습니다… 이유 : 이미지를 찾을 수 없습니다


Mac OS X에서 보낸 실행 파일을 실행하려고하면 다음 오류가 발생합니다.

dyld: Library not loaded: libboost_atomic.dylib
  Referenced from: /Users/"Directory my executable is in"
  Reason: image not found
Trace/BPT trap:5

부스트 라이브러리를 설치했으며에 있습니다 /opt/local/lib. 문제는 거기에 'libboost_atomic.dylib'를 붙여 넣을 때와 같은 디렉토리에서만 실행 파일과 관련이 있다고 생각합니다. 더 이상 신경 쓰지 않습니다. 불행히도 다음 부스트 라이브러리를 찾을 수 없다고 불평합니다.

이 문제를 해결하는 쉬운 방법이 있습니까?


모든 부스트 라이브러리를 찾으십시오.

$ otool -L exefile
exefile:
        @executable_path/libboost_something.dylib (compatibility version 0.7.0, current version 0.7.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 65.1.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)

그리고 각각에 대해 다음 libboost_xxx.dylib을 수행하십시오.

$ install_name_tool -change @executable_path/libboost_something.dylib /opt/local/lib/libboost_something.dylib exefile

마지막으로 otool다시 사용하여 확인 하십시오.

$ otool -L exefile
exefile:
        /opt/local/lib/libboost_something.dylib (compatibility version 0.7.0, current version 0.7.0)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 65.1.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)

맨 페이지 : otool install_name_tool

다시 편집 A 나는 파이썬 스크립트 ( copy_dylibs.py)를 작성 하여 앱을 만들 때이 모든 것을 자동으로 해결했습니다. 앱 번들 에서 /usr/local또는 /opt/local앱 번들로 모든 라이브러리를 패키지하고 사용할 라이브러리에 대한 참조를 수정합니다 @rpath. 즉, Homebrew를 사용하여 타사 라이브러리를 쉽게 설치하고 쉽게 패키징 할 수 있습니다.

이제이 스크립트를 github에 공개했습니다 .


대상의에서 General tab,이 생길 것입니다 Embedded Binaries field.

추가해야 framework하며 충돌이 해결됩니다.

여기에 이미지 설명을 입력하십시오

+기호를 클릭 하고 추가framework


이것은 나를 위해 일했다 :

brew upgrade node

일부의 경우 동적 라이브러리의 시스템 경로를 설정하는 것만 큼 쉽습니다. OS X에서는 DYLD_LIBRARY_PATH환경 변수 를 설정하는 것만 큼 간단 합니다. 보다:

Mac OS X에서 DYLD_LIBRARY_PATH를 사용해도 되나요? 동적 라이브러리 검색 알고리즘은 무엇입니까?


Mac OS를 Mojave로 업그레이드 한 후 yarn명령을 통해 npm 모듈을 설치하려고했는데 오류가 발생했습니다.

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib
  Referenced from: /usr/local/bin/node
  Reason: image not found
Abort trap: 6

다음과 같이 수정되었습니다.

brew update
brew upgrade

rvm을 사용하여 ruby ​​2.3.1을 설치하려고 할 때이 오류가 발생했습니다. 먼저 나에게 실행하도록 지시 brew update한 다음 달리기를 시도했을 rvm install ruby-2.3.1때이 SO 질문에 오류가 발생했습니다.

brew upgradesuperuser.com 질문 에 따르면 수정은 처음에 실행되었으며 brew update&& 모두 수행해야합니다 brew upgrade. 일단 완료되면 마침내 루비 2.3.1을 설치할 수 있습니다.


실행 파일에 otool 명령을 -L 옵션과 함께 사용하면 실행 파일이 해당 라이브러리가있는 위치를 표시합니다.

If the path to those need changing, use the install_name_tool command, which allows you to set the path to the libraries.


I got here trying to run a program I just compiled using CMake. When I try to run it, it complains saying:

dyld: Library not loaded: libboost_system.dylib
  Referenced from: /Users/path/to/my/executable
  Reason: image not found

I circumvented the problem telling CMake to use the static version of Boost, instead of letting it use the dynamic one:

set(Boost_USE_STATIC_LIBS ON)

I fix it by brew install libpng


For anyone coming to this page because they got this error trying to link a third party framework to their project using Xcode 6.3.1, the problem I ran into was because the library was being created with an older version of the compiler using a different version of swift. The only way to fix this for me was to re-build the framework.

Another reason you might get this is stated in an Apple technical doc..

If you are building an app that does not use Swift but embeds content such as a framework that does, Xcode will not include these libraries in your app. As a result, your app will crash upon launching with an error message looking as follows:

set the Embedded Content Contains Swift Code (EMBEDDED_CONTENT_CONTAINS_SWIFT) build setting to YES in your app

Here is the link to the full Apple doc that explains it here


You can use sudo install_name_tool -change change dylib path And sudo install_name_tool -id change dylib name


I faced the app crash issue quoting SIGABRT error in thread.Overview of the crash is dyld library not loaded and image not found something like that.

This was seen in xcode 9.3 version.The reason i found out was xcode is not picking up libraries dynamically so i had to do it manually which solved my crash issue.

Follow the below steps: Step 1: Go to Build Phases Step 2: Hit the '+' button at the top and select "New Copy File Phase" Step 3 : Select Destination as Frameworks and Hit the '+' button below to add files. Step 4 : Select Add Other at below, click CMD+SHIFT+G and paste the below path, /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos

Now you will be able to see some swift dylibs, Select all the swift libraries with .dylib extension and click on open.

These will get added to the embedded binaries in the general tab of app.

Create a new group in project folder and add all these libraries.

Now run your app.

Happy Coding


For anyone experiencing the same thing with a different library or package, @user3835452 is on the right track. I found this message while trying to run composer:

dyld: Library not loaded: /usr/local/opt/openldap/lib/libldap-2.4.2.dylib
  Referenced from: /usr/local/opt/php@7.1/bin/php
  Reason: image not found
Abort trap: 6

After trying a lot of different ways I just ran brew install openldap and it fixed it. Note that I had already ran brew update and brew upgrade but only after I manually installed openldap did it actually work.


Maybe someone need this:

if you use cmake, add DYLIB_INSTALL_NAME_BASE "@rpath" to target properties:

set_target_properties(target_dyLib PROPERTIES
        # # for FRAMEWORK begin
        # FRAMEWORK TRUE
        # FRAMEWORK_VERSION C
        # MACOSX_FRAMEWORK_IDENTIFIER com.cmake.targetname
        # MACOSX_FRAMEWORK_INFO_PLIST ./Info.plist
        # PUBLIC_HEADER targetname.h
        # # for FRAMEWORK end
        IPHONEOS_DEPLOYMENT_TARGET "8.0"
        DYLIB_INSTALL_NAME_BASE "@rpath" # this is the key point
        XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
        DEVELOPMENT_TEAM "${DEVELOPMENT_TEAM}"
    )

or in xcode dynamic library project Target -> Build Setting set Dynamic Library Install Name Base to @rpath


I fixed this by reinstalling Homebrew

Uninstall

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

Install

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


I fixed this issue by simply pressing Command + Shift + K, which makes a new clean build, really odd.


Is there an easy way to fix this?

방금 사용했습니다 brew upgrade <the tool>. 제 경우에는 brew upgrade tmux.


이제 X-Code가 IDE를 업그레이드 했으므로이 기능이 약간 변경되었습니다. 이전에 'Embedded Binaries'와 'Linked Frameworks and Libraries'를 별도의 섹션으로 사용하여 위에서 설명한 것처럼 별도의 섹션으로 분할되었습니다. 이제 포함해야 할 항목에 대한 드롭 다운이 오른쪽에있는 하나의 결합 된 섹션입니다. 처음에는 혼란 스러웠지만 지금은 완벽합니다.

새로운 IDE 변경


위의 어느 것도 나를 위해 일하지는 brew reinstall icu4c않았지만 그렇게했습니다.

참고 URL : https://stackoverflow.com/questions/17703510/dyld-library-not-loaded-reason-image-not-found

반응형