Search code examples
xcodecocoadynamic-library

Loading Dynamic Libraries on Outisde Computers


so I built my project and it runs just fine on my own computer, but it does not run on others's. The reason is because I am using the GMP library which is not on their system, so I am wondering how do I fix that?

The console spit this error message out:


Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000002, 0x0000000000000000

Application Specific Information: dyld: launch, loading dependent libraries

Dyld Error Message: Library not loaded: /usr/local/lib/libgmp.10.dylib Referenced from: /Users/USER/Downloads/NSnAy.app/Contents/MacOS/NSnAy.temp_caseinsensitive_rename Reason: image not found


I made this change, which didn't change anything. I also saw this, but it didn't really help me either. I also included the .dylib file in the bundle resources, so maybe if I could somehow set the access link to the content package of the app it might work? But I don't know how, any help would be appreciated!


Solution

  • It seems as though you've missed a critical step: adding a Copy Files build phase in your target's build phases, set to copy your local copy of the library into the application bundle as a library (not a resource, which will end up in the Resources subfolder of the app bundle).

    This question/answer may help you.

    This post by Mike Ash is also helpful though you've indicated you've already set the @executable_path (worth double-checking to verify it's set that way for your release build too though).