Compilation error “ failed to run custom build command for `freetype-sys v0.13.1' ” win 10

**

**

I am trying to build a Rust program on Windows 10 having a GUI. When trying to compile a Rust file with gtk dependency on Windows 10 I keep getting the following error messages.

**

**

warning: unused manifest key: target.i686-pc-windows-msvc.freetype
warning: unused manifest key: target.x86_64-pc-windows-msvc.freetype
Compiling freetype-sys v0.13.1
Compiling glib-sys v0.10.0 (GitHub - gtk-rs/sys: DEPRECATED, each crate has its own sys folder now.)
error: failed to run custom build command for freetype-sys v0.13.1

Caused by:
process didn't exit successfully: F:\KA_IdeaProjects\KA_Test_rustIProject2\target\debug\build\freetype-sys-66d9e52815699227\build-script-build (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=FREETYPE2_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=FREETYPE2_STATIC
cargo:rerun-if-env-changed=FREETYPE2_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
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
running: "cmake" "C:\Users\3830101\.cargo\registry\src\github.com-1ecc6299db9ec823\freetype-sys-0.13.1\freetype2" "-G" "Visual Studio 16 2019" "-Thost=x64" "-Ax64" "-DWITH_BZip2=OFF" "-DWITH_HarfBuzz=OFF" "-DWITH_PNG=OFF" "-DWITH_ZLIB=OFF" "-DCMAKE_INSTALL_PREFIX=F:\KA_IdeaProjects\KA_Test_rustIProject2\target\debug\build\freetype-sys-ef0fda53c071f0de\out" "-DCMAKE_C_FLAGS= -nologo -MD -Brepro" "-DCMAKE_C_FLAGS_RELEASE= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS= -nologo -MD -Brepro" "-DCMAKE_CXX_FLAGS_RELEASE= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS= -nologo -MD -Brepro" "-DCMAKE_ASM_FLAGS_RELEASE= -nologo -MD -Brepro" "-DCMAKE_BUILD_TYPE=Release"

--- stderr
thread 'main' panicked at '
failed to execute command: The system cannot find the file specified. (os error 2)
is cmake not installed?

build script failed, must exit now', C:\Users\3830101.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.45\src\lib.rs:894:5
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

How do I fix this error?

The error says:

failed to execute command: The system cannot find the file specified. (os error 2)
is cmake not installed?

Do you have cmake instaled?

**

Tried installing cmake using cargo install cmake command and getting the following error message

**

Updating crates.io index error: specified package cmake v0.1.45 has no binaries

cmake is not a Rust project, it's an independent build system. There are installation instructions here, or try here if you're using Visual Studio.

1 Like

**

Installed cmake and entered the command "cargo check" and got the following error messages.

**

warning: unused manifest key: dependencies.gtk.cmake
warning: unused manifest key: target.i686-pc-windows-msvc.freetype
warning: unused manifest key: target.x86_64-pc-windows-msvc.freetype
Checking futures-core v0.3.14
Checking futures-sink v0.3.14
Checking pin-utils v0.1.0
Checking futures-io v0.3.14
Checking futures-task v0.3.14
Checking slab v0.4.3
Checking pin-project-lite v0.2.6
Checking smallvec v1.6.1
Checking once_cell v1.7.2
Checking futures-channel v0.3.14
Checking libc v0.2.94
Checking memchr v2.3.4
Checking proc-macro-nested v0.1.7
Checking winapi v0.3.9
Checking bitflags v1.2.1
Compiling freetype-sys v0.13.1
Checking thiserror v1.0.24
Checking futures-util v0.3.14
Compiling glib-sys v0.10.0 (GitHub - gtk-rs/sys: DEPRECATED, each crate has its own sys folder now.)
error: failed to run custom build command for glib-sys v0.10.0 (https://github.com/gtk-rs/sys#5f35e26c)

Caused by:
process didn't exit successfully: F:\KA_IdeaProjects\KA_Test_rustIProject2\target\debug\build\glib-sys-f403e58c78145f13\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
cargo:rerun-if-env-changed=GLIB_2.0_STATIC
cargo:rerun-if-env-changed=GLIB_2.0_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
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

--- stderr
Failed to run "pkg-config" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.44": The system cannot find the file specified. (os error 2)
warning: build failed, waiting for other jobs to finish...
error: build failed

Now it wants a C dependency "glib-2.0". This should be installed with GTK.

gtk/glib is a C dependency. Cargo can only install Rust dependencies for you, but won't help you at all with any C dependencies. In case of glib-2.0 you have to figure out yourself where to find it and how to install. Cargo can't do it.

I'm not sure how to install glib on Windows. The official instructions are for MSYS2, which may require switching Rust target to the gnu one? Maybe Microsoft's vcpkg will have it too?

**

I tried cargo check command (which gave out the error messages as shown in earlier reply) only after installing MSYS2. Not sure where I have gone wrong.

**

**

**

I have used commands in "pacman -Syu", "pacman -Su" and " pacman -S --disable-download-timeout mingw-w64-x86_64-toolchain git" in MSYS2 console. Also, used "cargo clean" command. However, error in attached picture is popping up. How to fix this error.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.