tauri-apps / tauri

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

[bug] Rust package build failing when trying "tauri dev" #3701

Closed danimesq closed 2 years ago

danimesq commented 2 years ago

Describe the bug

Output:

  --- stderr
  Package javascriptcoregtk-4.0 was not found in the pkg-config search path.
  Perhaps you should add the directory containing `javascriptcoregtk-4.0.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'javascriptcoregtk-4.0' found
  Package javascriptcoregtk-4.0 was not found in the pkg-config search path.
  Perhaps you should add the directory containing `javascriptcoregtk-4.0.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'javascriptcoregtk-4.0' found

Even more details:

   Compiling zvariant v3.1.2
The following warnings were emitted during compilation:

warning: `"pkg-config" "--libs" "--cflags" "javascriptcoregtk-4.0" "javascriptcoregtk-4.0 >= 2.24"` did not exit successfully: exit status: 1

error: failed to run custom build command for `javascriptcore-rs-sys v0.4.0`

Caused by:
  process didn't exit successfully: `/home/daniell/Desktop/test/frameworkjs/src-tauri/target/debug/build/javascriptcore-rs-sys-e4d503634ed33e5f/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=JAVASCRIPTCOREGTK_4.0_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=`"pkg-config" "--libs" "--cflags" "javascriptcoregtk-4.0" "javascriptcoregtk-4.0 >= 2.24"` did not exit successfully: exit status: 1
  error: could not find system library 'javascriptcoregtk-4.0' required by the 'javascriptcore-rs-sys' crate

  --- stderr
  Package javascriptcoregtk-4.0 was not found in the pkg-config search path.
  Perhaps you should add the directory containing `javascriptcoregtk-4.0.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'javascriptcoregtk-4.0' found
  Package javascriptcoregtk-4.0 was not found in the pkg-config search path.
  Perhaps you should add the directory containing `javascriptcoregtk-4.0.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'javascriptcoregtk-4.0' found

warning: build failed, waiting for other jobs to finish...
error: build failed
    Blocking waiting for file lock on build directory
   Compiling zstd-safe v4.1.4+zstd.1.5.2
   Compiling javascriptcore-rs-sys v0.4.0
   Compiling gobject-sys v0.15.9
   Compiling cairo-sys-rs v0.15.1
   Compiling gio-sys v0.14.0
   Compiling gtk v0.15.4
   Compiling rfd v0.7.0
   Compiling gobject-sys v0.14.0
   Compiling zbus v2.1.1
The following warnings were emitted during compilation:

warning: `"pkg-config" "--libs" "--cflags" "javascriptcoregtk-4.0" "javascriptcoregtk-4.0 >= 2.24"` did not exit successfully: exit status: 1

error: failed to run custom build command for `javascriptcore-rs-sys v0.4.0`

Caused by:
  process didn't exit successfully: `/home/daniell/Desktop/test/frameworkjs/src-tauri/target/debug/build/javascriptcore-rs-sys-e4d503634ed33e5f/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=JAVASCRIPTCOREGTK_4.0_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=`"pkg-config" "--libs" "--cflags" "javascriptcoregtk-4.0" "javascriptcoregtk-4.0 >= 2.24"` did not exit successfully: exit status: 1
  error: could not find system library 'javascriptcoregtk-4.0' required by the 'javascriptcore-rs-sys' crate

Reproduction

No response

Expected behavior

No response

Platform and versions

❯ cargo tauri info

Operating System - Ubuntu, version 20.04 X64

Node.js environment
  Node.js - 14.17.3
  @tauri-apps/cli - 1.0.0-rc.6
  @tauri-apps/api - 1.0.0-rc.2

Global packages
  npm - 7.19.1
  pnpm - Not installed
  yarn - 1.22.10

Rust environment
  rustup - 1.24.3
  rustc - 1.59.0
  cargo - 1.59.0
  toolchain - stable-x86_64-unknown-linux-gnu 

App directory structure
/node_modules
/dist
/src-tauri

App
  tauri - 1.0.0-rc.4
  tauri-build - 1.0.0-rc.4
  tao - 0.6.4
  wry - 0.13.3
  build-type - bundle
  CSP - unset
  distDir - ../dist
  devPath - ../dist

Stack trace

No response

Additional context

No response

lucasfernog commented 2 years ago

You need to install the system dependencies listed here.

danimesq commented 2 years ago

You need to install the system dependencies listed here.

Have installed libwebkit2gtk-4.0-dev, build-essential, curl, wget, libssl-dev, libgtk-3-dev, libappindicator3-dev, librsvg2-dev. Have NOT installed libappindicator nor librsvg as they're marked as optional.

Already have NodeJS installed (although not sure if installed from official NodeJS or from nvm).

Have upgraded my old (but already installed) Rustc and Cargo.

rustc --version outputs rustc 1.59.0 (9d1b2106e 2022-02-23). npm -v outputs 7.19.1.

This isn't a issue in the repo, but in the docs; specifically this part:

sudo apt update && sudo apt install libwebkit2gtk-4.0-dev \ build-essential \ curl \ wget \ libssl-dev \ libgtk-3-dev \ libappindicator3-dev \ librsvg2-dev

I copied it and pasted, but Bash have read only sudo apt update and the other lines were missed.

libssl-dev wasn't installed. libappindicator3-dev wasn't installed. librsvg2-dev wasn't installed. (why optional packages were added in the required quote?)

When trying sudo apt install libwebkit2gtk-4.0-dev, got this output:

Reading package lists... Done Building dependency tree
Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation:

The following packages have unmet dependencies: libwebkit2gtk-4.0-dev : Depends: libsoup2.4-dev (>= 2.40) but it is not going to be installed E: Unable to correct problems, you have held broken packages.

How to fix the libsoup2.4-dev issue?

jaques-sam commented 2 years ago

On debian11 the package libappindicator3-dev cannot be found any more.

lucasfernog commented 2 years ago

We're currently working to expose the Ayatana appindicator in tauri.

lucasfernog commented 2 years ago

@jaques-sam you can add Debian 10 to your source list, see #2647

thy-jumrylsolivio commented 1 year ago

to fix the libsoup2.4-dev issue try this " sudo apt install libsoup2.4-dev

Type1J commented 1 year ago

You need to install the system dependencies listed here.

Did you mean https://tauri.app/v1/guides/getting-started/prerequisites ?

FabianLars commented 1 year ago

that's the new location of the docs Lucas linked back then, correct.

Kennytian commented 1 year ago

sudo apt-get install javascriptcoregtk-4.1 libsoup-3.0 webkit2gtk-4.1 -y

It's worked for me

Edit by @FabianLars: These are the requirements for tauri v2! For v1 see the other comments above.

FreeWebber commented 1 year ago

You need to install the system dependencies listed here.

Link is broken, now it's here

ZoeLeee commented 6 months ago

sudo apt-get install javascriptcoregtk-4.1 libsoup-3.0 webkit2gtk-4.1 -y

It's worked for me

Edit by @FabianLars: These are the requirements for tauri v2! For v1 see the other comments above.

It's worked for me

OJFord commented 6 months ago

Note on ubuntu (at least, GH Actions' ubuntu-latest) it's:

Then it still doesn't work because:

 error: failed to run custom build command for `gdk-sys v0.18.0`
[...]
  --- stderr
  `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" "pkg-config" "--libs" "--cflags" "gdk-3.0" "gdk-3.0 >= 3.22"` did not exit successfully: exit status: 1
  error: could not find system library 'gdk-3.0' required by the 'gdk-sys' crate
  --- stderr
  Package gdk-3.0 was not found in the pkg-config search path.
  Perhaps you should add the directory containing `gdk-3.0.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'gdk-3.0' found
  Package gdk-3.0 was not found in the pkg-config search path.
  Perhaps you should add the directory containing `gdk-3.0.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'gdk-3.0' found

libgdk3.0-cil doesn't fix it; leaving it there for now.

FabianLars commented 6 months ago

If you append -0 it will install the runtime package but to build the app you will need the development packages that have the -dev suffix instead of -0.

The lib in front while technically correct is not reallyyy required since apt-get interprets it as a pattern and will add the lib prefix itself. Same for -dev as long as you do not append the -0.

To be extra clear, the most correct name on ubuntu is libwebkit2gtk-4.1-dev. This will also include libsoup and libjavascriptcore so in theory you can remove the other 2.

kleenkanteen commented 4 months ago

I am using github codspaces that uses Ubuntu 20 LTS for tauri v1 and am getting this error:

@kleenkanteen ➜ /workspaces/speak-together (main) $ sudo apt install libwebkit2gtk-4.1-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libwebkit2gtk-4.1-dev
E: Couldn't find any package by glob 'libwebkit2gtk-4.1-dev'

Similar error if I do sudo apt-get install javascriptcoregtk-4.1 libsoup-3.0 webkit2gtk-4.1 -y:

@kleenkanteen ➜ /workspaces/speak-together (main) $ sudo apt-get install javascriptcoregtk-4.1 libsoup-3.0 webkit2gtk-4.1 -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package javascriptcoregtk-4.1
E: Couldn't find any package by glob 'javascriptcoregtk-4.1'
E: Couldn't find any package by regex 'javascriptcoregtk-4.1'
E: Unable to locate package libsoup-3.0
E: Couldn't find any package by glob 'libsoup-3.0'
E: Couldn't find any package by regex 'libsoup-3.0'
E: Unable to locate package webkit2gtk-4.1
E: Couldn't find any package by glob 'webkit2gtk-4.1'
E: Couldn't find any package by regex 'webkit2gtk-4.1'

I did sudo apt update and sudo apt update before all this.

Any ideas? What a pain

FabianLars commented 4 months ago

If you want to develop for tauri v1 (which you said) then you want to install webkitgtk 4.0 not 4.1

If you want to develop for v2 then you need Ubuntu 22.04 or above for 4.1

kleenkanteen commented 4 months ago

That fixed the erorr, I installed webgitktk 4 with sudo apt install libwebkit2gtk-4.0-dev.

Now I get the error (speak-together:28859): Gtk-WARNING **: 19:14:44.440: cannot open display:. I think since I am connected over ssh. I tried following https://stackoverflow.com/questions/76961661/how-to-open-the-tauri-application-located-on-the-server, no banana.

Is it feasible to do tauri developement over ssh?

hellojason3 commented 2 months ago

If you meet this in Ubuntu24, unfortunately, it does not have the libwebkit2gtk-4.0-dev package yet, see this link in the official repository. ubuntu official package search I haven't found a solution yet and gave up on tauri for now.

AndreRojasMartinsson commented 6 days ago

Workaround in this issue tauri-apps/tauri#9662

I worked around this by adding the following line to /etc/apt/sources.list:

deb http://gb.archive.ubuntu.com/ubuntu jammy main

Then doing:

sudo apt update sudo apt install libwebkit2gtk-4.0-dev

IMPORTANT: it was recommended in this https://github.com/tauri-apps/tauri/issues/9662#issuecomment-2133959550 to undo the change to sources.list after installing to prevent problems with dependencies being deleted.