tauri-apps / tauri

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

[bug] gtk+-3.0.pc not found #9897

Open lnksz opened 5 months ago

lnksz commented 5 months ago

Describe the bug

Coming from https://github.com/tauri-apps/tauri/issues/5781, I hit a similar build error

-- Running input plugin: gtk --
[gtk/stdout] Installing AppRun hook
[gtk/stderr] chmod: cannot access 'd3.AppDir/usr/lib64': No such file or directory
[gtk/stdout] Installing GLib schemas
[gtk/stdout] Installing GTK 3.0 modules
[gtk/stderr] /home/y/snap/alacritty/common/.cache/tauri/linuxdeploy-plugin-gtk.sh: there is no 'exec_prefix' variable for 'gtk+-3.0' library.
[gtk/stderr] Please check the 'gtk+-3.0.pc' file is present in $PKG_CONFIG_PATH (you may need to install the appropriate -dev/-devel package).
ERROR: Failed to run plugin: gtk (exit code: 1)
       Error [tauri_cli_node] failed to bundle project: error running appimage.sh

If I try to install sudo apt install libgtk-3-dev, then it shows as already installed.

libgtk-3-dev is already the newest version (3.24.33-1ubuntu2.1).

The other hint is true, there is no lib64 dir in that folder

chmod: cannot access 'd3.AppDir/usr/lib64': No such file or directory

 ll ./src-tauri/target/release/bundle/appimage/d3.AppDir/usr/
total 20K
drwxrwxr-x 5 y y 4.0K May 28 08:32 .
drwxrwxr-x 4 y y 4.0K May 28 08:32 ..
drwxrwxr-x 2 y y 4.0K May 28 08:32 bin
drwxrwxr-x 3 y y 4.0K May 28 08:32 lib
drwxrwxr-x 6 y y 4.0K May 28 08:32 share

Reproduction

on Ubuntu 22.04

-- Running input plugin: gtk --
[gtk/stdout] Installing AppRun hook
[gtk/stderr] chmod: cannot access 'd3.AppDir/usr/lib64': No such file or directory
[gtk/stdout] Installing GLib schemas
[gtk/stderr] /home/kristof/snap/alacritty/common/.cache/tauri/linuxdeploy-plugin-gtk.sh: there is no 'exec_prefix' variable for 'gtk+-3.0' library.
[gtk/stderr] Please check the 'gtk+-3.0.pc' file is present in $PKG_CONFIG_PATH (you may need to install the appropriate -dev/-devel package).
[gtk/stdout] Installing GTK 3.0 modules
ERROR: Failed to run plugin: gtk (exit code: 1)
       Error [tauri_cli_node] failed to bundle project: error running appimage.sh

Expected behavior

Successfull AppImage build

Full tauri info output

> tauri "info"

[✔] Environment
    - OS: Ubuntu 22.04 X64
    ✔ webkit2gtk-4.0: 2.44.0
    ✔ rsvg2: 2.52.5
    ✔ rustc: 1.78.0 (9b00956e5 2024-04-29)
    ✔ cargo: 1.78.0 (54d8815d0 2024-03-26)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 20.13.1
    - pnpm: 8.11.0
    - yarn: 1.22.19
    - npm: 10.2.4
    - bun: 1.0.15

[-] Packages
    - tauri [RUST]: 1.6.7
    - tauri-build [RUST]: 1.5.2
    - wry [RUST]: 0.24.10
    - tao [RUST]: 0.16.9
    - @tauri-apps/api [NPM]: 1.5.6
    - @tauri-apps/cli [NPM]: 1.5.14

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist/d3/browser
    - devPath: http://localhost:1420/
    - framework: Angular
    - bundler: Webpack


### Stack trace

_No response_

### Additional context

_No response_
FabianLars commented 5 months ago

Hi, thanks for the report. For pkg-config issues i always ask if the user has homebrew installed because of https://tauri.app/v1/guides/faq#build-conflict-with-homebrew-on-linux - please check that. In your case i think the terminal being installed via snap may be the more likely issue (at least it's a common issue with vscode's built-in terminal if vscode was installed via snap). To check that you could try your systems "normal" terminal (or whatever was installed via apt and not snap) and/or run this before the build command:

unset GTK_PATH
unset GIO_MODULE_DIR

(a team member of ours reported that this worked for vscode, so maybe it works here too)

lnksz commented 4 months ago

Hi Lars,

thanks for the response!

if the user has homebrew installed

No, I don't have homebrew

the terminal being installed via snap may be the more likely issue

That is a good idea, I was using a snap installed Alacritty. I re-tried from scratch in an apt installed "Terminator".

The process errors out at the same place. I also tried the same with bun out of curiosity, but get the same error.