Closed Rigidity closed 1 year ago
The Rust crate
blst
does not compile when using MSVC as the compiler.
This is a bit misleading, as the problem is not as general. It doesn't work specifically with 32-bit MSVC as the compiler.
If you have to build for 32-bit Windows (why?), add clang in the Visual Studio installer and execute cargo at x86 Tools Command Prompt. For reference, the prompt gives you 32-bit clang-cl on your %PATH%
. This, 32-bit clang-cl on %PATH%
, can be achieved by any other means.
I'm just trying to cargo run
some code using BLS locally, not build an executable for 32 bit Windows. I'm on a 64 bit machine (Ryzen 5600X).
I'm using PowerShell inside of VSCode, which is a pretty typical development environment. Not sure why the shell I'm using plays any role in whether or not blst will compile?
I'm just trying to
cargo run
Then your Rust installation is configured with i686-pc-windows-msvc
as default target, instead of apparently expected x86_64-pc-windows-msvc
. I naturally don't know how you installed and configured Rust on your computer, but you have the keyword now. Either ensure that x86_64 is the default, or pass --target=x86_64-pc-windows-msvc
on cargo command line :-)
Weird, I'm on a 64-bit version of the OS on 64-bit hardware, so I'm really not sure why it decided to default to i686. Setting the target did indeed work.
Thanks for the help.
The Rust crate
blst
does not compile when using MSVC as the compiler.I'm not a C developer, but I did a little digging to figure out the root cause, and it appears that
__STDC_VERSION__
was not defined. Following suggestions in the similar issue #103, I tried addingCFLAGS=/std:c11
, but I got the same error.I tried preprocessing a C file with these variables using C11 and it output the other condition that can cause the
no_asm
file to error, which is__STDC_NO_VLA__
being set to 1.Apparently MSVC does not support Variable Length Arrays, which appears to be an optional extension. I did some research and it seems that they are generally not recommended for a variety of reasons, e.g. security, performance, and portability.
I'm using Windows 11 with Visual Studio 2022.