Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library not loaded: @rpath/libswiftAccelerate.dylib #903

Closed
Jeehut opened this issue Apr 17, 2018 · 21 comments
Closed

Library not loaded: @rpath/libswiftAccelerate.dylib #903

Jeehut opened this issue Apr 17, 2018 · 21 comments

Comments

@Jeehut
Copy link
Contributor

Jeehut commented Apr 17, 2018

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.

@Jeehut
Copy link
Contributor Author

Jeehut commented Apr 17, 2018

I tried everything here and there without success. :(

@onevcat
Copy link
Owner

onevcat commented Apr 23, 2018

@Dschee Not sure what could cause it, but it is more likely an issue that the test bundle (target) does not contain libswiftAccelerate.dylib. Maybe it worth to try to enable ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES in the Info.plist of your UI test target too?

@Jeehut
Copy link
Contributor Author

Jeehut commented Apr 23, 2018

Already tried that, didn't work. Found a workaround: Using HanekeSwift now instead of Kingfisher. ;)

@onevcat
Copy link
Owner

onevcat commented Apr 23, 2018

Great!

@onevcat onevcat closed this as completed Apr 23, 2018
@Jeehut
Copy link
Contributor Author

Jeehut commented Apr 23, 2018

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

@onevcat
Copy link
Owner

onevcat commented Apr 23, 2018

@Dschee No, don't worry guy. I was not angry at all. 😂

Thanks for taking time on trying this project and opening the issue. I am sorry that I didn't help you out and I'd take a look at it when I have a chance later since it is weird to me.

@Jeehut
Copy link
Contributor Author

Jeehut commented Apr 23, 2018

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 ...

@onevcat
Copy link
Owner

onevcat commented Apr 23, 2018

Sure. Maybe you were importing or using Kingfisher’s method in the UI test target, which did not make sense and should not happen in fact. I would try to see whether I can reproduce it later, but if I cannot, I will just let it go.

Thanks!

@xcodefriend
Copy link

xcodefriend commented Apr 26, 2018

Hello @onevcat.

I have the same issue.

The bundle “Tests” couldn’t be loaded because it is damaged or missing necessary resources. 
Try reinstalling the bundle.
(dlopen_preflight(/Tests.xctest/Tests): Library not loaded: @rpath/libswiftAccelerate.dylib
Referenced from: /Kingfisher.framework/Kingfisher
Reason: image not found)

Any ideas on how to fix it?

@xcodefriend
Copy link

xcodefriend commented Apr 26, 2018

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

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

@GWesley
Copy link

GWesley commented Jul 3, 2018

Try clean build folder

@Drusy
Copy link
Contributor

Drusy commented Sep 28, 2018

@GWesley clean build folder made it work for me, I don't think this is related to Kingfisher

@puelocesar
Copy link

Adding the imports didn't worked for me, neither cleaning build folder. Not even adding Accelerate.framework to the "Link Binary with Libraries" phase

Any other ideas?

@ichibod
Copy link

ichibod commented Oct 19, 2018

I am also running into this issue. Changing @rpath settings for my project hasn't resulted in a compiled UI test either.

(dlopen_preflight(/Users/ryan.jones/Library/Developer/Xcode/DerivedData/****-dqxcewttakcreqdcoyalatljzzay/Build/Products/Debug-iphonesimulator/****UITests-Runner.app/PlugIns/****UITests.xctest/UITests): Library not loaded: @rpath/libswiftAccelerate.dylib
Referenced from: /Users/ryan.jones/Library/Developer/Xcode/DerivedData/
-dqxcewttakcreqdcoyalatljzzay/Build/Products/Debug-iphonesimulator/****UITests-Runner.app/PlugIns/****UITests.xctest/Frameworks/Kingfisher.framework/Kingfisher

@puelocesar
Copy link

puelocesar commented Oct 22, 2018

One alternative is to fork Kingfisher and remove everything related to Accelerate. It's basically just removing the "blur" feature anyway, so I think it won't be an issue for most people

@muukii
Copy link

muukii commented Nov 8, 2018

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

@bill350
Copy link

bill350 commented Nov 21, 2018

The same here. I've removed Kingfisher to AlamofireImage.
I think we have to create sub-spec for advanced filtering image effect. It will avoid specific linking of unused framework imports too.

@gal-orlanczyk
Copy link

The issue is still happening why was it closed? I get the same issue on my test target

@onevcat
Copy link
Owner

onevcat commented Feb 1, 2019

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.

@MSavisko
Copy link

@gal-orlanczyk
You could add a new empty target (as single view application), add Accelerate framework (General - Linked Frameworks and Libraries) and define "Host Application" as just added target.

Inspired by:
https://stackoverflow.com/a/42424793

@wangdu1005
Copy link

@onevcat Still not working by your solution. Build setting didn't have linked binary section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests