tauri-apps / tauri

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

[bug] AppImage script failes on CentOS (when building in Docker for macOS shared folder) #7994

Open hjmallon opened 11 months ago

hjmallon commented 11 months ago

Describe the bug

  1. cargo tauri build --verbose fails on CentOS 7 with mkdir: cannot create directory ‘XYZ/usr/lib64/gtk-3.0’: Permission denied. This is caused as XYZ/usr/lib64 is created with dr-xr-xr-x rather than drwxr-xr-x. I think it is created by the cp --parents in appimage script, which is copying the permissions from the original folder?

I hacked the following into the appimage script after the mkdir -p usr/lib and it got me a bit further.

if [ -d "/usr/lib64" ]; then
    mkdir -p "usr/lib64"
fi
  1. Once I did the above I get a new error
[gtk/stdout] Installing GTK 3.0 modules
[gtk/stdout] Updating immodules cache in XYZ//usr/lib64/gtk-3.0/3.0.0/immodules.cache
[gtk/stderr] sed: couldn't open temporary file XYZ//usr/lib64/gtk-3.0/3.0.0/sedlwLB51: Permission denied
ERROR: Failed to run plugin: gtk (exit code: 4) 

I think this might be related to the XYZ//usr/lib64/ folder being owned by root:root rather than my user?

Reproduction

Try to make an AppImage bundle on CentOS 7

Expected behavior

Creation of a successful AppImage

Platform and versions

[⚠] Environment
    - OS: CentOS 7.0.0 X64
    ✔ webkit2gtk-4.0: 2.28.2
    ✔ rsvg2: 2.40.20
    ✔ rustc: 1.72.1 (d5c2e9c34 2023-09-13) (Red Hat 1.72.1-1.el7)
    ✔ Cargo: 1.72.1
    ⚠ rustup: not installed!
      If you have rust installed some other way, we recommend uninstalling it
      then use rustup instead. Visit https://rustup.rs/
    ⚠ Rust toolchain: couldn't be detected!
      Maybe you don't have rustup installed? if so, Visit https://rustup.rs/
    - node: 16.18.1
    - yarn: 1.22.19
    - npm: 8.19.2

[-] Packages
    - tauri-cli [RUST]: 1.5.2

[-] App

Stack trace

No response

Additional context

No response

FabianLars commented 11 months ago

Hmmm, i tested it when i worked on the appimage bundler (the gtk/webkitgtk plugin in particular) and just now again and it works fine for me 🤔 grafik (clean build follow by a normal build to check if it can delete the prior build output correctly.)

Can you think of something that may be different on your system compared to a default install that i can try to reproduce this on my end?

hjmallon commented 11 months ago

I have just tried it with a fresh docker image and a fresh tauri app

  1. Use create-tauri-app to make a new fresh project, with pnpm and Vanilla and Typescript (since those are the first options)
  2. Change the bundle identifier
  3. docker run -v "$PWD:/code" -it centos:7 # i.e. start centos7 image from docker hub, mount the code dir into /code
  4. yum install epel-release
  5. yum install cargo rust nodejs npm glib2-devel webkitgtk4-devel librsvg2-devel wget
  6. cargo install tauri-cli
  7. curl -fsSL https://get.pnpm.io/install.sh | sh - # install pnpm
  8. source /root/.bashrc # some other pnpm install thing
  9. pnpm install
  10. cargo tauri build --verbose

Then I get that first error with

[gtk/stdout] Installing GTK 3.0 modules

[gtk/stderr] mkdir: cannot create directory 'tauri-app.AppDir/usr/lib64/gtk-3.0': Permission denied

ERROR: Failed to run plugin: gtk (exit code: 1)
FabianLars commented 11 months ago

My knowledge about centos and docker is fairly limited (non existant actually) but i followed your instructions and it still worked for me :/ grafik

hjmallon commented 11 months ago

I have found a way to make it work.

CARGO_TARGET_DIR=/rust-out cargo tauri build --debug --verbose

I think the problem is some weird interaction when used with Docker for Mac's folder sharing (I assume you are on real Linux). If I move the target dir outside of the shared folder like that then it seems to work.

FabianLars commented 11 months ago

right, i indeed used a Linux host. I do have a macos system too though so i can hopefully look into it soon-ish (i'm out of office for a few days).