Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ancwrd1 opened this issue Oct 30, 2023 · 7 comments · Fixed by #111
Open

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

ancwrd1 opened this issue Oct 30, 2023 · 7 comments · Fixed by #111

Comments

@ancwrd1
Copy link

ancwrd1 commented Oct 30, 2023

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
@messense
Copy link
Member

messense commented Oct 31, 2023

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

@messense
Copy link
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.

@ancwrd1
Copy link
Author

ancwrd1 commented Oct 31, 2023

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.

@ancwrd1
Copy link
Author

ancwrd1 commented Oct 31, 2023

Simple to reproduce:

cargo init test-ring
cd test-ring
cargo add ring
cargo xwin build --target aarch64-pc-windows-msvc

@messense
Copy link
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");

@ancwrd1
Copy link
Author

ancwrd1 commented Oct 31, 2023

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

@ancwrd1
Copy link
Author

ancwrd1 commented Oct 31, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants