c0re100 / qBittorrent-Enhanced-Edition

[Unofficial] qBittorrent Enhanced, based on qBittorrent
https://github.com/c0re100/qBittorrent-Enhanced-Edition
Other
18.6k stars 1.24k forks source link

Request: Use fuse3 compatible appimagetool. #563

Closed Samueru-sama closed 1 month ago

Samueru-sama commented 3 months ago

Suggestion

https://github.com/probonopd/go-appimage

I normally would make the PR with the changes, but I noticed your CI is quite complex. 👀

Use case

Fixes a common issue with ubuntu and some forks where libfuse2 no longer comes installed.

This is a problem because ubuntu doesn't let you have both libfuse2 and libfuse3 installed together, even though it is fully possible and distros like arch let you do it.

This appimagetool also uses a zstd compression, which results in a slightly smaller appimage. It also works if the distro only has libfuse2 installed.

Extra info/examples/attachments

No response

abcfy2 commented 3 months ago

I've noticed this project before and had plans to migrate to this tool. But at that time, go-appimage didn't fully support all the features of linuxdeployqt, so I never migrated it, thanks for the reminder, I will try to use go-appimage instead of linuxdeployqt, and if you have a ready solution, you can also submit PR directly!

abcfy2 commented 3 months ago

I normally would make the https://github.com/hrydgard/ppsspp/pull/19283 with the changes, but I noticed your CI is quite complex. 👀

In fact linuxdeployqt only in these lines, so you can update these codes:

https://github.com/c0re100/qBittorrent-Enhanced-Edition/blob/8df67d08f6a5aa0827263342f38a0e404c768a7d/.github/workflows/build_appimage.sh#L352-L499

abcfy2 commented 3 months ago

I try to switch to go-appimage but I still got some issues.

First this does not support exclude-libs like linuxdeployqt, and it does not bundle qt TLS backend correctly. Will see this error in Appimage:

qt.network.ssl: No functional TLS backend was found
qt.network.ssl: No TLS backend is available
QFSFileEngine::open: No file name specified
qt.network.ssl: No functional TLS backend was found
qt.network.ssl: No functional TLS backend was found

I use this command:

$ export QTLIB=/usr/lib/Qt-6.7.2
$ export APPIMAGE_EXTRACT_AND_RUN=1
$ ./appimagetool-833-x86_64.AppImage deploy /tmp/qbee/AppDir/usr/share/applications/org.qbittorrent.qBittorrent.desktop
$ ARCH=x86_64 VERSION=1.0 ./appimagetool-833-x86_64.AppImage /tmp/qbee/AppDir/
Samueru-sama commented 3 months ago

Hey you caught me right before I go sleep, I will reply better later in about 8 hours.

But if I didn't read anything wrong. I don't try to use go-appimage to deploy, I only use its appimagetool instead. I still use linuxdeploy to make the appimage, just that I remove the --output-appimage flag from linuxdeploy.

EDIT: Here is an example of what I mean linuxdeploy is still being used.

Samueru-sama commented 3 months ago

Alright here is the changes that I mean, I have not tested it:

 build_appimage() { 
   # build AppImage 
   linuxdeploy_qt_download_url="https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" 
   go_appimagetool_download_url=$(wget -q https://api.github.com/repos/probonopd/go-appimage/releases -O - | sed 's/[()",{} ]/\n/g' | grep -oi 'https.*continuous.*tool.*86_64.*mage$')
   if [ x"${USE_CHINA_MIRROR}" = x1 ]; then 
     linuxdeploy_qt_download_url="https://mirror.ghproxy.com/${linuxdeploy_qt_download_url}" 
   fi 
   [ -x "/tmp/linuxdeployqt-continuous-x86_64.AppImage" ] || retry curl -kSLC- -o /tmp/linuxdeployqt-continuous-x86_64.AppImage "${linuxdeploy_qt_download_url}" 
   wget "$go_appimagetool_download_url" -O /tmp/appimagetool-x86_64.AppImage
   chmod -v +x '/tmp/linuxdeployqt-continuous-x86_64.AppImage' '/tmp/appimagetool-x86_64.AppImage'
   cd "/tmp/qbee" 
   ln -svf usr/share/icons/hicolor/scalable/apps/qbittorrent.svg /tmp/qbee/AppDir/ 
   ln -svf qbittorrent.svg /tmp/qbee/AppDir/.DirIcon 
   cat >/tmp/qbee/AppDir/AppRun <<EOF 
 #!/bin/bash -e 

 this_dir="\$(readlink -f "\$(dirname "\$0")")" 
 export XDG_DATA_DIRS="\${this_dir}/usr/share:\${XDG_DATA_DIRS}:/usr/share:/usr/local/share" 
 export QT_QPA_PLATFORMTHEMES=gtk2 
 export QT_STYLE_OVERRIDE=qt6gtk2 

 # Find the system certificates location 
 # https://gitlab.com/probono/platformissues/blob/master/README.md#certificates 
 possible_locations=( 
   "/etc/ssl/certs/ca-certificates.crt"                # Debian/Ubuntu/Gentoo etc. 
   "/etc/pki/tls/certs/ca-bundle.crt"                  # Fedora/RHEL 
   "/etc/ssl/ca-bundle.pem"                            # OpenSUSE 
   "/etc/pki/tls/cacert.pem"                           # OpenELEC 
   "/etc/ssl/certs"                                    # SLES10/SLES11, https://golang.org/issue/12139 
   "/usr/share/ca-certs/.prebuilt-store/"              # Clear Linux OS; https://github.com/knapsu/plex-media-player-appimage/issues/17#issuecomment-437710032 
   "/system/etc/security/cacerts"                      # Android 
   "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem" # CentOS/RHEL 7 
   "/etc/ssl/cert.pem"                                 # Alpine Linux 
 ) 

 for location in "\${possible_locations[@]}"; do 
   if [ -r "\${location}" ]; then 
     export SSL_CERT_FILE="\${location}" 
     break 
   fi 
 done 

 exec "\${this_dir}/usr/bin/qbittorrent" "\$@" 
 EOF 
   chmod 755 -v /tmp/qbee/AppDir/AppRun 

   extra_plugins=( 
     iconengines 
     imageformats 
     platforminputcontexts 
     platforms 
     platformthemes 
     sqldrivers 
     styles 
     tls 
     wayland-decoration-client 
     wayland-graphics-integration-client 
     wayland-shell-integration 
   ) 
   exclude_libs=( 
     libX11-xcb.so.1 
     libXau.so.6 
     libXcomposite.so.1 
     libXcursor.so.1 
     libXdamage.so.1 
     libXdmcp.so.6 
     libXext.so.6 
     libXfixes.so.3 
     libXi.so.6 
     libXinerama.so.1 
     libXrandr.so.2 
     libXrender.so.1 
     libatk-1.0.so.0 
     libatk-bridge-2.0.so.0 
     libatspi.so.0 
     libblkid.so.1 
     libboost_filesystem.so.1.58.0 
     libboost_system.so.1.58.0 
     libboost_system.so.1.65.1 
     libbsd.so.0 
     libcairo-gobject.so.2 
     libcairo.so.2 
     libcapnp-0.5.3.so 
     libcapnp-0.6.1.so 
     libdatrie.so.1 
     libdbus-1.so.3 
     libepoxy.so.0 
     libffi.so.6 
     libgcrypt.so.20 
     libgdk-3.so.0 
     libgdk-x11-2.0.so.0 
     libgdk_pixbuf-2.0.so.0 
     libgio-2.0.so.0 
     libglib-2.0.so.0 
     libgmodule-2.0.so.0 
     libgobject-2.0.so.0 
     libgraphite2.so.3 
     libgtk-3.so.0 
     libgtk-x11-2.0.so.0 
     libkj-0.5.3.so 
     libkj-0.6.1.so 
     libmirclient.so.9 
     libmircommon.so.7 
     libmircore.so.1 
     libmirprotobuf.so.3 
     libmount.so.1 
     libpango-1.0.so.0 
     libpangocairo-1.0.so.0 
     libpangoft2-1.0.so.0 
     libpcre.so.3 
     libpcre2-8.so.0 
     libpixman-1.so.0 
     libprotobuf-lite.so.9 
     libselinux.so.1 
     libsystemd.so.0 
     libwayland-client.so.0 
     libwayland-cursor.so.0 
     libwayland-egl.so.1 
     libwayland-server.so.0 
     libxcb-cursor.so.0 
     libxcb-glx.so.0 
     libxcb-icccm.so.4 
     libxcb-image.so.0 
     libxcb-keysyms.so.1 
     libxcb-randr.so.0 
     libxcb-render-util.so.0 
     libxcb-render.so.0 
     libxcb-shape.so.0 
     libxcb-shm.so.0 
     libxcb-sync.so.1 
     libxcb-util.so.1 
     libxcb-xfixes.so.0 
     libxcb-xkb.so.1 
     libxkbcommon-x11.so.0 
     libxkbcommon.so.0 
   ) 

   # fix AppImage output file name 
   sed -i 's/Name=qBittorrent.*/Name=qBittorrent-Enhanced-Edition/;/SingleMainWindow/d' /tmp/qbee/AppDir/usr/share/applications/*.desktop 

   APPIMAGE_EXTRACT_AND_RUN=1 \ 
     /tmp/linuxdeployqt-continuous-x86_64.AppImage \ 
     /tmp/qbee/AppDir/usr/share/applications/*.desktop \ 
     -always-overwrite \ 
     -no-copy-copyright-files \ 
     -updateinformation="zsync|https://github.com/${GITHUB_REPOSITORY}/releases/latest/download/qBittorrent-Enhanced-Edition-x86_64.AppImage.zsync" \ 
     -extra-plugins="$(join_by ',' "${extra_plugins[@]}")" \ 
     -exclude-libs="$(join_by ',' "${exclude_libs[@]}")" 

   ARCH=x86_64
   VERSION="$(/tmp/qbee/AppDir/AppRun --version | awk '{print $NF}')" /tmp/appimagetool-x86_64.AppImage /tmp/qbee/AppDir
} 

Something I'm not sure is if doing this would break the zsync updates.

abcfy2 commented 3 months ago

Yes. This should break the zsync. And I don't think we should easily migrate to go-appimage now. Since go-appimage does not support like linuxdeployqt features: https://github.com/probonopd/go-appimage/issues/291

Samueru-sama commented 3 months ago

Yes. This should break the zsync. And I don't think we should easily migrate to go-appimage now. Since go-appimage does not support like linuxdeployqt features: probonopd/go-appimage#291

Yeah I understand that go-appimage isn't ready yet. It's a shame the other method breaks zsync.

Korne127 commented 2 months ago

@Samueru-sama linuxdeploy is not linuxdeployqt. While linuxdeployqt is deprecated, linuxdeploy and go-appimagetool are its successors and both maintained.

Samueru-sama commented 2 months ago

@Samueru-sama linuxdeploy is not linuxdeployqt. While linuxdeployqt is deprecated, linuxdeploy and go-appimagetool are its successors and both maintained.

Hi, sorry but I'm not sure why you told me that 😅

Also while linuxdeploy is still being maintained it still makes an appimage with the runtime that depends on libfuse instead of the static one which is the reason I opened this issue.

Although anyway, I've recently put making PRs migrating appimages to the new runtime due to this bug in the static runtime.

Samueru-sama commented 1 month ago

Change of plan, now appimagetool uses the static runtime by default as well, so it should be easy to use it without breaking zsync, as the zsync flag would be used in appimagetool instead of linuxdeploy-qt.

I just did the changes

However I wanted to test it first but the CI is failing to compile on ubuntu due to a different issue. 😭

EDIT: NVM, just noticed that the workflow that builds the appimage is a different one lol.

Samueru-sama commented 1 month ago

Alright I got to work and produce the appimage, artifact.

However it doesn't work. trying to launch the appimage causes error while loading shared libraries: libtorrent-rasterbar.so.10: cannot open shared object file: No such file or directory

I don't think this is related to the changes I did, since all I did was tell linuxdeploy-qt to not create the appimage and not create the zsync info since now appimagetool is doing that, it is still deploying so I don't know what happened. I will later try to re-run the CI without any of my changes to confirm.

Edit: It ended up being the changes I did, turns out that linuxdeployqt needs the -bundle-non-qt-libs flag when -appimage flag isn't being used, now it works.

Korne127 commented 1 month ago

Hey, sorry for the very late reply, I was pretty busy the last days.

Hi, sorry but I'm not sure why you told me that 😅

I'm sorry for the comment. I just fount this though a linked issue and skipped over this, and assumed you didn't know the difference as you were only talking about -qt before and said people are still using linuxdeploy. But yeah, I'm sorry for that.

But yeah, thanks for noticing and doing this. Although I hope that linuxdeploy will be updated accordingly.