Skip to content

Unable to build for aarch64-pc-windows-msvc target with ring 0.17.5 dependency #76

Closed

Description

@ancwrd1

As far as I understand ring 0.17 supports aarch64-cp-windows-msvc target, however when trying to build it with xwin I get the following error:

error: failed to run custom build command for `ring v0.17.5`

Caused by:
  process didn't exit successfully: `/tmp/test-ring/target/debug/build/ring-2031b15c66896d66/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=RING_PREGENERATE_ASM
  cargo:rustc-env=RING_CORE_PREFIX=ring_core_0_17_5_
  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("clang-cl")
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("crt-static,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 = Some("--target=aarch64-pc-windows-msvc -Wno-unused-command-line-argument -fuse-ld=lld-link /imsvc/home/user/.cache/cargo-xwin/xwin/crt/include /imsvc/home/user/.cache/cargo-xwin/xwin/sdk/include/ucrt /imsvc/home/user/.cache/cargo-xwin/xwin/sdk/include/um /imsvc/home/user/.cache/cargo-xwin/xwin/sdk/include/shared  ")

  --- stderr
  running "clang" "-O0" "--target=aarch64-pc-windows-msvc" "-ffunction-sections" "-fdata-sections" "-g" "-fno-omit-frame-pointer" "--target=aarch64-pc-windows-msvc" "--target=aarch64-pc-windows-msvc" "-Wno-unused-command-line-argument" "-fuse-ld=lld-link" "/imsvc/home/user/.cache/cargo-xwin/xwin/crt/include" "/imsvc/home/user/.cache/cargo-xwin/xwin/sdk/include/ucrt" "/imsvc/home/user/.cache/cargo-xwin/xwin/sdk/include/um" "/imsvc/home/user/.cache/cargo-xwin/xwin/sdk/include/shared" "-I" "include" "-I" "/tmp/test-ring/target/aarch64-pc-windows-msvc/debug/build/ring-8705dbada3a9c548/out" "-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" "-DNDEBUG" "-c" "-o/tmp/test-ring/target/aarch64-pc-windows-msvc/debug/build/ring-8705dbada3a9c548/out/aesv8-armx-win64.o" "/home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.17.5/pregenerated/aesv8-armx-win64.S"
  clang: error: no such file or directory: '/imsvc/home/user/.cache/cargo-xwin/xwin/crt/include'
  clang: error: no such file or directory: '/imsvc/home/user/.cache/cargo-xwin/xwin/sdk/include/ucrt'
  clang: error: no such file or directory: '/imsvc/home/user/.cache/cargo-xwin/xwin/sdk/include/um'
  clang: error: no such file or directory: '/imsvc/home/user/.cache/cargo-xwin/xwin/sdk/include/shared'
  thread 'main' panicked at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ring-0.17.5/build.rs:676:9:
  execution failed
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Activity

  1. messense commented on Oct 31, 2023

    @messense
    Member

    Looks like /home/user/.cache/cargo-xwin/xwin/ directory has been deleted by something.

  2. messense commented on Oct 31, 2023

    @messense
    Member

    Anyway, can you try delete the whole /home/user/.cache/cargo-xwin directory and re-run? I suspect it might have something to do with #74.

  3. ancwrd1 commented on Oct 31, 2023

    @ancwrd1
    Author

    Tried cleaning it up but without much success. If I look at the command line output:

    ...
    running "clang" "-O3" "--target=aarch64-pc-windows-msvc"
    ...
    "/imsvc/home/dmitry/.cache/cargo-xwin/xwin/sdk/include/ucrt"
    

    It seems that there is a mix of gnu-style and msvc-style arguments which is probably a cause of the issue because the leading slash is not recognized as an option.

  4. ancwrd1 commented on Oct 31, 2023

    @ancwrd1
    Author

    Simple to reproduce:

    cargo init test-ring
    cd test-ring
    cargo add ring
    cargo xwin build --target aarch64-pc-windows-msvc
    
  5. messense commented on Oct 31, 2023

    @messense
    Member

    https://github.com/briansmith/ring/blob/a9b88826e7826a6f9422680fb6240f75511cf2c7/build.rs#L580

    I'm not sure what we can do here, ring forces clang instead of supporting both clang and clang-cl.

    cargo-xwin/src/common.rs

    Lines 149 to 152 in e851cd5

    cmd.env("TARGET_CC", "clang-cl");
    cmd.env("TARGET_CXX", "clang-cl");
    cmd.env(format!("CC_{}", env_target), "clang-cl");
    cmd.env(format!("CXX_{}", env_target), "clang-cl");

  6. ancwrd1 commented on Oct 31, 2023

    @ancwrd1
    Author

    But then I am wondering why does it work for x86_64?

  7. ancwrd1 commented on Oct 31, 2023

    @ancwrd1
    Author

    Ah, sorry, I see the code in the ring specifically for AARCH64...

  8. added a commit that references this issue on Dec 9, 2024
  9. messense commented on Dec 21, 2024

    @messense
    Member

    This has been fixed in v0.18.0 with the new clang cross compiler support.

    cargo init test-ring
    cd test-ring
    cargo add ring
    cargo xwin build --target aarch64-pc-windows-msvc --cross-compiler clang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions