gtk-rs / gtk3-rs

Rust bindings for GTK 3
https://gtk-rs.org
MIT License
508 stars 90 forks source link

could not find system library 'gio-2.0' required by the 'gio-sys' crate #773

Closed cxgreat2014 closed 1 year ago

cxgreat2014 commented 1 year ago
git clone https://github.com/gtk-rs/gtk3-rs
cd gtk3-rs/example
cargo build

build log:

    Skipping git submodule `https://github.com/gtk-rs/gir` due to update strategy in .gitmodules
    Skipping git submodule `https://github.com/gtk-rs/gir-files` due to update strategy in .gitmodules
   Compiling toml v0.5.9
   Compiling thiserror-impl v1.0.35
   Compiling futures-macro v0.3.24
   Compiling proc-macro-error v1.0.4
   Compiling num-integer v0.1.45
   Compiling gtk-rs-examples v0.0.1 (/home/solar/workspace/gtk3-rs/examples)
   Compiling chrono v0.4.22
   Compiling system-deps v6.0.2
   Compiling futures-util v0.3.24
   Compiling thiserror v1.0.35
   Compiling glib-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3221869d)
   Compiling gobject-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3221869d)
   Compiling gio-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3221869d)
   Compiling atk-sys v0.16.0 (/home/solar/workspace/gtk3-rs/atk/sys)
   Compiling gdk-pixbuf-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3221869d)
   Compiling gdk-sys v0.16.0 (/home/solar/workspace/gtk3-rs/gdk/sys)
   Compiling proc-macro-crate v1.2.1
   Compiling pest v2.3.1
The following warnings were emitted during compilation:

warning: `"pkg-config" "--libs" "--cflags" "gobject-2.0" "gobject-2.0 >= 2.56"` did not exit successfully: exit status: 1

error: failed to run custom build command for `gobject-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3221869d)`

Caused by:
  process didn't exit successfully: `/home/solar/workspace/gtk3-rs/target/debug/build/gobject-sys-521d8f201e076993/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=GOBJECT_2.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" "gobject-2.0" "gobject-2.0 >= 2.56"` did not exit successfully: exit status: 1
  error: could not find system library 'gobject-2.0' required by the 'gobject-sys' crate

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

warning: build failed, waiting for other jobs to finish...
The following warnings were emitted during compilation:

warning: `"pkg-config" "--libs" "--cflags" "gio-2.0" "gio-2.0 >= 2.56"` did not exit successfully: exit status: 1

error: failed to run custom build command for `gio-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3221869d)`

Caused by:
  process didn't exit successfully: `/home/solar/workspace/gtk3-rs/target/debug/build/gio-sys-7c07718f12e0c4e1/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=GIO_2.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" "gio-2.0" "gio-2.0 >= 2.56"` did not exit successfully: exit status: 1
  error: could not find system library 'gio-2.0' required by the 'gio-sys' crate

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

What should I do?

sdroege commented 1 year ago

Install GLib 2.56 or newer on your system.

cxgreat2014 commented 1 year ago
  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" "cairo" "cairo >= 1.14"` did not exit successfully: exit status: 1
  error: could not find system library 'cairo' required by the 'cairo-sys-rs' crate

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

The following warnings were emitted during compilation:

warning: `"pkg-config" "--libs" "--cflags" "pango" "pango >= 1.40"` did not exit successfully: exit status: 1

error: failed to run custom build command for `pango-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3221869d)`

Caused by:
  process didn't exit successfully: `/home/solar/workspace/gtk3-rs/target/debug/build/pango-sys-519af111f2bdeba6/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=PANGO_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" "pango" "pango >= 1.40"` did not exit successfully: exit status: 1
  error: could not find system library 'pango' required by the 'pango-sys' crate

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

Are there any tutorials for beginners to set up a gtk3-rs development environment?

sdroege commented 1 year ago

Which Linux distribution are you using? You need to install the development package for GTK, e.g. libgtk3.0-dev on Debian/Ubuntu and (IIRC) gtk3-devel on Fedora. That will bring all the other dependencies like pango and cairo too.

cxgreat2014 commented 1 year ago

I use Ubuntu 20.04 for development, after installing libgtk-3-dev it works, thanks!

wiiznokes commented 8 months ago

This should be on the Read me

sdroege commented 8 months ago

Do you want to provide a PR for that?