Kingfisher: Library not loaded: @rpath/libswiftAccelerate.dylib

Issue Description

What

When including Kingfisher using latest Carthage in a project which has subprojects as components, when running one of the subprojects tests we get the following error:

2018-04-17 14:14:03.494908+0200 xctest[8052:65955] The bundle “MyProjectUITests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2018-04-17 14:14:03.495059+0200 xctest[8052:65955] (dlopen_preflight(/Users/Me/Library/Developer/Xcode/DerivedData/MyProjectiOS-cmerazywlpjaaidjguatkfroiqih/Build/Products/Debug-iphonesimulator/MyProjectUITests.xctest/FitterYouUITests): Library not loaded: @rpath/libswiftAccelerate.dylib
  Referenced from: /Users/Me/Code/Apple/MyProject/Carthage/Build/iOS/Kingfisher.framework/Kingfisher
  Reason: image not found)
Program ended with exit code: 82

Other Comment

As you can see it seems there’s an issue with the Accellerate framework which is included. I’m guessing that since the dependency isn’t placed directly into the component project, Xcode has problems including the implicit dependency without explicitly stating where it is. The usual search paths (I know about @loader_path and @rpaths – already tried those approaches to fix this) seem not to be enough.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 21 (10 by maintainers)

Most upvoted comments

Solved by importing accelerate in the header file of the networking framework (where kf is imported):

#import <Kingfisher/Kingfisher.h>
#import <Accelerate/Accelerate.h>

I fixed this with adding import Accelerate to some swift files in test scheme.

Kingfisher relies on Accelerate framework to do fast blur processor. In an app target, Xcode could find these kinds of implicit dependencies automatically and link them when necessary. But in a test target, it seems that Xcode has some issues to find implicit dependencies, so you need to add the Accelerate.framework to the linked binary section in build setting yourself manually.

Ah, ok, then I overknterpreted things. Anyways, was rude. ^^

By the way, the project structure where I integrated this os weird, too. If I were you I‘d keep in the back of my mind that there was such an issue bbt won‘t do anything about it unless someone else would run into similar problems. But it‘s weird in any case …

Sorry for being rude, shouldn’t have made a joke about it, was disrespectful. Thank you for taking the time to help me. 🙇