BradLarson / GPUImage3

GPUImage 3 is a BSD-licensed Swift framework for GPU-accelerated video and image processing using Metal.
BSD 3-Clause "New" or "Revised" License
2.68k stars 330 forks source link

Problem using GPUImage3 from Swift Package #87

Closed mycroftcanner closed 2 years ago

mycroftcanner commented 4 years ago

Crashes in MetalRenderingDevice... It seems it can't find the metal library.

let metalLibraryPath = frameworkBundle.path(forResource: "default", ofType: "metallib")

Fatal error: Unexpectedly found nil while unwrapping an Optional value: file

epoll-j commented 4 years ago

same problem

mycroftcanner commented 4 years ago

It works if I follow the instructions in the README.md and not use Swift Package Manager

waterskier2007 commented 3 years ago

@mycroftcanner that doesn't really help the issue. The whole point of this issue is that it's not working using SPM.

mycroftcanner commented 3 years ago

@waterskier2007 just stating that it works outside of Swift Package. It could have been an another issue not related to Swift Package.

mycroftcanner commented 3 years ago

@epoll-j I removed all references to the package in my build phases. Then added the package again and iWorks

mycroftcanner commented 3 years ago

Still the same problem... I forgot it was a runtime problem.

vincentthe0ne commented 3 years ago

I have the same issue with the current package from this commit: https://github.com/BradLarson/GPUImage3/commit/222868e1ba4137a9934b2135635783ef7083eb4d

tklebanoff commented 3 years ago

i hit this same error -- do we have any idea how to fix this other than copy the xcodeproj folder into our project and hook it in manually? why do we see this error when using SPM and not ordinarily? Is there a way to achieve correct behavior using SPM?

vincentthe0ne commented 2 years ago

Well the problem is, that the current Implementation of the Package.swift File uses an old Version of the Swift Tools. We need AFAIK at least version 5.2 since the file that is missing is a resource file.

The other problem seems to be, that the library which is loaded in the crashing part, is only created in the Build Phase which you have to add when you import the GPUImage project into your project.

mycroftcanner commented 2 years ago

This should help:

https://developer.apple.com/forums/thread/649579

As @vincentthe0ne suggested we need to bump the swift tool version number and should probably move all the metal files to a separate directory. (SPM doesn't support file operation wildcards)

Recouse commented 1 year ago

Fixed it in #126