gcc.exe fail when building cloudflare-zlib-sys.rs

621 views Asked by At

I am trying to install sheep_cli for Amethyst.rs game engine. I have x86_64-8.1.0-posix-seh-rt_v6-rev0 MinGW installed. Maybe target is wrong?

error: failed to run custom build command for `cloudflare-zlib-sys v0.2.0`

Caused by:
  process didn't exit successfully: `C:\Users\user\AppData\Local\Temp\cargo-installMN5vHV\release\build\cloudflare-zlib-sys-eda63c9230465ae7\build-script-build` (exit code: 1)
--- stdout
OPT_LEVEL = Some("3")
TARGET = Some("x86_64-pc-windows-gnu")
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("false")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
cargo:include=C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\cloudflare-zlib-sys-0.2.0\vendor
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
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
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
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "gcc.exe" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "C:\\Users\\user\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cloudflare-zlib-sys-0.2.0\\vendor" "-mpclmul" "-msse4.2" "-msse4.2" "-DHAVE_OFF64_T=1" "-D_LARGEFILE64_SOURCE=
1" "-DHAVE_UNISTD_H=1" "-DHAS_PCLMUL" "-DHAS_SSE42" "-DHAVE_HIDDEN=1" "-o" "C:\\Users\\user\\AppData\\Local\\Temp\\cargo-installMN5vHV\\release\\build\\cloudflare-zlib-sys-399f3ab9f80722f4\\out\\crc32-pclmul_asm.o" "-c" "C:\\Users\\user\\.cargo\\registry\\src\\gith
ub.com-1ecc6299db9ec823\\cloudflare-zlib-sys-0.2.0\\vendor\\contrib/amd64/crc32-pclmul_asm.S"
cargo:warning=C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\cloudflare-zlib-sys-0.2.0\vendor\contrib/amd64/crc32-pclmul_asm.S: Assembler messages:
cargo:warning=C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\cloudflare-zlib-sys-0.2.0\vendor\contrib/amd64/crc32-pclmul_asm.S:125: Error: unknown pseudo-op: `.hidden'
cargo:warning=C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\cloudflare-zlib-sys-0.2.0\vendor\contrib/amd64/crc32-pclmul_asm.S:125: Warning: .type pseudo-op used outside of .def/.endef: ignored.
cargo:warning=C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\cloudflare-zlib-sys-0.2.0\vendor\contrib/amd64/crc32-pclmul_asm.S:125: Error: junk at end of line, first unrecognized character is `c'
cargo:warning=C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\cloudflare-zlib-sys-0.2.0\vendor\contrib/amd64/crc32-pclmul_asm.S:266: Warning: .size pseudo-op used outside of .def/.endef: ignored.
cargo:warning=C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\cloudflare-zlib-sys-0.2.0\vendor\contrib/amd64/crc32-pclmul_asm.S:266: Error: junk at end of line, first unrecognized character is `c'
exit code: 1

--- stderr


error occurred: Command "gcc.exe" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "C:\\Users\\user\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cloudflare-zlib-sys-0.2.0\\vendor" "-mpclmul" "-msse4.2" "-msse4.2" "-DHAVE_OFF64_T=1" "-D_LARG
EFILE64_SOURCE=1" "-DHAVE_UNISTD_H=1" "-DHAS_PCLMUL" "-DHAS_SSE42" "-DHAVE_HIDDEN=1" "-o" "C:\\Users\\user\\AppData\\Local\\Temp\\cargo-installMN5vHV\\release\\build\\cloudflare-zlib-sys-399f3ab9f80722f4\\out\\crc32-pclmul_asm.o" "-c" "C:\\Users\\user\\.cargo\\regi
stry\\src\\github.com-1ecc6299db9ec823\\cloudflare-zlib-sys-0.2.0\\vendor\\contrib/amd64/crc32-pclmul_asm.S" with args "gcc.exe" did not execute successfully (status code exit code: 1).



warning: build failed, waiting for other jobs to finish...
error: failed to compile `sheep_cli v0.3.0`, intermediate artifacts can be found at `C:\Users\user\AppData\Local\Temp\cargo-installMN5vHV`

Caused by:
  build failed
1

There are 1 answers

0
Alejandro González On BEST ANSWER

That crate has the build problem you showed when it is built by the Rust MinGW toolchain, but it compiles fine if you use the MSVC toolchain, which requires the Visual Studio C++ Build Tools (or a recent version of Visual Studio).

To install the latest stable MSVC toolchain, use the following command:

rustup toolchain install stable-msvc

Then, to set it as the default toolchain for all your Rust projects:

rustup default stable-msvc

For more information about the MSVC and MinGW flavors of the Rust toolchains, you can check out the official documentation.

Update: version 0.3.0 of the cloudflare-zlib-sys crate fixes Windows MinGW builds, so this workaround is no longer needed if you're using the latest version of that crate.