tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
81.22k stars 2.43k forks source link

[bug] Building release Appimage leads to broken external binary in the package #5189

Open fayeed opened 1 year ago

fayeed commented 1 year ago

Describe the bug

When building the app for release with an external binary (this binary was built using pkg) this causes the binary to break only for AppImage works fine it's a deb on macOS & windows.

Reproduction

  1. Download the linux binary from here
  2. Clone this repo: https://github.com/fayeed/test-tauri
  3. Copy that to src-tauri/bins
  4. Run yarn tauri build
  5. The Binary that's copied in src-tauri/target/release/bundle/appimage/test-tauri.AppDir/usr/bin/ad4m when run using ./ad4m serve will throw this error message
    
    pkg/prelude/bootstrap.js:1

��� �/�$����_��&�"�-��� �/�(������[��*�︈b

SyntaxError: Invalid or unexpected token at new Script (node:vm:101:7) at readPrelude (node:internal/bootstrap/pkg:29:13) at node:internal/bootstrap/pkg:36:18 at node:internal/bootstrap/pkg:43:4 at node:internal/bootstrap/pkg:44:2



### Expected behavior

Expect the release AppImage binary to work.

### Platform and versions

Environment
  › OS: Ubuntu 22.04 X64
  › Node.js: 16.13.2
  › npm: 8.1.2
  › pnpm: Not installed!
  › yarn: 1.22.15
  › rustup: 1.24.3
  › rustc: 1.60.0
  › cargo: 1.60.0
  › Rust toolchain: stable-x86_64-unknown-linux-gnu 

Packages
  › @tauri-apps/cli [NPM]: 1.0.5
  › @tauri-apps/api [NPM]: Not installed!
  › tauri [RUST]: 1.0.5,
  › tauri-build [RUST]: 1.0.4,
  › tao [RUST]: 0.12.2,
  › wry [RUST]: 0.19.0,

App
  › build-type: bundle
  › CSP: unset
  › distDir: ../src
  › devPath: ../src

App directory structure
  ├─ node_modules
  ├─ src
  ├─ .git
  ├─ src-tauri
  └─ .vscode

### Stack trace

_No response_

### Additional context

_No response_
dlangevi commented 1 year ago

Running the md5sum command on sidecar.AppDir/usr/bin/app (from the example/sidecar example) shows that the external binary is modified by linuxdeploy AppImage. Even just running the linuxdeploy command without the plugins will result in a broken external binary.

[I] dlangevi@hunger ~/c/t/e/s/s/t/r/b/appimage (dev)> cp ../appimage_deb/data/usr/bin/app sidecar.AppDir/usr/bin/app
[I] dlangevi@hunger ~/c/t/e/s/s/t/r/b/appimage (dev)> md5sum sidecar.AppDir/usr/bin/app
094934b97979cb74257495b39d10c9c7  sidecar.AppDir/usr/bin/app
[I] dlangevi@hunger ~/c/t/e/s/s/t/r/b/appimage (dev)> sidecar.AppDir/usr/bin/app
[2:29:19 PM] new message
[2:29:20 PM] new message
[2:29:20 PM] new message
^C
[I] dlangevi@hunger ~/c/t/e/s/s/t/r/b/appimage (dev)> /home/dlangevi/.cache/tauri/linuxdeploy-x86_64.AppImage --appdir sidecar.AppDir/ > stdout.txt
linuxdeploy version 1-alpha (git commit ID 287c436), GitHub actions build 110 built on 2022-08-17 20:56:20 UTC
[I] dlangevi@hunger ~/c/t/e/s/s/t/r/b/appimage (dev)> md5sum sidecar.AppDir/usr/bin/app
84c73f2b334f8a9ce305e4f4993bc241  sidecar.AppDir/usr/bin/app
[I] dlangevi@hunger ~/c/t/e/s/s/t/r/b/appimage (dev)> sidecar.AppDir/usr/bin/app
pkg/prelude/bootstrap.js:1

SyntaxError: Invalid or unexpected token
    at new Script (vm.js:102:7)
    at readPrelude (internal/bootstrap/pkg.js:29:13)
    at internal/bootstrap/pkg.js:36:18
    at internal/bootstrap/pkg.js:43:4
    at internal/bootstrap/pkg.js:44:2

stdout.txt

al-sabr commented 5 months ago

Does anyone have any idea when this issue will be tackled?

mohammadmansour200 commented 2 months ago

Any new updates about this bug? it still happens (ffmpeg and ffprobe binaries in my case) in tauri version 1