'How do I get past the following GTK4 build errors in Rust

I have downloaded the GTK4 demo from Github and placed it in a directory. I have opened it in VC and attempt to run the demo according to the Read.ME. I get the following

PS D:\Rust\Projects\gtk4-rs-master\examples\basics> cargo run --bin basics
   Compiling pango-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#bba02e39)
   Compiling cairo-sys-rs v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#bba02e39)
   Compiling graphene-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#bba02e39)
   Compiling gdk4-sys v0.5.0 (D:\Rust\Projects\gtk4-rs-master\gdk4\sys)
   Compiling gsk4-sys v0.5.0 (D:\Rust\Projects\gtk4-rs-master\gsk4\sys)
The following warnings were emitted during compilation:

warning: `"pkg-config" "--libs" "--cflags" "cairo" "cairo >= 1.14"` did not exit successfully: exit code: 1

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

Caused by:
  process didn't exit successfully: `D:\Rust\Projects\gtk4-rs-master\target\debug\build\cairo-sys-rs-45e88069668b1029\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=CAIRO_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_msvc
  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-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_msvc
  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-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_msvc
  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-pc-windows-msvc
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_msvc
  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 code: 1
  error: could not find system library 'cairo' required by the 'cairo-sys-rs' crate

  --- stderr
  Failed to open 'C:/msys64/mingw64/lib/pkgconfig\harfbuzz.pc': Too many open files
  Package 'harfbuzz', required by 'FreeType 2', not found

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

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

The following warnings were emitted during compilation:

warning: `"pkg-config" "--libs" "--cflags" "gtk4" "gtk4 >= 4.0.0"` did not exit successfully: exit code: 1

error: build failed
PS D:\Rust\Projects\gtk4-rs-master\examples\basics>

Any ideas of how to fix this?



Solution 1:[1]

The answer turned out to be another application that used GTK was higher in the path than my Rust compilers entries were. When I moved it down the application compiled.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 John