Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

[HELP] Gtk-rs + Windows 10 #763

Open
zvladimir opened this issue Jul 8, 2022 · 2 comments
Open

[HELP] Gtk-rs + Windows 10 #763

zvladimir opened this issue Jul 8, 2022 · 2 comments

Comments

@zvladimir
Copy link

Hello!

I try to use gtk-rs on Windows 10 system but have some trouble.

First - I need to install gtk and follow instructions https://gtk-rs.org/gtk4-rs/stable/latest/book/installation_windows.html

  1. install msys2
  2. pacman -S mingw-w64-x86_64-gtk4 mingw-w64-x86_64-pkgconf mingw-w64-x86_64-gcc
  3. updated environment vars
C:\msys64\mingw64\include
C:\msys64\mingw64\bin
C:\msys64\mingw64\lib
rustup toolchain install stable-gnu
rustup default stable-gnu

Second - I try gtk example
cargo run --bin basics
and get access error

C:\temp\gtk3-rs\examples>cargo run --bin basics
   Compiling glib-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)
   Compiling gobject-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)
   Compiling gio-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)
   Compiling gdk-pixbuf-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)
   Compiling cairo-sys-rs v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)
   Compiling atk-sys v0.16.0 (C:\temp\gtk3-rs\atk\sys)
   Compiling pango-sys v0.16.0 (https://github.com/gtk-rs/gtk-rs-core#3a0325e0)
   Compiling gdk-sys v0.16.0 (C:\temp\gtk3-rs\gdk\sys)
The following warnings were emitted during compilation:

warning: Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.56"`, because: Отказано в доступе. (os error 5)

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

Caused by:
  process didn't exit successfully: `C:\temp\gtk3-rs\target\debug\build\glib-sys-8ba52df866badbdf\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=GLIB_2.0_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.56"`, because: Отказано в доступе. (os error 5)
warning: build failed, waiting for other jobs to finish...
The following warnings were emitted during compilation:

warning: Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "gio-2.0" "gio-2.0 >= 2.56"`, because: Отказано в доступе. (os error 5)

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

Caused by:
  process didn't exit successfully: `C:\temp\gtk3-rs\target\debug\build\gio-sys-8719c2af73cc49c1\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=GIO_2.0_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "gio-2.0" "gio-2.0 >= 2.56"`, because: Отказано в доступе. (os error 5)
The following warnings were emitted during compilation:

warning: Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "gobject-2.0" "gobject-2.0 >= 2.56"`, because: Отказано в доступе. (os error 5)

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

Caused by:
  process didn't exit successfully: `C:\temp\gtk3-rs\target\debug\build\gobject-sys-418f85813dba6fdd\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=GOBJECT_2.0_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "gobject-2.0" "gobject-2.0 >= 2.56"`, because: Отказано в доступе. (os error 5)
The following warnings were emitted during compilation:

warning: Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "gdk-pixbuf-2.0" "gdk-pixbuf-2.0 >= 2.36.8"`, because: Отказано в доступе. (os error 5)

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

Caused by:
  process didn't exit successfully: `C:\temp\gtk3-rs\target\debug\build\gdk-pixbuf-sys-e2bccb46f620561d\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=GDK_PIXBUF_2.0_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "gdk-pixbuf-2.0" "gdk-pixbuf-2.0 >= 2.36.8"`, because: Отказано в доступе. (os error 5)
The following warnings were emitted during compilation:

warning: Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "cairo" "cairo >= 1.14"`, because: Отказано в доступе. (os error 5)

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

Caused by:
  process didn't exit successfully: `C:\temp\gtk3-rs\target\debug\build\cairo-sys-rs-4ef883fd26592a7c\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-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "cairo" "cairo >= 1.14"`, because: Отказано в доступе. (os error 5)
error: failed to run custom build command for `gdk-sys v0.16.0 (C:\temp\gtk3-rs\gdk\sys)`

Caused by:
  process didn't exit successfully: `C:\temp\gtk3-rs\target\debug\build\gdk-sys-c402108360d26da8\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=GDK_3.0_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "gdk-3.0" "gdk-3.0 >= 3.22"`, because: Отказано в доступе. (os error 5)
The following warnings were emitted during compilation:

warning: Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "atk" "atk >= 2.28"`, because: Отказано в доступе. (os error 5)

error: failed to run custom build command for `atk-sys v0.16.0 (C:\temp\gtk3-rs\atk\sys)`

Caused by:
  process didn't exit successfully: `C:\temp\gtk3-rs\target\debug\build\atk-sys-707da6843218133e\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=ATK_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "atk" "atk >= 2.28"`, because: Отказано в доступе. (os error 5)
The following warnings were emitted during compilation:

warning: Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "pango" "pango >= 1.40"`, because: Отказано в доступе. (os error 5)

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

Caused by:
  process didn't exit successfully: `C:\temp\gtk3-rs\target\debug\build\pango-sys-266559505eef27ed\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=PANGO_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_pc_windows_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-pc-windows-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_pc_windows_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
  cargo:warning=Failed to run command `"C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "pango" "pango >= 1.40"`, because: Отказано в доступе. (os error 5)

and I install pkg-config-lite-0.28-1 in dir C:\pkg-config-lite-0.28-1\bin
and the error is repeated.

What am I doing wrong?
What are the correct instructions for installing gtk-rs?

@sdroege
Copy link
Member

sdroege commented Jul 9, 2022

warning: Failed to run command "C:\\pkg-config-lite-0.28-1\\bin" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.56", because: Отказано в доступе. (os error 5)

This says "Access denied".

You'll have to set up everything so that running pkg-config --libs glib-2.0 (for example) runs successfully. As part of that you have to actually install GLib and the other C libraries and make sure that pkg-config can find their .pc files.

@zvladimir
Copy link
Author

You'll have to set up everything so that running pkg-config --libs glib-2.0 (for example) runs successfully. As part of that you have to actually install GLib and the other C libraries and make sure that pkg-config can find their .pc files.

I set up pkg-config and now pkg-config --libs glib-2.0 show -LC:/msys64/mingw64/lib -lglib-2.0 -lintl

But the cargo run --bin basics still does not work and the error is repeated

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants