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

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

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (7 by maintainers)

Commits related to this issue

Most upvoted comments

You need to install the system dependencies listed here.

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.

You need to install the system dependencies listed here.

Link is broken, now it’s here

You need to install the system dependencies listed here.

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

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.

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.

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.

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

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?

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

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

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