cross-rs / cross

“Zero setup” cross compilation and “cross testing” of Rust crates
Apache License 2.0
6.67k stars 372 forks source link

aarch64-unknown-linux-musl build failed due to "CROSS_RUSTC_MINOR_VERSION: unbound variable" error #1046

Closed taiki-e closed 2 years ago

taiki-e commented 2 years ago

Checklist

Describe your issue

https://github.com/cross-rs/cross/commit/9311417f7d251103c21f547aa341e643f08a5fd8 added CROSS_RUSTC_MINOR_VERSION environment variables without fallback, so the current docker image of the main tag is incompatible with the released version of cross (v0.2.4).

log: https://github.com/taiki-e/cargo-llvm-cov/actions/runs/3170903254/jobs/5163844829

error: linking with `aarch64-linux-musl-gcc.sh` failed: exit status: 1
  |
  = note: "aarch64-linux-musl-gcc.sh" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crt1.o" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crti.o" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtbegin.o" "/tmp/rustccsDYy1/symbols.o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.0.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.1.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.10.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.11.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.12.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.13.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.14.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.15.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.2.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.3.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.4.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.5.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.6.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.7.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.8.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.9.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.q87tw5w3o737dn4.rcgu.o" "-Wl,--as-needed" "-L" "/target/aarch64-unknown-linux-musl/debug/deps" "-L" "/target/debug/deps" "-L" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib" "-Wl,-Bstatic" "/target/aarch64-unknown-linux-musl/debug/deps/libhome-526bb05cc71bcba7.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libis_executable-39ca25dacc3fa1fa.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libtempfile-c3263fce946c62d9.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libcfg_if-1b7d285f3d81e020.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libfastrand-1cbba7b0b0855b5f.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libremove_dir_all-0b9c93e1d3dfd0ff.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libopener-c185180046688d9e.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libbstr-541dda558ebf0404.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/liblazy_static-99906f0499806f8b.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libregex_automata-d953caa0b360b120.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libtarget_spec-86600248bebcba2f.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libcfg_expr-881071c2c632b951.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libtarget_lexicon-08478513d0fbf136.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libsmallvec-a7f140f86423e4b2.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libglob-266e693f093e39da.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libduct-5279c5de13086086.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libos_pipe-259bb446a6103eb6.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libshared_child-ce36c3db1fb2c112.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libonce_cell-09636a8b16d78b2a.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libatty-25b3927158d6d467.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/liblibc-d453861d148e17da.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libcargo_llvm_cov-181871d70b41569a.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libfs_err-03b2b82eb1567993.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/librustc_demangle-9b3cfe14fb1ac06b.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libregex-26e7a0fa73c6f1f9.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libaho_corasick-18b7887cd3bf8b2a.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libmemchr-61920d2d5ddc03b9.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libregex_syntax-35ea72f5203101dd.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/liblexopt-6531b773924e905c.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libwalkdir-8dd9225a6474f815.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libsame_file-a3d3064939f14c3b.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libcargo_metadata-34944ac4583bd5ac.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libserde_json-b33cca8c284f0f75.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libryu-b7d3d709740a8278.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libitoa-48121b9bbe88434c.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libcargo_platform-72a5f419d87225ec.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libsemver-c953a6fac00713f3.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libcamino-248d2a670ce8b3eb.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libshell_escape-a1385cb62184ded3.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libtermcolor-f0124fe7f28de17d.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libserde-3998681e68d8d20d.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libanyhow-c5f60935a86477e5.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libstd-3ae4162b56b99b45.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libpanic_unwind-a4369810bdc7f2be.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libobject-0b117a32c717231b.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libmemchr-17a8f52d2d850bcd.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libaddr2line-e2a7f1b36f37d81c.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libgimli-f8d5986e5d530c64.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/librustc_demangle-2d785584450046a9.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libstd_detect-f50f86f9d807afeb.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libcfg_if-62f2b2e53e75f25e.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libhashbrown-0565a767b6a78ae0.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libminiz_oxide-cc09a3dc85d43f3a.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libadler-207e70c4d351f896.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/librustc_std_workspace_alloc-56c928032156d0d5.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libunwind-78363ad52580036a.rlib" "-lunwind" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libcfg_if-11f732516122675d.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/liblibc-fa4c105dce9657a3.rlib" "-lc" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/liballoc-5582ef6c7c12206a.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/librustc_std_workspace_core-a5082d3dd5519aaa.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libcore-00fd02f4bd9d60be.rlib" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libcompiler_builtins-179afdf41052161b.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-nostartfiles" "-L" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib" "-L" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained" "-o" "/target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtend.o" "/rust/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtn.o"
  = note: + set -euo pipefail
          + main /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crt1.o /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crti.o /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtbegin.o /tmp/rustccsDYy1/symbols.o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.0.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.1.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.10.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.11.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.12.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.13.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.14.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.15.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.2.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.3.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.4.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.5.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.6.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.7.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.8.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.cargo_llvm_cov.1f07976c-cgu.9.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0.q87tw5w3o737dn4.rcgu.o -Wl,--as-needed -L /target/aarch64-unknown-linux-musl/debug/deps -L /target/debug/deps -L /rust/lib/rustlib/aarch64-unknown-linux-musl/lib -Wl,-Bstatic /target/aarch64-unknown-linux-musl/debug/deps/libhome-526bb05cc71bcba7.rlib /target/aarch64-unknown-linux-musl/debug/deps/libis_executable-39ca25dacc3fa1fa.rlib /target/aarch64-unknown-linux-musl/debug/deps/libtempfile-c3263fce946c62d9.rlib /target/aarch64-unknown-linux-musl/debug/deps/libcfg_if-1b7d285f3d81e020.rlib /target/aarch64-unknown-linux-musl/debug/deps/libfastrand-1cbba7b0b0855b5f.rlib /target/aarch64-unknown-linux-musl/debug/deps/libremove_dir_all-0b9c93e1d3dfd0ff.rlib /target/aarch64-unknown-linux-musl/debug/deps/libopener-c185180046688d9e.rlib /target/aarch64-unknown-linux-musl/debug/deps/libbstr-541dda558ebf0404.rlib /target/aarch64-unknown-linux-musl/debug/deps/liblazy_static-99906f0499806f8b.rlib /target/aarch64-unknown-linux-musl/debug/deps/libregex_automata-d953caa0b360b120.rlib /target/aarch64-unknown-linux-musl/debug/deps/libtarget_spec-86600248bebcba2f.rlib /target/aarch64-unknown-linux-musl/debug/deps/libcfg_expr-881071c2c632b951.rlib /target/aarch64-unknown-linux-musl/debug/deps/libtarget_lexicon-08478513d0fbf136.rlib /target/aarch64-unknown-linux-musl/debug/deps/libsmallvec-a7f140f86423e4b2.rlib /target/aarch64-unknown-linux-musl/debug/deps/libglob-266e693f093e39da.rlib /target/aarch64-unknown-linux-musl/debug/deps/libduct-5279c5de13086086.rlib /target/aarch64-unknown-linux-musl/debug/deps/libos_pipe-259bb446a6103eb6.rlib /target/aarch64-unknown-linux-musl/debug/deps/libshared_child-ce36c3db1fb2c112.rlib /target/aarch64-unknown-linux-musl/debug/deps/libonce_cell-09636a8b16d78b2a.rlib /target/aarch64-unknown-linux-musl/debug/deps/libatty-25b3927158d6d467.rlib /target/aarch64-unknown-linux-musl/debug/deps/liblibc-d453861d148e17da.rlib /target/aarch64-unknown-linux-musl/debug/deps/libcargo_llvm_cov-181871d70b41569a.rlib /target/aarch64-unknown-linux-musl/debug/deps/libfs_err-03b2b82eb1567993.rlib /target/aarch64-unknown-linux-musl/debug/deps/librustc_demangle-9b3cfe14fb1ac06b.rlib /target/aarch64-unknown-linux-musl/debug/deps/libregex-26e7a0fa73c6f1f9.rlib /target/aarch64-unknown-linux-musl/debug/deps/libaho_corasick-18b7887cd3bf8b2a.rlib /target/aarch64-unknown-linux-musl/debug/deps/libmemchr-61920d2d5ddc03b9.rlib /target/aarch64-unknown-linux-musl/debug/deps/libregex_syntax-35ea72f5203101dd.rlib /target/aarch64-unknown-linux-musl/debug/deps/liblexopt-6531b773924e905c.rlib /target/aarch64-unknown-linux-musl/debug/deps/libwalkdir-8dd9225a6474f815.rlib /target/aarch64-unknown-linux-musl/debug/deps/libsame_file-a3d3064939f14c3b.rlib /target/aarch64-unknown-linux-musl/debug/deps/libcargo_metadata-34944ac4583bd5ac.rlib /target/aarch64-unknown-linux-musl/debug/deps/libserde_json-b33cca8c284f0f75.rlib /target/aarch64-unknown-linux-musl/debug/deps/libryu-b7d3d709740a8278.rlib /target/aarch64-unknown-linux-musl/debug/deps/libitoa-48121b9bbe88434c.rlib /target/aarch64-unknown-linux-musl/debug/deps/libcargo_platform-72a5f419d87225ec.rlib /target/aarch64-unknown-linux-musl/debug/deps/libsemver-c953a6fac00713f3.rlib /target/aarch64-unknown-linux-musl/debug/deps/libcamino-248d2a670ce8b3eb.rlib /target/aarch64-unknown-linux-musl/debug/deps/libshell_escape-a1385cb62184ded3.rlib /target/aarch64-unknown-linux-musl/debug/deps/libtermcolor-f0124fe7f28de17d.rlib /target/aarch64-unknown-linux-musl/debug/deps/libserde-3998681e68d8d20d.rlib /target/aarch64-unknown-linux-musl/debug/deps/libanyhow-c5f60935a86477e5.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libstd-3ae4162b56b99b45.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libpanic_unwind-a4369810bdc7f2be.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libobject-0b117a32c717231b.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libmemchr-17a8f52d2d850bcd.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libaddr2line-e2a7f1b36f37d81c.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libgimli-f8d5986e5d530c64.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/librustc_demangle-2d785584450046a9.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libstd_detect-f50f86f9d807afeb.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libcfg_if-62f2b2e53e75f25e.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libhashbrown-0565a767b6a78ae0.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libminiz_oxide-cc09a3dc85d43f3a.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libadler-207e70c4d351f896.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/librustc_std_workspace_alloc-56c928032156d0d5.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libunwind-78363ad52580036a.rlib -lunwind /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libcfg_if-11f732516122675d.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/liblibc-fa4c105dce9657a3.rlib -lc /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/liballoc-5582ef6c7c12206a.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/librustc_std_workspace_core-a5082d3dd5519aaa.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libcore-00fd02f4bd9d60be.rlib /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/libcompiler_builtins-179afdf41052161b.rlib -Wl,-Bdynamic -Wl,--eh-frame-hdr -Wl,-znoexecstack -nostartfiles -L /rust/lib/rustlib/aarch64-unknown-linux-musl/lib -L /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained -o /target/aarch64-unknown-linux-musl/debug/deps/cargo_llvm_cov-6a0ef154327269f0 -Wl,--gc-sections -static -no-pie -Wl,-zrelro,-znow -nodefaultlibs /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtend.o /rust/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtn.o
          + ((  CROSS_RUSTC_MINOR_VERSION >= 48  ))
          /usr/bin/aarch64-linux-musl-gcc.sh: line 11: CROSS_RUSTC_MINOR_VERSION: unbound variable

The underlying problem seems to be that cross uses by default main tag that may be incompatible with the current version. Using the tag that matches the version (0.2.4 in this case) seems to work around the problem.

What target(s) are you cross-compiling for?

aarch64-unknown-linux-musl

Which operating system is the host (e.g computer cross is on) running?

What architecture is the host?

What container engine is cross using?

cross version

cross 0.2.4 (4645d93 2022-07-10)

Example

git clone https://github.com/taiki-e/cargo-llvm-cov
cd cargo-llvm-cov
cross build --target aarch64-unknown-linux-musl

Probably this can also be reproduced with a crate created with cargo new --bin instead of cargo-llvm-cov.

Additional information / notes

No response

taiki-e commented 2 years ago

The underlying problem seems to be that cross uses by default main tag that may be incompatible with the current version. Using the tag that matches the version (0.2.4 in this case) seems to work around the problem.

Fixing the underlying problem (i.e., using an image known to be compatible with the current version by default) will avoid similar breakage in the future, but will not fix the problem occurring in the current release. In any case, it seems that aarch64-linux-musl-gcc.sh needs to handle the case where the CROSS_RUSTC_MINOR_VERSION environment variable is not present. Something like the following:

if [[ -z "${CROSS_RUSTC_MINOR_VERSION:-}" ]]; then
    CROSS_RUSTC_MINOR_VERSION=$(rustc -Vv | grep '^release:' | cut -d ':' -f2 | cut -d '.' -f2)
fi
Alexhuszagh commented 2 years ago

In summary, there's 2 issues here:

  1. bininstall and installing from tarball assumes main is the correct tag, while cargo install cross uses 0.2.4. This means we've had breaking changes released to users thinking they had a non-breaking release.
  2. We've made a pretty big, backwards incompatible change with #1028, and should probably provide a fallback for the meantime.

This was changed in #1028. cross should only use the main tag if installed from git, otherwise it should use the 0.2.4 tag (or whatever version was installed). But maybe we should provide a fallback since this will likely affect a few people. We can always use our Rust version detection if the variable isn't present, and then remove that with the 0.3.0 release.

There is, however, another issue if the released cross version isn't using a released tag, since we've made numerous backwards incompatible changes since then. This seems to be an issue specifically with using bininstall or installing cross from a pre-built binary. Normally, using cargo install cross and cross --version shouldn't have the hash or the release date, and therefore should use the $image:0.2.4 tag. However, those binaries as I've checked do have the commit hash and release date, and they're from the same commit as the actual release.

@Emilgardis know how to fix the pre-built binaries? We should provide a fallback for the time being and also likely release 0.2.5 for the pre-compiled binaries.

Alexhuszagh commented 2 years ago

I can provide a quick fallback (similar to what we did in #1028) but we also have a much larger issue here as well: that we've also been making backwards-incompatible changes to our images which are used by an incompatible version of cross installed from a pre-compiled binary.

This also affects a few MIPS targets and an ARMv5TE target.

NobodyXu commented 2 years ago

The same error also happened in cargo-binstall https://github.com/cargo-bins/cargo-binstall/actions/runs/3170447340/jobs/5164006948

Alexhuszagh commented 2 years ago

The same error also happened in cargo-binstall https://github.com/cargo-bins/cargo-binstall/actions/runs/3170447340/jobs/5164006948

Yep this is an issue when cross is installed but not built from source from crates.io, IE, when not using cargo install cross. Download the binary from a tarball or using bininstall (or using any that installs a binary via bininstall, such as install-action [correct me if I'm wrong on that one]) will produce the above error. cross only uses the version release tag and not main when using cargo install cross. To fix this, we need 2 steps:

  1. A stopgap patch until we can get a broader fix.
  2. Fix our released tarballs that are used by bininstall (I have no idea how complex this will be).
NobodyXu commented 2 years ago

Download the binary from a tarball or using bininstall (or using any that installs a binary via bininstall, such as install-action [correct me if I'm wrong on that one])

I think you mean binstall or cargo-binstall right? There's bininstall but I think that is a typo.

Fix our released tarballs that are used by bininstall (I have no idea how complex this will be).

For cargo-binstall, IMO release a new minor version v0.2.5 will surely fix the bug. Replacing the existing v0.2.4 artifacts would work but doesn't sound like a good approach to this.

Emilgardis commented 2 years ago

This should be solvable by removing .git before compiling. We should maybe revert the env var change, republish 0.2.4 (and maybe a 0.2.5 ?) to then introduce it again

the 0.2.4 changes can be done manually

taiki-e commented 2 years ago

any that installs a binary via bininstall, such as install-action [correct me if I'm wrong on that one]

For cross, install-action downloads a tarball from the GitHub release of this repo directly, not via a third-party tool.

Emilgardis commented 2 years ago

I've created https://github.com/cross-rs/cross/tree/v0.2.4-fix from which we can grab the artifacts and replace

canceled the run for now to let ci build #1047

Emilgardis commented 2 years ago

The backwards incompability has been fixed now, remaining task now is to fix the 0.2.4 binaries on the release

Emilgardis commented 2 years ago

I have updated the binaries on the release.

https://github.com/cross-rs/cross/releases/tag/v0.2.4

This should now be resolved

taiki-e commented 2 years ago

I've confirmed that it has been fixed in my use cases. Thanks for the swift fix!