ggerganov / whisper.spm

whisper.cpp package for the Swift Package Manager
MIT License
166 stars 27 forks source link

Unsafe build flags #6

Open vizaiapp opened 1 year ago

vizaiapp commented 1 year ago

I just updated to 1.2.0 and my first build produced this error: The package product 'whisper' cannot be used as a dependency of this target because it uses unsafe build flags.

Any ideas? Haven't had any issues building prior versions.

vizaiapp commented 1 year ago

Testing out prior version to see where this starts and it appears to begin in 1.1.0, still present in 1.1.1. 1.0.4 builds fine without any issues.

ggerganov commented 1 year ago

I think this is the commit that breaks it for you: https://github.com/ggerganov/whisper.spm/commit/0e52adc4aedfdaa30952db3dafc883382c644f5f

I am not sure how to resolve this correctly. If we don't include these flags, then we have the problem from #1 If #1 is not an issue for you, you can simply fork this repo and remove the unsafe flags.

bdrelling commented 1 year ago

@ggerganov Before submitting #1, I investigated a ton of options for this and couldn't find anything that would allow the optimization level we need alongside proper versioning support.

The one thing I didn't try it is prebuilding a binary framework and using that for the package. See Distributing binary frameworks as Swift packages.

I don't know C very well and don't know if this is possible or not possible with C packages, but theoretically if we build the framework with the strictest optimization level and you include that in the package, it should work.

You might even be able to offer two targets/products, something like Whisper and WhisperCompiled, but leverage the same module name/alias.

Let me know if you want any help investigating this further, happy to put some work in since you've done so much to support us!

bdrelling commented 1 year ago

And I guess for the worst case scenario: removing versioning tags and adding an explicit message that the library will only work with branch or revision pinning in SPM. 😞

ggerganov commented 1 year ago

@bdrelling No worries! I don't think these are show-stopping issues - there are work arounds available.

vizaiapp commented 1 year ago

Thanks all! I'm still getting the build error when I pin to branch or specific commit in my current project - the build errors aren't present when I do that in a new project with branch pinning however... @bdrelling do you have any suggestions for debugging? I deleted the package and re-added with a branch pin, but the build error remains. I wonder if there's something lingering that doesn't get cleared when I remove/re-add the dependency.

vizaiapp commented 1 year ago

Got it building now w/o errors - final sequence that worked was: Remove whisper as dependency -> Build (removing any code using whisper) -> Clean project -> Re-add whisper with branch pinning -> Build.

narciszait commented 1 year ago

Hi guys - which branch should i be pinning/using?

maiqingqiang commented 9 months ago

Hi guys - which branch should i be pinning/using?

@narciszait use specify the version with a commit hash

image