Build fails on MinGW toolchain
When building this crate with a Windows MinGW toolchain and the default features, the build fails with the following error:
2020-10-21T21:29:29.6706562Z The following warnings were emitted during compilation:
2020-10-21T21:29:29.6713138Z
2020-10-21T21:29:29.6715262Z warning: C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\cloudflare-zlib-sys-0.2.0\vendor\contrib/amd64/crc32-pclmul_asm.S: Assembler messages:
2020-10-21T21:29:29.6717108Z warning: C:\Users\runneradmin\.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'
2020-10-21T21:29:29.6719003Z warning: C:\Users\runneradmin\.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.
2020-10-21T21:29:29.6720960Z warning: C:\Users\runneradmin\.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'
2020-10-21T21:29:29.6723058Z warning: C:\Users\runneradmin\.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.
2020-10-21T21:29:29.6725003Z warning: C:\Users\runneradmin\.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'
2020-10-21T21:29:29.6726011Z
2020-10-21T21:29:29.6726512Z error: failed to run custom build command for `cloudflare-zlib-sys v0.2.0`
2020-10-21T21:29:29.6726966Z
2020-10-21T21:29:29.6727202Z Caused by:
2020-10-21T21:29:29.6728208Z process didn't exit successfully: `D:\a\project\project\target\release\build\cloudflare-zlib-sys-73a788ab2f5bd751\build-script-build` (exit code: 1)
2020-10-21T21:29:29.6729186Z --- stdout
2020-10-21T21:29:29.6729444Z OPT_LEVEL = Some("3")
2020-10-21T21:29:29.6729817Z TARGET = Some("x86_64-pc-windows-gnu")
2020-10-21T21:29:29.6730252Z HOST = Some("x86_64-pc-windows-msvc")
2020-10-21T21:29:29.6730669Z CC_x86_64-pc-windows-gnu = None
2020-10-21T21:29:29.6731034Z CC_x86_64_pc_windows_gnu = None
2020-10-21T21:29:29.6731343Z TARGET_CC = None
2020-10-21T21:29:29.6731607Z CC = None
2020-10-21T21:29:29.6731937Z CFLAGS_x86_64-pc-windows-gnu = None
2020-10-21T21:29:29.6732305Z CFLAGS_x86_64_pc_windows_gnu = None
2020-10-21T21:29:29.6732672Z TARGET_CFLAGS = None
2020-10-21T21:29:29.6733085Z CFLAGS = None
2020-10-21T21:29:29.6733401Z CRATE_CC_NO_DEFAULTS = None
2020-10-21T21:29:29.6733730Z DEBUG = Some("false")
2020-10-21T21:29:29.6734144Z CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
2020-10-21T21:29:29.6735090Z cargo:include=C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\cloudflare-zlib-sys-0.2.0\vendor
2020-10-21T21:29:29.6735965Z CC_x86_64-pc-windows-gnu = None
2020-10-21T21:29:29.6736305Z CC_x86_64_pc_windows_gnu = None
2020-10-21T21:29:29.6736614Z TARGET_CC = None
2020-10-21T21:29:29.6736875Z CC = None
2020-10-21T21:29:29.6737213Z CFLAGS_x86_64-pc-windows-gnu = None
2020-10-21T21:29:29.6737604Z CFLAGS_x86_64_pc_windows_gnu = None
2020-10-21T21:29:29.6737949Z TARGET_CFLAGS = None
2020-10-21T21:29:29.6738247Z CFLAGS = None
2020-10-21T21:29:29.6738535Z CRATE_CC_NO_DEFAULTS = None
2020-10-21T21:29:29.6738966Z CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
2020-10-21T21:29:29.6739411Z CC_x86_64-pc-windows-gnu = None
2020-10-21T21:29:29.6739773Z CC_x86_64_pc_windows_gnu = None
2020-10-21T21:29:29.6740078Z TARGET_CC = None
2020-10-21T21:29:29.6740338Z CC = None
2020-10-21T21:29:29.6740671Z CFLAGS_x86_64-pc-windows-gnu = None
2020-10-21T21:29:29.6741061Z CFLAGS_x86_64_pc_windows_gnu = None
2020-10-21T21:29:29.6741377Z TARGET_CFLAGS = None
2020-10-21T21:29:29.6741667Z CFLAGS = None
2020-10-21T21:29:29.6741979Z CRATE_CC_NO_DEFAULTS = None
2020-10-21T21:29:29.6742440Z CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
2020-10-21T21:29:29.6745332Z running: "gcc.exe" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "C:\\Users\\runneradmin\\.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" "D:\\a\\project\\project\\target\\x86_64-pc-windows-gnu\\release\\build\\cloudflare-zlib-sys-3592ede97c492f3c\\out\\crc32-pclmul_asm.o" "-c" "C:\\Users\\runneradmin\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\cloudflare-zlib-sys-0.2.0\\vendor\\contrib/amd64/crc32-pclmul_asm.S"
2020-10-21T21:29:29.6748727Z cargo:warning=C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\cloudflare-zlib-sys-0.2.0\vendor\contrib/amd64/crc32-pclmul_asm.S: Assembler messages:
2020-10-21T21:29:29.6750496Z cargo:warning=C:\Users\runneradmin\.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'
2020-10-21T21:29:29.6752370Z cargo:warning=C:\Users\runneradmin\.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.
2020-10-21T21:29:29.6754353Z cargo:warning=C:\Users\runneradmin\.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'
2020-10-21T21:29:29.6756291Z cargo:warning=C:\Users\runneradmin\.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.
2020-10-21T21:29:29.6758227Z cargo:warning=C:\Users\runneradmin\.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'
2020-10-21T21:29:29.6759322Z exit code: 1
2020-10-21T21:29:29.6759500Z
2020-10-21T21:29:29.6759733Z --- stderr
2020-10-21T21:29:29.6759925Z
2020-10-21T21:29:29.6760074Z
2020-10-21T21:29:29.6763079Z error occurred: Command "gcc.exe" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "C:\\Users\\runneradmin\\.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" "D:\\a\\project\\project\\target\\x86_64-pc-windows-gnu\\release\\build\\cloudflare-zlib-sys-3592ede97c492f3c\\out\\crc32-pclmul_asm.o" "-c" "C:\\Users\\runneradmin\\.cargo\\registry\\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).
This error also has an unanswered StackOverflow question about it, so I'd say I'm not the only one experiencing it.
Building with a MSVC toolchain works, but then another dependency of my Rust project fails to compile a component I need for the application to work completely, so switching the toolchain is not a solution for me. Also, I wish I wouldn't need to just drop or degrade Windows compatibility.
I'd appreciate any tips about the cause of this (for me rather cryptic) error and how it can be fixed. Thanks!
Edited by Alejandro González