Skip to content

Commit

Permalink
zstd-sys: Don't use target* cfg in build.rs to fix Windows cross-…
Browse files Browse the repository at this point in the history
…compile (#176)

This issue got exposed with [CC upgrading to 1.0.77] and now detecting
the `.S` file extension to pass on to `ml64.exe` (MASM) on Windows;
we don't have that on our cross-compiling (from Linux to Windows) CI
setup, hence uncovered that this build script was using the _`target_os`
flag from the host_ in the build script to make a decision on _what to
compile for the target_.

[CC upgrading to 1.0.77]: rust-lang/cc-rs@1.0.76...1.0.77
  • Loading branch information
MarijnS95 committed Nov 22, 2022
1 parent 5bca33c commit f9ece88
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion zstd-safe/zstd-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fn compile_zstd() {

// Either include ASM files, or disable ASM entirely.
// Also disable it on windows, apparently it doesn't do well with these .S files at the moment.
if cfg!(any(target_os = "windows", feature = "no_asm")) {
if cfg!(feature = "no_asm") || std::env::var("CARGO_CFG_WINDOWS").is_ok() {
config.define("ZSTD_DISABLE_ASM", Some(""));
} else {
config.file("zstd/lib/decompress/huf_decompress_amd64.S");
Expand Down

0 comments on commit f9ece88

Please sign in to comment.