8

I've installed Rust with rustup-init.exe on my PC (Windows 10 Pro) and then Microsoft Visual C++ Build Tools 2017 with Visual C++ tools for CMake option.

For simple example there is no problems:

fn main() {
   println!("Hello world!");
}

I execute cargo run command and as a result I get Hello world! as expected.


But now I want to check out Azul GUI framework

main.rs

extern crate azul;

fn main() {
   println!("Hello world!");
}

Cargo.toml

[package]
name = "my_first_azul_app"
version = "0.1.0"
authors = ["Author"]
edition = "2018"

[dependencies]
azul = { git = "https://github.com/maps4print/azul" }

When I execute cargo run command an error occurs:

...

error: failed to run custom build command for `harfbuzz-sys v0.3.0 (https://github.com/maps4print/azul-dependencies?rev=c1548977fb62399f39aa642d2e7e24a24a25246e#c1548977)`
process didn't exit successfully: `C:\Users\admin\Documents\Rust\Projects\my_first_azul_app\target\debug\build\harfbuzz-sys-37196527d1c78dd0\build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=HARFBUZZ_SYS_NO_PKG_CONFIG
running: "cmake" "C:\\Users\\admin\\.cargo\\git\\checkouts\\azul-dependencies-70bb1f94316762f9\\c154897\\harfbuzz-sys-0.3.0\\harfbuzz" "-G" "Visual Studio 15 2017 Win64" "-Thost=x64" "-DCMAKE_INSTALL_PREFIX=C:\\Users\\admin\\Documents\\Rust\\Projects\\my_first_azul_app\\target\\debug\\build\\harfbuzz-sys-9193f770b45e8642\\out" "-DCMAKE_C_FLAGS= /nologo /MD" "-DCMAKE_C_FLAGS_DEBUG= /nologo /MD" "-DCMAKE_CXX_FLAGS= /nologo /MD" "-DCMAKE_CXX_FLAGS_DEBUG= /nologo /MD" "-DCMAKE_BUILD_TYPE=Debug"

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

...

How to fix this issue with CMake and Rust? Should I specify CMake path or so?

mr.boris
  • 3,667
  • 8
  • 37
  • 70
  • Maybe you need to install `pkg-config`? – arrowd Mar 21 '19 at 06:02
  • 1
    *"is `cmake` not installed?"*? What does happen if you run the command in a terminal (e.g. powershell)? – hellow Mar 21 '19 at 07:27
  • 1
    I'm not sure what exactly is included in "Visual C++ tools for CMake", but are you sure that [cmake](https://www.cmake.org/) itself is installed? What happens if you run `cmake --version`? – Jmb Mar 21 '19 at 07:29
  • @Jmb as it turned out "Visual C++ tools for CMake" option does include CMake during the installation proccess of Visual Studio Build Tools but you have to add CMake bin folder to PATH variables manually after installation is complete. – mr.boris Mar 21 '19 at 22:21

1 Answers1

18

I solved it by adding CMake bin into the PATH variables. Just searched for cmake.exe file or CMake folder in recently installed Visual Studio Build Tools directory and found cmake.exe

For me it was C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin

So that I didn't have to install CMake separately.

Also I added Windows 10 SDK checkbox during installation process of Visual Studio Build Tools.

Now there is no errors while building my project.

halfer
  • 19,824
  • 17
  • 99
  • 186
mr.boris
  • 3,667
  • 8
  • 37
  • 70
  • 4
    This path can change so in 2019 community it looks like `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin` – Eugene Kortov Apr 17 '20 at 20:40
  • 1
    2022 Build Tools: `C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin`. – Igor Kustov Jan 12 '23 at 23:38