Installing rust on Windows

I am trying to install rust on windows and testing Actix and I get this error:

error: failed to run custom build command for brotli-sys v0.3.2
Caused by:
process didn't exit successfully: C:\Users\XXXX\code\testlog2\target\debug\build\brotli-sys-54139617a5f05678\build-script-build (exit code: 1)
--- stdout
cargo:include=C:\Users\XXXX.cargo\registry\src\github.com-1ecc6299db9ec823\brotli-sys-0.3.2\brotli/include
TARGET = Some("x86_64-pc-windows-gnu")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-pc-windows-gnu")
CC_x86_64-pc-windows-gnu = None
CC_x86_64_pc_windows_gnu = None
HOST_CC = None
CC = None
CFLAGS_x86_64-pc-windows-gnu = None
CFLAGS_x86_64_pc_windows_gnu = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "gcc.exe" "-O0" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "brotli/include"
"-o" "C:\Users\XXXX\code\testlog2\target\debug\build\brotli-sys-3a699bf9fd241761\out\brotli/common/dictionary.o" "-c" "brotli/common/dictionary.c"

--- stderr

error occurred: Failed to find tool. Is gcc.exe installed? (see https://github.com/alexcrichton/cc-rs#compile-time-requirements for help)

Do I need gnu/cygwin to run actix on windows???
Any help is welcome

Could you describe how you installed Rust and how you're trying to build Actix? Rust (and the cc crate in particular) does require some kind of C toolchain to be installed -- on Windows that would be MinGW or MSVC I think.

Hi Cole, I installed rust via the rust installer here: Install Rust - Rust Programming Language
Everything compiles well but not actix. I choose the 64 bits and rustc --version works fine

What is the output of rustup target list --installed?

Hi Cole:

x86_64-pc-windows-gnu

Here's what the cc documentation has to say:

Windows platforms targeting MinGW (e.g. your target triple ends in -gnu ) require cc to be available in PATH . We recommend the MinGW-w64 distribution, which is using the Win-builds installation system. You may also acquire it via MSYS2, as explained here. Make sure to install the appropriate architecture corresponding to your installation of rustc. GCC from older MinGW project is compatible only with 32-bit rust compiler.

You probably want to try following those instructions to get MinGW set up.

(The reason you need a C compiler at all here is that actix-web apparently depends, directly or indirectly, on the brotli-sys crate, which is a sort of Rust shim for interfacing with the brotli C library. Sometimes -sys crates like that want to compile the C library from source as part of the build process, and they usually hook in the cc crate to perform that task.)

2 Likes

I will try installing MinGW-w64. Many thanks cole.

No problem -- if you run into more difficulties feel free to ask in this thread.

many Thanks got it to work by installing Msys64 and including the gcc.exe in my paths. I have to say installing rust on IOS was easier.

1 Like

You need gnu environment, because you're using rust-for-gnu target. If you use -msvc Windows target, then you'll need Visual Studio instead.

Some of your dependencies compile C code, so you have to have a compiler for them one way or another.

1 Like

I assume because Apple is kind enough to make a C compiler available out of the box, unlike Microsoft :‌P

1 Like

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.