tauri
tauri copied to clipboard
[bug] Error to bundle project in WSL2 (windows subsystem linux)
Describe the bug
Hi, I'm building my app in wsl2 (windows subsystem linux). It seems that the binary is built successfully but fail to bundle the install package due to the sidecar. I do have the external binary in src-tauri/bin/ffmpeg-x86_64-unknown-linux-gnu
. I've tried use --verbose
but didn't see any debug message.
Is it means that the .deb
package built successfully but fail to build .AppImage
package? If deb is built successfully, why should I need AppImage?
$ pnpm tauri build --verbose
> @ tauri /mnt/d/work/vizip
> tauri "build"
...
Finished release [optimized] target(s) in 0.51s
[tauri:build] Binary stripped, size reduced by 0 B
Bundling vizip_0.1.0_amd64.deb
"bin/ffmpeg-x86_64-unknown-linux-gnu" "/mnt/d/work/vizip/src-tauri/target/release/bundle/deb/vizip_0.1.0_amd64/data/usr/bin/ffmpeg" "x86_64-unknown-linux-gnu"
"bin/ffmpeg-x86_64-unknown-linux-gnu" "/mnt/d/work/vizip/src-tauri/target/release/bundle/appimage_deb/data/usr/bin/ffmpeg" "x86_64-unknown-linux-gnu"
Bundling vizip_0.1.0_amd64.AppImage
Error running CLI: failed to bundle project: Shell Scripting Error:`error running appimage.sh, try running with --verbose to see command output`
ELIFECYCLE Command failed with exit code 1.
Reproduction
No response
Expected behavior
No response
Platform and versions
> @ tauri /mnt/d/work/vizip
> tauri "info"
Operating System - Ubuntu, version 20.04 X64
Node.js environment
Node.js - 16.13.1
@tauri-apps/cli - 1.0.0-rc.5 (outdated, latest: 1.0.0-rc.7)
@tauri-apps/api - 1.0.0-rc.1 (outdated, latest: 1.0.0-rc.2)
Global packages
npm - 8.1.2
pnpm - 6.24.3
yarn - Not installed
Rust environment
rustup - 1.24.3
rustc - 1.59.0
cargo - 1.59.0
toolchain - stable-x86_64-unknown-linux-gnu
App directory structure
/.git
/.vscode
/dist
/node_modules
/public
/src
/src-tauri
/test
App
tauri - 1.0.0-rc.3
tauri-build - 1.0.0-rc.3
tao - 0.6.2
wry - 0.13.2
build-type - bundle
CSP - unset
distDir - ../dist
devPath - http://localhost:8080/
framework - Vue.js (Quasar)
bundler - Webpack
### Stack trace
_No response_
### Additional context
_No response_
Can you try pnpm tauri build -- --verbose
or pnpm tauri build -- -- --verbose
?
Also try upgrading your tauri dependencies there are some fixes related to sidecars and stuff in there (although mostly for Windows iirc)
@FabianLars
$ pnpm tauri build -- --verbose
Finished release [optimized] target(s) in 0.50s
[tauri:build] Binary stripped, size reduced by 0 B
Bundling vizip_0.1.0_amd64.deb
"bin/ffmpeg-x86_64-unknown-linux-gnu" "/mnt/d/work/vizip/src-tauri/target/release/bundle/deb/vizip_0.1.0_amd64/data/usr/bin/ffmpeg" "x86_64-unknown-linux-gnu"
"bin/ffmpeg-x86_64-unknown-linux-gnu" "/mnt/d/work/vizip/src-tauri/target/release/bundle/appimage_deb/data/usr/bin/ffmpeg" "x86_64-unknown-linux-gnu"
Bundling vizip_0.1.0_amd64.AppImage
+ export ARCH=x86_64
+ ARCH=x86_64
+ mkdir -p vizip.AppDir
+ cp -r ../appimage_deb/data/usr vizip.AppDir
+ cd vizip.AppDir
++ dirname '{}'
+ find /usr/lib /usr/lib32 /usr/lib64 /usr/libexec /usr/libx32 -name WebKitNetworkProcess -exec mkdir -p . ';' -exec cp --parents '{}' . ';'
++ dirname '{}'
+ find /usr/lib /usr/lib32 /usr/lib64 /usr/libexec /usr/libx32 -name WebKitWebProcess -exec mkdir -p . ';' -exec cp --parents '{}' . ';'
++ dirname '{}'
+ find /usr/lib /usr/lib32 /usr/lib64 /usr/libexec /usr/libx32 -name libwebkit2gtkinjectedbundle.so -exec mkdir -p . ';' -exec cp --parents '{}' . ';'
+ wget -q -4 -O AppRun https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-x86_64
+ chmod +x AppRun
+ cp usr/share/icons/hicolor/512x512@2x/apps/vizip.png .DirIcon
+ ln -s usr/share/icons/hicolor/512x512@2x/apps/vizip.png vizip.png
+ ln -s usr/share/applications/vizip.desktop vizip.desktop
+ cd ..
+ wget -q -4 -O linuxdeploy-plugin-gtk.sh https://raw.githubusercontent.com/tauri-apps/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh
Error running CLI: failed to bundle project: Shell Scripting Error:`error running appimage.sh`
ELIFECYCLE Command failed with exit code 1.
My guess was right, the deb package has already built successfully. It could be installed via apt install vizip_0.1.0_amd64.deb
. The AppImage format is somehow unable to build.
@red010182
Is it means that the .deb package built successfully but fail to build .AppImage package? If deb is built successfully, why should I need AppImage?
The default configuration in tauri.conf.json
> tauri
> bundle
> targets
is all
, you can set this to either deb
if you just want the deb output, or any values listed in the config allowed values
However, as for why you might actually want AppImage, the AppImage wiki gives a good explanation https://github.com/AppImage/AppImageKit/wiki#-why-should-i-bundle-my-application-as-an-appimage
@FabianLars To provide a more verbose verbose stack, I am seeing:
Bundling [tauri_bundler::bundle::linux::appimage] <PROJECT_NAME>_0.1.0_amd64.AppImage (/home/<USER>/<PROJECT_NAME>/src-tauri/target/release/bundle/appimage/<PROJECT_NAME>_0.1.0_amd64.AppImage)
Running [tauri_bundler::bundle::common] Command `/home/<USER>/<PROJECT_NAME>/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=0
+ '[' x86_64 == i686 ']'
+ linuxdeploy_arch=x86_64
+ mkdir -p <PROJECT_NAME>.AppDir
+ cp -r ../appimage_deb/data/usr <PROJECT_NAME>.AppDir
+ cd <PROJECT_NAME>.AppDir
+ mkdir -p usr/bin
+ mkdir -p usr/lib
+ [[ 0 != \0 ]]
+ [[ 0 != \0 ]]
++ dirname '{}'
+ find /usr/lib /usr/lib32 /usr/lib64 /usr/libexec /usr/libx32 -name WebKitNetworkProcess -exec mkdir -p . ';' -exec cp --parents '{}' . ';'
++ dirname '{}'⠂⠂⠂⠂) ⠴ : timing npm:load Completed in 31ms
+ find /usr/lib /usr/lib32 /usr/lib64 /usr/libexec /usr/libx32 -name WebKitWebProcess -exec mkdir -p . ';' -exec cp --parents '{}' . ';'
++ dirname '{}'⠂⠂⠂⠂) ⠴ : timing npm:load Completed in 31ms
+ find /usr/lib /usr/lib32 /usr/lib64 /usr/libexec /usr/libx32 -name libwebkit2gtkinjectedbundle.so -exec mkdir -p . ';' -exec cp --parents '{}' . ';'
+ wget -q -4 -N -O /home/<USER>/.cache/tauri/AppRun https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-x86_64
+ chmod +x /home/<USER>/.cache/tauri/AppRunCompleted in 31ms
+ cp /home/<USER>/.cache/tauri/AppRun .
+ cp usr/share/icons/hicolor/256x256@2/apps/<PROJECT_NAME>.png .DirIcon
+ ln -s usr/share/icons/hicolor/256x256@2/apps/<PROJECT_NAME>.png <PROJECT_NAME>.png
+ ln -s usr/share/applications/<PROJECT_NAME>.desktop <PROJECT_NAME>.desktop
+ cd ..
+ [[ 0 != \0 ]]
+ gst_plugin=
+ wget -q -4 -N -O /home/<USER>/.cache/tauri/linuxdeploy-plugin-gtk.sh https://raw.githubusercontent.com/tauri-apps/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh
+ wget -q -4 -N -O /home/<USER>/.cache/tauri/linuxdeploy-x86_64.AppImage https://github.com/tauri-apps/binary-releases/releases/download/linuxdeploy/linuxdeploy-x86_64.AppImage
+ chmod +x /home/<USER>/.cache/tauri/linuxdeploy-plugin-gtk.sh
+ chmod +x /home/<USER>/.cache/tauri/linuxdeploy-x86_64.AppImage
+ dd if=/dev/zero bs=1 count=3 seek=8 conv=notrunc of=/home/<USER>/.cache/tauri/linuxdeploy-x86_64.AppImage
3+0 records in
3+0 records out
3 bytes copied, 6.7e-05 s, 44.8 kB/s
+ OUTPUT=<PROJECT_NAME>_0.1.0_amd64.AppImage
+ /home/<USER>/.cache/tauri/linuxdeploy-x86_64.AppImage --appimage-extract-and-run --appdir <PROJECT_NAME>.AppDir --plugin gtk --output appimage
linuxdeploy version 1-alpha (git commit ID 56760df), GitHub actions build 90 built on 2022-07-12 10:39:09 UTC
terminate called after throwing an instance of 'boost::filesystem::filesystem_error'
what(): boost::filesystem::status: Permission denied: "/mnt/c/WINDOWS/system32/config/systemprofile/AppData/Local/Microsoft/WindowsApps"
Error [tauri_cli_node] failed to bundle project: error running appimage.sh: error running appimage.sh: `failed to run /home/<USER>/workspace/<PROJECT_NAME>/src-tauri/target/release/bundle/appimage/build_appimage.sh`
This seems to be the same as https://github.com/tauri-apps/tauri/issues/2731 because WSL2 has /mnt/c/WINDOWS/system32/config/systemprofile/AppData/Local/Microsoft/WindowsApps
on $PATH
by default (because it comes from the Windows PATH), and AppImage is trying to do things with it for whatever reason. Workaround would be to disable the interop between Windows and WSL. Stack Overflow for how to do that
I just came across this error too (using WSL2 and WSLg) and don't really want to disable the interop between win and nix - here's a temporary solution:
Run in CLI with with:
PATH=$(/usr/bin/printenv PATH | /usr/bin/perl -ne 'print join(":", grep { !/\/mnt\/[a-z]/ } split(/:/));') yarn tauri build
Add to package.json
as a command:
"scripts": {
"build:tauri": "PATH=$(/usr/bin/printenv PATH | /usr/bin/perl -ne 'print join(\":\", grep { !/\\/mnt\\/[a-z]/ } split(/:/));') tauri build",
}
Kudos to insign for the PATH scripting, grabbed from Stackoverflow