dweymouth / supersonic

A lightweight and full-featured cross-platform desktop client for self-hosted music servers
GNU General Public License v3.0
675 stars 26 forks source link

Flatpak Package Won't Open After 0.8.1 Update Due To libSPIRV.so Missing. #289

Closed GavinL2001 closed 6 months ago

GavinL2001 commented 6 months ago

I just installed the new update from flathub, and when I try to run supersonic, it won't even open. Here is the error I get when I execute flatpak run io.github.dweymouth.supersonic in the terminal:

supersonic: error while loading shared libraries: libSPIRV.so: cannot open shared object file: No such file or directory

I tried installing spriv-tools through dnf, but it affected nothing.

Here's my system info:

OS: Nobara Linux 38 (KDE Plasma) x86_64 Kernel: 6.6.4-200.fsync.fc38.x86_64 CPU: AMD Ryzen 9 5900X (24) @ 4.95 GHz GPU: AMD Radeon RX 5700 XT Flatpak Version: 1.15.4-12.fc38

dweymouth commented 6 months ago

The version of MPV used in the flatpak was upgraded in 0.8.1. @anarcat any ideas what might be causing this? Should we roll back the mpv version bump? @GavinL2001 downgrading to 0.8.0 should work around this until we get it sorted

GavinL2001 commented 6 months ago

I've rolledback the update in the short term. Thanks for the help!

Also, for anyone else that has the same issue, here's the command to rollback to 0.8.0 in flatpak: flatpak update --commit=09cf66371f4041871743b4971f96efda2d6996334876504a6629615aaecece6c io.github.dweymouth.supersonic

anarcat commented 6 months ago

i made https://github.com/flathub/io.github.dweymouth.supersonic/pull/37 to rollback the upgrade, looking into root cause.

anarcat commented 6 months ago

so https://github.com/flathub/io.github.dweymouth.supersonic/pull/37#issuecomment-1845667628 has a test build with the mpv upgrade rolled back. I'm pretty sure that one should work already, you can test with:

flatpak install --user https://dl.flathub.org/build-repo/68843/io.github.dweymouth.supersonic.flatpakref

If I hear nothing I'll just merge this before EOD AOE as a safety measure. But what I would really like is if someone could test this other MR that tries to disable that library in the first place, keeping the mpv upgrade in place:

https://github.com/flathub/io.github.dweymouth.supersonic/pull/38#issuecomment-1845670242

flatpak install --user https://dl.flathub.org/build-repo/68846/io.github.dweymouth.supersonic.flatpakref

I can't test locally right now, unfortunately, i will be able to do that next week.

Mister-Digital commented 6 months ago

The first build with mpv rolled back works for me (https://dl.flathub.org/build-repo/68843/io.github.dweymouth.supersonic.flatpakref).

The other build with the mpv upgrade unfortunately gives me the same error (https://dl.flathub.org/build-repo/68846/io.github.dweymouth.supersonic.flatpakref).

anarcat commented 6 months ago

awesome, thanks, then i'll roll back and see where we go from there.

anarcat commented 6 months ago

@dweymouth i must admit i'm a bit at a loss here. i don't quite get what SPIRV is or why it's being linked there... Is it linked to supersonic? Or is that error from mpv?

I'm trying to build a really minimal mpv in the flatpak to avoid pulling in too many dependencies, one different approach would be to just vendor the io.mpv.mpv.yml file content in our flatpak, but that seems ridiculous. There are also ways of having "base apps" (electron is one such thing), but there is, AFAIK, only electron as a base app...

so i guess the next step is probbaly to do a shared module approach... see https://github.com/flathub/io.github.dweymouth.supersonic/pull/40 for that.

dweymouth commented 6 months ago

Supersonic does not use SPIRV as a direct dependency (I don't even know what it is) - I guess it's a new dependency in the latest MPV?

GavinL2001 commented 6 months ago

I don't know if this helps or not, but it seems like libplacebo utilizes the SPIRV library, so it could be an issue with how subsonic interacts with libplacebo, not mpv directly.

I wish I had more experience in coding to know how to help diagnose and fix the issue, but maybe this information could help.

dweymouth commented 6 months ago

It looks like libplacebo is a video thing... I really wish there were some player backend other than MPV to use, that didn't bring all the video baggage, but as far as I can tell there isn't a good drop-in replacement.

This is why I'm glad to have @anarcat to figure out all the complexities of how to package it because I have little knowledge of the different Linux packaging schemes and I develop mostly on Mac :D

dweymouth commented 6 months ago

Anyways, @GavinL2001 or anyone else facing this issue, you should be able to (force-)re-install at 0.8.1 now since anarcat rolled back the MPV version

anarcat commented 6 months ago

On 2023-12-07 15:30:09, Drew Weymouth wrote:

This is why I'm glad to have @anarcat to figure out all the complexities of how to package it because I have little knowledge of the different Linux packaging schemes and I develop mostly on Mac :D

Yeah, that's fine, don't worry about it too much. :)

To be quite honest, I was a little surprised supersonic used mpv. It seems like a bit of an odd choice because it's fundamentally a video player; although it can play music, I mostly use it to play video, never music.

anarcat commented 6 months ago

On 2023-12-07 15:26:47, GavinL2001 wrote:

I don't know if this helps or not, but it seems like libplacebo utilizes the SPIRV library, so it could be an issue with how subsonic interacts with libplacebo, not mpv directly.

That definitely helps! I thought it was something under mpv or the vulkan stuff, not placebo! I'll see how we compile placebo to see if I can tweak this properly.

I'm a little puzzled by https://github.com/flathub/io.github.dweymouth.supersonic/pull/40 ; it should have started a build by now but it just seems stuck there...

dweymouth commented 6 months ago

I should create a separate discussion to evaluate MPV replacements, but it will not be on my priority list at all (unless I can get more core contributors to help implement more of the user-facing features in the backlog :)

MPV had all the following out of the box:

GavinL2001 commented 6 months ago

On 2023-12-07 15:26:47, GavinL2001 wrote: I don't know if this helps or not, but it seems like libplacebo utilizes the SPIRV library, so it could be an issue with how subsonic interacts with libplacebo, not mpv directly. That definitely helps! I thought it was something under mpv or the vulkan stuff, not placebo! I'll see how we compile placebo to see if I can tweak this properly. I'm a little puzzled by flathub/io.github.dweymouth.supersonic#40 ; it should have started a build by now but it just seems stuck there...

After looking closer at the mpv code, it does seem to incorporate SPIRV too, but unless some reference to the library got added to mpv, the only thing that should have changed is the addition of placebo.

Here are some other issues I found on libSPIRV.so errors that might be useful as a reference. My novice guess is that there's some hidden dependency that needs to be added. Otherwise, this is also way out of my depth, so best of luck @anarcat!

https://github.com/mpv-player/mpv/issues/12625 https://github.com/mpv-player/mpv/issues/12562 https://forum.zdoom.org/viewtopic.php?p=1103204

anarcat commented 6 months ago

that's super useful info folks, thanks! i think i might have found the right plethora of deps to add to mpv in here https://github.com/flathub/io.github.dweymouth.supersonic/pull/41

@dweymouth hopefully that will cut it... the problem with using mpv in a flatpak is that we need to "just build mpv" which is a moving target, and flatpak is pretty bad at reusing dependencies. every time there's an upgrade, if upstream changes something like this, i need to go grep around github.com/flathub to find how others have done this, there's basically zero code reuse.

(obviously, the worst pain for this was paid during the initial packaging: I was hoping that would mostly be done, but then mpv did change their deps a lot in that tiny-looking 0.37 release, so that is kind of a big deal of a change.)

but yeah: that's not your problem. :) it would also be absolutely not a problem if i was packaging this for debian: mpv is already packaged well there and that probelm (of reusing deps) have been solved for decades. but packaging the golang side of things (and fyne in particular) is much harder, so pick your poison i guess.

finally, i did look around for golang deps and i suspect you're right, there's no high-level "here's an already implemented music player" library out there... but there's a bunch of golang music players that could serve as inspiration, for example i found gotune, lunar and gomu doing a quick search. all of those seem to use beep, which seems promising, until you scratch the lid a little and find beep is a high-level wrapper around oto which, it turns out, only uses ALSA, a major regression (and a problem for the flatpak) on linux. urghl.

so yeah, maybe don't get distracted by this too much for now, mpv generally works fine, from what i can tell, even if it's kind of a pain in the arse to maintain in the flatpak...

so anyway, TL;DR: a build is happening now, and so far so good... there should be one ready for testing soon... it is taking much longer than before now (which is another downside of chasing that dep update)...

anarcat commented 6 months ago

oh, and one more thing, sorry for the noise here, but @dweymouth if you do not want to get distracted by packaging issues, feel free to send those fine people that way by closing the issue here and sending folks to https://github.com/flathub/io.github.dweymouth.supersonic/issues/new, i think it's fine to track package-specific issues in their respective trackers. :)

dweymouth commented 6 months ago

Yeah in terms of MPV replacements we'd definitely need to search for C libraries. Some possibilities could be Phazor - the custom playback backend from Tauon Music box; the same thing from Deadbeef (unnamed); or libgroove which looked really cool but unfortunately hasn't really taken off.

GavinL2001 commented 6 months ago

Sorry if I should have opened an issue at the flatpak repo. I'll know for next time. Thanks for the help, and I'll go ahead and close this issue!

anarcat commented 6 months ago

well, i didn't mean to close this issue without opening another one :) no harm done in any case...

i wonder if someone here can test the build provided here https://github.com/flathub/io.github.dweymouth.supersonic/pull/41#issuecomment-1847095537 - it's trying a much more elaborate mpv build that will hopefully resolve those issues...

Mister-Digital commented 6 months ago

The build from https://dl.flathub.org/build-repo/69210/io.github.dweymouth.supersonic.flatpakref worked for me. I tested a couple things that I thought might be MPV related (playback, selecting audio devices, equalizer) to make sure nothing broke along the way and it all worked.

anarcat commented 6 months ago

amazing! i'll merge that and that will do absolutely nothing for people if all goes well (ie. it will just keep working :)