Skip to content

fix(bundler): ensure AppImage usr/lib is a dir#4419

Merged
lucasfernog merged 2 commits intotauri-apps:devfrom
Beanow:bundler-appimage-fix
Jun 21, 2022
Merged

fix(bundler): ensure AppImage usr/lib is a dir#4419
lucasfernog merged 2 commits intotauri-apps:devfrom
Beanow:bundler-appimage-fix

Conversation

@Beanow
Copy link
Member

@Beanow Beanow commented Jun 21, 2022

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Docs
  • New Binding issue #___
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes, and the changes were approved in issue #___
  • No

Checklist

  • When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • A change file is added if any packages will require a version bump due to this PR per the instructions in the readme.
  • I have added a convincing reason for adding this feature, if necessary

Other information

Possibly the usr/lib directory wasn't yet created before copying the designated tray library. Resulting in a usr/lib file containing libappindicator3.so and following commands failing as it expected a directory.

Reproducing

  1. From a fresh hello Tauri app, enable system tray in config.
{
  "tauri": {
    "systemTray": {
      "iconPath": "icons/icon.png",
      "iconAsTemplate": true
    }
  }
}
  1. Build with yarn tauri --verbose build.

The bundler will cause errors like: cp: './usr/lib' exists but is not a directory
And the AppDir contains a file usr/lib containing libappindicator3.so.
image

Appimage bundling log
Bundling [tauri_bundler::bundle::linux::appimage] hello_0.1.0_amd64.AppImage (/workdir/hello/src-tauri/target/release/bundle/appimage/hello_0.1.0_amd64.AppImage)
     Running [tauri_bundler::bundle::common] Command `/workdir/hello/src-tauri/target/release/bundle/appimage/build_appimage.sh `
+ export ARCH=x86_64
+ ARCH=x86_64
+ APPIMAGE_BUNDLE_XDG_OPEN=0
+ APPIMAGE_BUNDLE_GSTREAMER=0
+ TRAY_LIBRARY_PATH=/usr/lib/libappindicator3.so
+ '[' x86_64 == i686 ']'
+ linuxdeploy_arch=x86_64
+ OUTDIR=/workdir/hello/src-tauri/target/release/bundle/appimage
+ cd /home/beanow/.cache/tauri
+ rm -rf hello.AppDir
+ mkdir -p hello.AppDir
+ cp -r /workdir/hello/src-tauri/target/release/bundle/appimage/../appimage_deb/data/usr hello.AppDir
+ cd hello.AppDir
+ [[ 0 != \0 ]]
+ [[ /usr/lib/libappindicator3.so != \0 ]]
+ echo 'Copying appindicator library /usr/lib/libappindicator3.so'
+ cp /usr/lib/libappindicator3.so usr/lib
Copying appindicator library /usr/lib/libappindicator3.so
++ dirname '{}'
+ find /usr/lib /usr/lib32 /usr/lib64 -name WebKitNetworkProcess -exec mkdir -p . ';' -exec cp --parents '{}' . ';'
find: ‘/usr/lib/firmware/b43’: Permission denied
find: ‘/usr/lib/firmware/b43legacy’: Permission denied
cp: './usr/lib' exists but is not a directory
cp: './usr/lib' exists but is not a directory
+ true
++ dirname '{}'
+ find /usr/lib /usr/lib32 /usr/lib64 -name WebKitWebProcess -exec mkdir -p . ';' -exec cp --parents '{}' . ';'
find: ‘/usr/lib/firmware/b43’: Permission denied
find: ‘/usr/lib/firmware/b43legacy’: Permission denied
cp: './usr/lib' exists but is not a directory
cp: './usr/lib' exists but is not a directory
+ true
++ dirname '{}'
+ find /usr/lib /usr/lib32 /usr/lib64 -name libwebkit2gtkinjectedbundle.so -exec mkdir -p . ';' -exec cp --parents '{}' . ';'
find: ‘/usr/lib/firmware/b43’: Permission denied
find: ‘/usr/lib/firmware/b43legacy’: Permission denied
cp: './usr/lib' exists but is not a directory
cp: './usr/lib' exists but is not a directory
+ true
+ wget -q -4 -N -O AppRun https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-x86_64
+ chmod +x AppRun
+ cp usr/share/icons/hicolor/256x256@2/apps/hello.png .DirIcon
+ ln -s usr/share/icons/hicolor/256x256@2/apps/hello.png hello.png
+ ln -s usr/share/applications/hello.desktop hello.desktop
+ cd ..
+ [[ 0 != \0 ]]
+ gst_plugin=
+ wget -q -4 -N -O linuxdeploy-plugin-gtk.sh https://raw.githubusercontent.com/tauri-apps/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh
+ wget -q -4 -N -O linuxdeploy-x86_64.AppImage https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
+ chmod +x linuxdeploy-plugin-gtk.sh
+ chmod +x linuxdeploy-x86_64.AppImage
+ OUTPUT=hello_0.1.0_amd64.AppImage
+ ./linuxdeploy-x86_64.AppImage --appimage-extract-and-run --appdir hello.AppDir --plugin gtk --output appimage
linuxdeploy version 1-alpha (git commit ID 56760df), GitHub actions build 85 built on 2022-06-14 00:36:51 UTC

-- Creating basic AppDir structure -- 
Creating directory hello.AppDir/usr/bin/ 
Creating directory hello.AppDir/usr/lib/ 
ERROR: Failed to create directory hello.AppDir/usr/lib/ERROR: Failed to create basic AppDir structure 
Error running CLI: failed to bundle project: error running appimage.sh: error running appimage.sh: `failed to run /workdir/hello/src-tauri/target/release/bundle/appimage/build_appimage.sh`
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Possibly the usr/lib directory wasn't yet created before copying the designated tray library. Resulting in a usr/lib _file_ containing libappindicator3.so and following commands failing as it expected a directory.
@Beanow Beanow requested a review from a team June 21, 2022 13:33
@Beanow Beanow requested a review from a team as a code owner June 21, 2022 13:38
@lucasfernog lucasfernog merged commit aa0336d into tauri-apps:dev Jun 21, 2022
@Beanow Beanow deleted the bundler-appimage-fix branch June 21, 2022 15:17
@lucasfernog
Copy link
Member

Would be amazing if you could setup commit signing for the next PR @Beanow thanks for the PR ❤️

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

Successfully merging this pull request may close these issues.

2 participants