CC 1.0.84 fails with `UnknownOperatingSystem`
aig787 opened this issue · 2 comments
aig787 commented
It looks like the newly released cc 1.0.84 crate breaks cross compilation. It's happening to me with a number of crates, but it's reproducible with https://github.com/briansmith/ring.
Running cargo build
works on a fresh clone (which pulls in 1.0.84
), but running zigbuild with a target specified (tested with aarch64-unknown-linux-musl, x86_64-unknown-linux-musl, and aarch64-unknown-linux-gnu) results in
❯ cargo zigbuild --target aarch64-unknown-linux-musl
Compiling libc v0.2.150
Compiling cfg-if v1.0.0
Compiling spin v0.9.8
Compiling untrusted v0.9.0
Compiling cc v1.0.84
Compiling getrandom v0.2.11
Compiling ring v0.17.5 (/Users/aarongriffin/Code/ring)
The following warnings were emitted during compilation:
warning: error: UnknownOperatingSystem
error: failed to run custom build command for `ring v0.17.5 (/Users/aarongriffin/Code/ring)`
Caused by:
process didn't exit successfully: `/Users/aarongriffin/Code/ring/target/debug/build/ring-e1e6a838598b6bb8/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=RING_PREGENERATE_ASM
cargo:rustc-env=RING_CORE_PREFIX=ring_core_0_17_5_
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
cargo:rerun-if-env-changed=PERL_EXECUTABLE
OPT_LEVEL = Some("0")
TARGET = Some("aarch64-unknown-linux-musl")
HOST = Some("aarch64-apple-darwin")
cargo:rerun-if-env-changed=CC_aarch64-unknown-linux-musl
CC_aarch64-unknown-linux-musl = None
cargo:rerun-if-env-changed=CC_aarch64_unknown_linux_musl
CC_aarch64_unknown_linux_musl = Some("/Users/aarongriffin/Library/Caches/cargo-zigbuild/0.17.4/zigcc-aarch64-unknown-linux-musl.sh")
running: "/Users/aarongriffin/Library/Caches/cargo-zigbuild/0.17.4/zigcc-aarch64-unknown-linux-musl.sh" "--version"
exit status: 0
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
cargo:rerun-if-env-changed=CFLAGS_aarch64-unknown-linux-musl
CFLAGS_aarch64-unknown-linux-musl = None
cargo:rerun-if-env-changed=CFLAGS_aarch64_unknown_linux_musl
CFLAGS_aarch64_unknown_linux_musl = None
cargo:rerun-if-env-changed=TARGET_CFLAGS
TARGET_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
running: "/Users/aarongriffin/Library/Caches/cargo-zigbuild/0.17.4/zigcc-aarch64-unknown-linux-musl.sh" "--version"
exit status: 0
running: "/Users/aarongriffin/Library/Caches/cargo-zigbuild/0.17.4/zigcc-aarch64-unknown-linux-musl.sh" "--version"
exit status: 0
running: "/Users/aarongriffin/Library/Caches/cargo-zigbuild/0.17.4/zigcc-aarch64-unknown-linux-musl.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=aarch64-unknown-linux-musl" "-I" "include" "-I" "/Users/aarongriffin/Code/ring/target/aarch64-unknown-linux-musl/debug/build/ring-86be1ac4566a40e8/out" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-g3" "-nostdlibinc" "-DRING_CORE_NOSTDLIBINC=1" "-Werror" "-o" "/Users/aarongriffin/Code/ring/target/aarch64-unknown-linux-musl/debug/build/ring-86be1ac4566a40e8/out/crypto/curve25519/curve25519.o" "-c" "crypto/curve25519/curve25519.c"
cargo:warning=error: UnknownOperatingSystem
exit status: 1
--- stderr
running "perl" "crypto/fipsmodule/aes/asm/aesv8-armx.pl" "linux64" "/Users/aarongriffin/Code/ring/target/aarch64-unknown-linux-musl/debug/build/ring-86be1ac4566a40e8/out/aesv8-armx-linux64.S"
running "perl" "crypto/fipsmodule/modes/asm/ghashv8-armx.pl" "linux64" "/Users/aarongriffin/Code/ring/target/aarch64-unknown-linux-musl/debug/build/ring-86be1ac4566a40e8/out/ghashv8-armx-linux64.S"
running "perl" "crypto/chacha/asm/chacha-armv8.pl" "linux64" "/Users/aarongriffin/Code/ring/target/aarch64-unknown-linux-musl/debug/build/ring-86be1ac4566a40e8/out/chacha-armv8-linux64.S"
running "perl" "crypto/cipher_extra/asm/chacha20_poly1305_armv8.pl" "linux64" "/Users/aarongriffin/Code/ring/target/aarch64-unknown-linux-musl/debug/build/ring-86be1ac4566a40e8/out/chacha20_poly1305_armv8-linux64.S"
running "perl" "crypto/fipsmodule/aes/asm/vpaes-armv8.pl" "linux64" "/Users/aarongriffin/Code/ring/target/aarch64-unknown-linux-musl/debug/build/ring-86be1ac4566a40e8/out/vpaes-armv8-linux64.S"
running "perl" "crypto/fipsmodule/bn/asm/armv8-mont.pl" "linux64" "/Users/aarongriffin/Code/ring/target/aarch64-unknown-linux-musl/debug/build/ring-86be1ac4566a40e8/out/armv8-mont-linux64.S"
running "perl" "crypto/fipsmodule/ec/asm/p256-armv8-asm.pl" "linux64" "/Users/aarongriffin/Code/ring/target/aarch64-unknown-linux-musl/debug/build/ring-86be1ac4566a40e8/out/p256-armv8-asm-linux64.S"
running "perl" "crypto/fipsmodule/modes/asm/ghash-neon-armv8.pl" "linux64" "/Users/aarongriffin/Code/ring/target/aarch64-unknown-linux-musl/debug/build/ring-86be1ac4566a40e8/out/ghash-neon-armv8-linux64.S"
running "perl" "crypto/fipsmodule/sha/asm/sha512-armv8.pl" "linux64" "/Users/aarongriffin/Code/ring/target/aarch64-unknown-linux-musl/debug/build/ring-86be1ac4566a40e8/out/sha512-armv8-linux64.S"
running "perl" "crypto/fipsmodule/sha/asm/sha512-armv8.pl" "linux64" "/Users/aarongriffin/Code/ring/target/aarch64-unknown-linux-musl/debug/build/ring-86be1ac4566a40e8/out/sha256-armv8-linux64.S"
error occurred: Command "/Users/aarongriffin/Library/Caches/cargo-zigbuild/0.17.4/zigcc-aarch64-unknown-linux-musl.sh" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "--target=aarch64-unknown-linux-musl" "-I" "include" "-I" "/Users/aarongriffin/Code/ring/target/aarch64-unknown-linux-musl/debug/build/ring-86be1ac4566a40e8/out" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-pedantic" "-Wall" "-Wextra" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-g3" "-nostdlibinc" "-DRING_CORE_NOSTDLIBINC=1" "-Werror" "-o" "/Users/aarongriffin/Code/ring/target/aarch64-unknown-linux-musl/debug/build/ring-86be1ac4566a40e8/out/crypto/curve25519/curve25519.o" "-c" "crypto/curve25519/curve25519.c" with args "zigcc-aarch64-unknown-linux-musl.sh" did not execute successfully (status code exit status: 1).
If I pin =1.0.83
, all targets compile without issues again.
❯ cargo zigbuild --target x86_64-unknown-linux-musl
Compiling libc v0.2.150
Compiling cfg-if v1.0.0
Compiling spin v0.9.8
Compiling untrusted v0.9.0
Compiling cc v1.0.83
Compiling getrandom v0.2.11
Compiling ring v0.17.5 (/Users/aarongriffin/Code/ring)
Finished dev [unoptimized + debuginfo] target(s) in 11.44s
rtyler commented
I am also seeing this for what it's worth with cargo-lambda, linked the issue ☝️
NobodyXu commented
Can you print the output from build.rs with cc v1.0.83, I think it's probably because of the different compiler detection and compiler flags that caused this?