Xcode Issue: Library Not Loaded: @Rpath/Libswiftappkit.Dylib

dyld: Library not loaded: @rpath/libswift_stdlib_core.dylib

For me none of the previous solutions worked. We discovered that there is a flag ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES (in earlier versions: "Embedded Content Contains Swift Code") in the Build Settings that needs to be set to YES. It was NO by default!

macOS Command Line Tool with Swift Cocoa Framework: Library not loaded

Swift Package Manager sets the following, which resolved this issue for me in another project:

SWIFT_FORCE_DYNAMIC_LINK_STDLIB = YES
SWIFT_FORCE_STATIC_LINK_STDLIB = NO

Note that the search path was set to:

LD_RUNPATH_SEARCH_PATHS = $(TOOLCHAIN_DIR)/usr/lib/swift/macosx @executable_path

dyld: Library not loaded: @rpath/libswiftDispatch.dylib

I am using AVG Free for Mac. Yesterday it removed libswiftDispatch.dylib to quarantine because of 'MacOS:BitCoinMiner-AS'. This seems like a false positive, see:
https://discussions.agilebits.com/discussion/86860/avg-quarantined-1password-libswiftdispatch-dylib/p2
https://forum.avast.com/index.php?topic=216164.msg1449648#msg1449648 (AVG and Avast are the same company)

So for me the fix was restoring this file from quarantine.

Where are the Search Paths options in Xcode?

Open Xcode,

  1. Select Project
  2. Select Target
  3. Select Build Setting
  4. Type 'Search Path' in Search Box
    (or both 'Library Search Paths' and 'Runpath Search Paths')

Crash on dyld: Library not loaded: /usr/lib/swift/libswift_Concurrency.dylib running on simulator

Found a solution based on what @vera-gonzalez did on her case.
THIS IS NOT A PRODUCTION CODE.
I also downloaded the PKG file from the swift snapshots https://swift.org/download/#snapshots, I got both versions (iphoneos and iphonesimulator) from /Library/Developer/toolchains/<snapshotname>/usr/lib/swift/<version>/libswift_Concurrency.dylib

After that I created a fat dylib file with lipo:

❯ lipo iphoneos/libswift_Concurrency.dylib iphonesimulator/libswift_Concurrency.dylib -create -output libswift_Concurrency.dylib
❯ lipo -info libswift_Concurrency.dylib
Architectures in the fat file: libswift_Concurrency.dylib are: armv7 armv7s i386 x86_64 arm64 arm64e

After that, I added this dylib file to my project as an Optional Library, on the target of my project.
image showing the Link Binary With Libraries, showing the Optional on the lib selected

With that trick I can build, run and archive for both device and simulator on my project for now (the discussion on Swift Forum indicates that this is going to be fixed sometime, but meanwhile, we can test our apps with this)



Related Topics



Leave a reply



Submit