cross icon indicating copy to clipboard operation
cross copied to clipboard

Failed cross build with Docker built image: aarch64-pc-windows-msvc-cross

Open thoongnv opened this issue 2 years ago • 0 comments

Checklist

Describe your issue

I tried to cross-compile a Windows x64 ARM binary for my tool but failed.

  • I follow https://github.com/cross-rs/cross-toolchains to build an aarch64-pc-windows-msvc-cross:latest image on M M1 Macbook.
  • Then cross build --target aarch64-pc-windows-msvc --verbose

Here is my Cross.toml

[build.env]
passthrough = ["RUST_BACKTRACE=full", "DISPLAY=:1", "CROSS_UNSTABLE_ENABLE_DOCTESTS=false"]

[target.aarch64-pc-windows-msvc]
image = "ghcr.io/thoongnv/aarch64-pc-windows-msvc-cross:latest"

Which produces this error:

+ cargo metadata --format-version 1 --filter-platform aarch64-pc-windows-msvc
+ rustc --print sysroot
+ /usr/local/bin/docker
+ /usr/local/bin/docker version -f '{{ .Server.Os }},,,{{ .Server.Arch }}'
[cross] warning: using newer rustc `1.71.1 (eb26296b5 2023-08-03)` for the target. Current active rustc on the host is `rustc 1.71.0 (8ede3aae2 2023-07-12)`.
 > Update with `rustup update`
+ rustup toolchain list
+ rustup target list --toolchain stable-x86_64-unknown-linux-gnu
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu
+ /usr/local/bin/docker run --userns host --platform linux/amd64 -e 'RUST_BACKTRACE=full' -e 'DISPLAY=:1' -e 'CROSS_UNSTABLE_ENABLE_DOCTESTS=false' -e 'PKG_CONFIG_ALLOW_CROSS=1' -e 'XARGO_HOME=/Users/thoongnv/.xargo' -e 'CARGO_HOME=/Users/thoongnv/.cargo' -e 'CROSS_RUST_SYSROOT=/Users/thoongnv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu' -e 'CARGO_TARGET_DIR=/target' -e 'CROSS_RUNNER=' -e TERM -e 'USER=thoongnv' -e 'CROSS_RUSTC_MAJOR_VERSION=1' -e 'CROSS_RUSTC_MINOR_VERSION=71' -e 'CROSS_RUSTC_PATCH_VERSION=1' --name cross-stable-x86_64-unknown-linux-gnu-a6502-eb26296b5-aarch64-pc-windows-msvc-b55f4-1691732080818 --rm --user 501:20 -v /Users/thoongnv/.xargo:/Users/thoongnv/.xargo:z -v /Users/thoongnv/.cargo:/Users/thoongnv/.cargo:z -v /Users/thoongnv/.cargo/bin  -t ghcr.io/thoongnv/aarch64-pc-windows-msvc-cross:latest sh -c 'PATH="$PATH":"/Users/thoongnv/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin" cargo build --target aarch64-pc-windows-msvc --verbose'
<jemalloc>: MADV_DONTNEED does not work (memset will be used instead)
<jemalloc>: (This is the expected behaviour if you are running under QEMU)
<jemalloc>: MADV_DONTNEED does not work (memset will be used instead)
<jemalloc>: (This is the expected behaviour if you are running under QEMU)
error: failed to run custom build command for `ring v0.16.20`

Caused by:
  process didn't exit successfully: `/target/debug/build/ring-3ed1d41511bbd390/build-script-build` (exit status: 101)
  --- stdout
  OPT_LEVEL = Some("0")
  TARGET = Some("aarch64-pc-windows-msvc")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CC_aarch64-pc-windows-msvc
  CC_aarch64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CC_aarch64_pc_windows_msvc
  CC_aarch64_pc_windows_msvc = Some("cl.exe")
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("neon")
  DEBUG = Some("true")
  cargo:rerun-if-env-changed=CFLAGS_aarch64-pc-windows-msvc
  CFLAGS_aarch64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_pc_windows_msvc
  CFLAGS_aarch64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  montgomery.c
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(191): error C2065: 'BN_ULLONG': undeclared identifier
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(191): error C2146: syntax error: missing ';' before identifier 'result'
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(191): warning C4555: result of expression not used
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(191): error C2065: 'result': undeclared identifier
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(191): error C2065: 'BN_ULLONG': undeclared identifier
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(191): error C2146: syntax error: missing ';' before identifier 'a'
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(191): warning C4552: '*': result of expression not used
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(192): error C2065: 'result': undeclared identifier
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(193): error C2065: 'result': undeclared identifier
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(193): warning C4293: '>>': shift count negative or too big, undefined behavior
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\../../limbs/limbs.inl(38): warning C4163: '_addcarry_u64': not available as an intrinsic function
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\../../limbs/limbs.inl(38): warning C4163: '_subborrow_u64': not available as an intrinsic function
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\../../limbs/limbs.inl(62): warning C4013: '_addcarry_u64' undefined; assuming extern returning int
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\../../limbs/limbs.inl(62): warning C4242: '=': conversion from 'int' to 'Carry', possible loss of data
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\../../limbs/limbs.inl(76): warning C4242: '=': conversion from 'int' to 'Carry', possible loss of data
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\../../limbs/limbs.inl(92): warning C4013: '_subborrow_u64' undefined; assuming extern returning int
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\../../limbs/limbs.inl(92): warning C4242: '=': conversion from 'int' to 'Carry', possible loss of data
  \Users\thoongnv\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\../../limbs/limbs.inl(106): warning C4242: '=': conversion from 'int' to 'Carry', possible loss of data

  --- stderr
  running "cl.exe" "-nologo" "-MD" "-Z7" "-Brepro" "-I" "include" "-W4" "/GS" "/Gy" "/EHsc" "/GR-" "/Zc:wchar_t" "/Zc:forScope" "/Zc:inline" "/Zc:rvalueCast" "/sdl" "/Wall" "/wd4127" "/wd4464" "/wd4514" "/wd4710" "/wd4711" "/wd4820" "/wd5045" "/Od" "/RTCsu" "-DNDEBUG" "-c" "/Fo/target/aarch64-pc-windows-msvc/debug/build/ring-ef805daaf8163db6/out/montgomery.obj" "crypto/fipsmodule/bn/montgomery.c"
  0048:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
  0048:err:winediag:nodrv_CreateWindow Make sure that your X server is running and that $DISPLAY is set correctly.
  0048:err:systray:initialize_systray Could not create tray window
  0024:err:module:relocate_ntdll ntdll could not be mapped at preferred address (0x7f340000), expect trouble
  thread 'main' panicked at 'execution failed', /Users/thoongnv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.16.20/build.rs:656:9
  stack backtrace:
     0:       0x40000b1411 - std::backtrace_rs::backtrace::libunwind::trace::h782cc21a5acaf6cb
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
     1:       0x40000b1411 - std::backtrace_rs::backtrace::trace_unsynchronized::hc579eb24ab204515
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     2:       0x40000b1411 - std::sys_common::backtrace::_print_fmt::h7223525cfdbacda2
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:65:5
     3:       0x40000b1411 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbd7d55b7108d2ab8
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:44:22
     4:       0x40000d44cf - core::fmt::rt::Argument::fmt::hb4f4a02b9bd9dd49
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/fmt/rt.rs:138:9
     5:       0x40000d44cf - core::fmt::write::h6d54cd7c9e155ec5
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/fmt/mod.rs:1094:21
     6:       0x40000ae001 - std::io::Write::write_fmt::h6a453a71c692f63b
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/io/mod.rs:1713:15
     7:       0x40000b1225 - std::sys_common::backtrace::_print::h1cbaa8b42678f928
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:47:5
     8:       0x40000b1225 - std::sys_common::backtrace::print::h4ddf81241a51b337
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:34:9
     9:       0x40000b2f97 - std::panicking::default_hook::{{closure}}::hff91f1f484ade5cd
    10:       0x40000b2d84 - std::panicking::default_hook::h21f14afd59f7aef9
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:288:9
    11:       0x40000b344c - std::panicking::rust_panic_with_hook::h45f66047b14c555c
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:705:13
    12:       0x4000055b54 - std::panicking::begin_panic::{{closure}}::h1e2241c2eeca31cb
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:626:9
    13:       0x400004db1d - std::sys_common::backtrace::__rust_end_short_backtrace::h9988eb3c5d10b715
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:151:18
    14:       0x4000055ac7 - std::panicking::begin_panic::hb1df8cd2ba30a5eb
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:625:12
    15:       0x400001b0fe - build_script_build::run_command::hb80178cd787a5465
                                 at /Users/thoongnv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.16.20/build.rs:656:9
    16:       0x40000199ba - build_script_build::compile::hd0345931dc3c4c11
                                 at /Users/thoongnv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.16.20/build.rs:512:13
    17:       0x4000019458 - build_script_build::build_library::{{closure}}::h3475e8e76a4c70e9
                                 at /Users/thoongnv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.16.20/build.rs:447:18
    18:       0x40000167df - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once::hbaed0055d0eddfc4
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/ops/function.rs:305:13
    19:       0x4000028198 - core::option::Option<T>::map::h3206e0ac37eb5a57
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/option.rs:1075:29
    20:       0x4000028198 - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next::h04249dd0d6c8ebca
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/iter/adapters/map.rs:103:26
    21:       0x4000014f71 - alloc::vec::Vec<T,A>::extend_desugared::h9fd370a6524c49c8
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/alloc/src/vec/mod.rs:2811:35
    22:       0x400001658a - <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend::h9fab10508ee86805
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/alloc/src/vec/spec_extend.rs:17:9
    23:       0x40000132e0 - <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter::h3dd9a3d4be713c38
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/alloc/src/vec/spec_from_iter_nested.rs:43:9
    24:       0x400001662d - <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter::h7395087e7abe8ba6
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/alloc/src/vec/spec_from_iter.rs:33:9
    25:       0x40000164e5 - <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter::hac872d1b9b7185ac
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/alloc/src/vec/mod.rs:2711:9
    26:       0x40000288ed - core::iter::traits::iterator::Iterator::collect::hbdb52b96667a4e5f
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/iter/traits/iterator.rs:1895:9
    27:       0x4000018b89 - build_script_build::build_library::h31b15fb47a19a96d
                                 at /Users/thoongnv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.16.20/build.rs:443:16
    28:       0x40000189a6 - build_script_build::build_c_code::{{closure}}::h12c5bcc0d060162c
                                 at /Users/thoongnv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.16.20/build.rs:416:9
    29:       0x4000024040 - <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::for_each::hcf96984543a59f9d
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/slice/iter/macros.rs:204:21
    30:       0x400001852e - build_script_build::build_c_code::h52257af71ccf7d19
                                 at /Users/thoongnv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.16.20/build.rs:415:5
    31:       0x400001716d - build_script_build::ring_build_rs_main::h587a837d00188278
                                 at /Users/thoongnv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.16.20/build.rs:279:5
    32:       0x400001698d - build_script_build::main::h0b4a9d61c233a840
                                 at /Users/thoongnv/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.16.20/build.rs:240:13
    33:       0x400001e58b - core::ops::function::FnOnce::call_once::h8f78a8704179c65b
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/ops/function.rs:250:5
    34:       0x400001d22e - std::sys_common::backtrace::__rust_begin_short_backtrace::h1599e17d43ecf0ed
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/sys_common/backtrace.rs:135:18
    35:       0x4000020351 - std::rt::lang_start::{{closure}}::hf1372a03881aa110
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/rt.rs:166:18
    36:       0x40000a9c95 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h802b0fdd426a12ca
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/ops/function.rs:284:13
    37:       0x40000a9c95 - std::panicking::try::do_call::h2a2f25050efa0cf8
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:500:40
    38:       0x40000a9c95 - std::panicking::try::h9ca7f841c0f0e3dd
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:464:19
    39:       0x40000a9c95 - std::panic::catch_unwind::h92d42a62587f8121
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panic.rs:142:14
    40:       0x40000a9c95 - std::rt::lang_start_internal::{{closure}}::hf1926c7a173d562c
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/rt.rs:148:48
    41:       0x40000a9c95 - std::panicking::try::do_call::haac70d88f0cce898
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:500:40
    42:       0x40000a9c95 - std::panicking::try::h5c20719e1031e74b
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:464:19
    43:       0x40000a9c95 - std::panic::catch_unwind::h9b15b36860d5fe4a
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panic.rs:142:14
    44:       0x40000a9c95 - std::rt::lang_start_internal::hf502095b101390bb
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/rt.rs:148:20
    45:       0x400002032a - std::rt::lang_start::h4832dff20a454e8b
                                 at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/rt.rs:165:17
    46:       0x400001d21e - main
    47:       0x40019bb083 - __libc_start_main
    48:       0x4000012d5e - _start
    49:                0x0 - <unknown>
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu

I'm not too sure if it is an issue with ring crate or cross tool?

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

other (specify in description)

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

  • [X] macOS
  • [ ] Windows
  • [ ] Linux / BSD
  • [ ] other OS (specify in description)

What architecture is the host?

  • [ ] x86_64 / AMD64
  • [ ] arm32
  • [X] arm64 (including Mac M1)

What container engine is cross using?

  • [X] docker
  • [ ] podman
  • [ ] other container engine (specify in description)

cross version

0.2.5

Example

No response

Additional information / notes

No response

thoongnv avatar Aug 11 '23 05:08 thoongnv