supranational / blst

Multilingual BLS12-381 signature library
Apache License 2.0
467 stars 177 forks source link

Can build a no_asm version of blst under Windows system and x86? #20 #159

Closed prz23 closed 1 year ago

prz23 commented 1 year ago

May I ask if I can compile a no_asm version of blst under Windows system and x86 within rust binding version, by utilizing the environment variable CARGO_CFG_TARGET_ARCH=xx ?

like CARGO_CFG_TARGET_ARCH=xx cargo build --release

According to the description in the build.rs file, when the environment variable CARGO_CFG_TARGET_ARCH is not set to x86_64 or aarch64, it will enable BLST_NO_ASM.

But I’ve seen other https://github.com/supranational/blst/issues/99#issuecomment-1004266957that say it is not unjustified.

dot-asm commented 1 year ago

What's wrong with the usual, a.k.a. the right, way? That is with cargo build --release --target=i686-pc-windows-msvc. There is caveat though. MSVC doesn't actually support specific C9x feature that no_asm.h relies upon:-( For this reason build.rs attempts to call clang-cl instead. Unfortunately cc-rs does not make an attempt to spot one which can be a part of VS installation. This effectively means that it becomes your responsibility to make corresponding version of clang-cl available on your %PATH%. If you install clang as part of VS, then it would be sufficient to open corresponding "Command Prompt." (Just in case for reference, --target=i686-pc-windows-gnu is also a working 32-bit Windows option;-)