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

blst fails to build in Windows on ARM device #190

Closed
jdjaustin opened this issue Sep 19, 2023 · 4 comments
Closed

blst fails to build in Windows on ARM device #190

jdjaustin opened this issue Sep 19, 2023 · 4 comments

Comments

@jdjaustin
Copy link

blst fails to build in Windows on an ARM device. Outuput of cargo build:

error: failed to run custom build command for `blst v0.3.11`

Caused by:
  process didn't exit successfully: `C:\Users\jdjaustin\forest\target\debug\build\blst-f29fbab6336519c1\build-script-build` (exit code: 1)
  --- stdout
  cargo:rustc-cfg=feature="std"
  cargo:rerun-if-env-changed=BLST_TEST_NO_STD
  Using blst source directory C:\Users\jdjaustin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\blst-0.3.11\blst
  cargo:rerun-if-changed=C:\Users\jdjaustin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\blst-0.3.11\blst\src
  cargo:rerun-if-changed=C:\Users\jdjaustin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\blst-0.3.11\blst\build
  Compiling in portable mode without ISA extensions
  TARGET = Some("aarch64-pc-windows-msvc")
  OPT_LEVEL = Some("0")
  HOST = Some("aarch64-pc-windows-msvc")
  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 = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("neon")
  DEBUG = Some("false")
  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=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  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 = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("neon")
  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=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  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 = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("neon")
  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=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  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 = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("neon")
  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=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  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 = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some("neon")
  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=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  running: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.37.32822\\bin\\HostX86\\arm64\\cl.exe" "-nologo" "-MD" "-Brepro" "-W4" "-Zl" "-D__BLST_PORTABLE__" "-FoC:\\Users\\jdjaustin\\forest\\target\\debug\\build\\blst-8486b4075c81c52a\\out\\1caae8e62ff2fb2f-server.o" "-c" "C:\\Users\\jdjaustin\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\blst-0.3.11\\blst\\src\\server.c"
  cargo:warning=The MSVC ARM assemblers do not support -D flags
  server.c
  C:\Users\jdjaustin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\blst-0.3.11\blst\src\vect.h(316): warning C4210: nonstandard extension used: function given file scope
  C:\Users\jdjaustin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\blst-0.3.11\blst\src\vect.h(337): warning C4210: nonstandard extension used: function given file scope
  running: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.37.32822\\bin\\HostX86\\arm64\\armasm64.exe" "-nologo" "-Zl" "-o" "C:\\Users\\jdjaustin\\forest\\target\\debug\\build\\blst-8486b4075c81c52a\\out\\7069ddadbcadb9b6-add_mod_256-armv8.o" "C:\\Users\\jdjaustin\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\blst-0.3.11\\blst\\build\\win64\\add_mod_256-armv8.asm"
  cargo:warning=The MSVC ARM assemblers do not support -D flags
  error A2029: unknown command-line argument or argument value -Zl


   Usage:      armasm [<options>] sourcefile objectfile
               armasm [<options>] -o objectfile sourcefile
               armasm -h              for help

  error A2029: unknown command-line argument or argument value -Zl

   Usage:      armasm [<options>] sourcefile objectfile
               armasm [<options>] -o objectfile sourcefile
               armasm -h              for help


  exit code: 1
  cargo:warning=ToolExecError: Command "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.37.32822\\bin\\HostX86\\arm64\\armasm64.exe" "-nologo" "-Zl" "-o" "C:\\Users\\jdjaustin\\forest\\target\\debug\\build\\blst-8486b4075c81c52a\\out\\7069ddadbcadb9b6-mul_mont_384-armv8.o" "C:\\Users\\jdjaustin\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\blst-0.3.11\\blst\\build\\win64\\mul_mont_384-armv8.asm" with args "armasm64.exe" did not execute successfully (status code exit code: 1).
  exit code: 1
  cargo:warning=ToolExecError: Command "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.37.32822\\bin\\HostX86\\arm64\\armasm64.exe" "-nologo" "-Zl" "-o" "C:\\Users\\jdjaustin\\forest\\target\\debug\\build\\blst-8486b4075c81c52a\\out\\7069ddadbcadb9b6-sha256-armv8.o" "C:\\Users\\jdjaustin\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\blst-0.3.11\\blst\\build\\win64\\sha256-armv8.asm" with args "armasm64.exe" did not execute successfully (status code exit code: 1).

  --- stderr


  error occurred: Command "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.37.32822\\bin\\HostX86\\arm64\\armasm64.exe" "-nologo" "-Zl" "-o" "C:\\Users\\jdjaustin\\forest\\target\\debug\\build\\blst-8486b4075c81c52a\\out\\7069ddadbcadb9b6-sha256-armv8.o" "C:\\Users\\jdjaustin\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\blst-0.3.11\\blst\\build\\win64\\sha256-armv8.asm" with args "armasm64.exe" did not execute successfully (status code exit code: 1).


[Finished running. Exit status: 0]
@dot-asm
Copy link
Collaborator

dot-asm commented Sep 20, 2023

Oh! The first aarch64-pc-windows-msvc user! Ever! :-)

Specifically the referred failure is arguably a cc-rs bug, fix is proposed in rust-lang/cc-rs#867. However, even if it's resolved, as it turns out, there will be more errors from armasm64. Yes, it means that build/win64/*-armv8.asm weren't actually tested as they are. Naturally because we never had access to a Windows on ARM system. Either way, src/asm/arm-xlate.pl needs more work, but meanwhile could you take #191 for a spin on your system? You would need to add clang to your VS installation, VS Installer provides the option, and make the clang command available on your %PATH% one way or another. By explicitly modifying your %PATH% or invoking cargo in the "Developer Command Prompt for VS." Yeah, inconvenient, but please bear with me...

@dot-asm
Copy link
Collaborator

dot-asm commented Sep 23, 2023

The rust-lang/cc-rs#867 was merged, but it turned out that further adjustments are required, rust-lang/cc-rs#869. But I've fixed up arm-xlate.pl to make assembly work with ARM assembler, so that clang is no longer required. To use blst till updated blst and cc-rs crates are published create .cargo/config.toml in your project or home directory:

[patch.crates-io]
blst = { git = "https://github.com/supranational/blst" }
cc = { git = "https://github.com/rust-lang/cc-rs" }

@dot-asm
Copy link
Collaborator

dot-asm commented Nov 2, 2023

This is resolved to the extent of Windows on ARM build being exercised on Github Actions.

@dot-asm dot-asm closed this as completed Nov 2, 2023
@dot-asm
Copy link
Collaborator

dot-asm commented Nov 2, 2023

Oh! And thanks for the report!

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

No branches or pull requests

2 participants