briansmith / ring

Safe, fast, small crypto using Rust
Other
3.64k stars 682 forks source link

`aarch64-pc-windows-msvc` requires `clang` #2117

Open Jasper-Bekkers opened 1 week ago

Jasper-Bekkers commented 1 week ago

Right now, as documented in BUILDING.md this library requires clang in the path for this -msvc target which of course is quite unexpected.

This leads to a rather frustrating experience using this library: all crates using ring will exhibit downstream compilation errors, which goes counter to what's in the readme:

Particular attention is being paid to making it easy to build and integrate ring into applications and higher-level frameworks

I would suggest to provide pre-built binaries for this target alongside the x86 & x64_86 targets (though I have no idea how this would impact the size of the final .crate), or to make code build from source on -msvc targets (I expect this to be significantly more difficult).

briansmith commented 1 week ago

It would be great if somebody could submit a PR.

Jasper-Bekkers commented 1 week ago

It would be great if somebody could submit a PR.

I find the build setup for this crate quite convoluted to figure out from source (it needs perl & python in addition to Rust it seems)? If you have some pointers on where to look roughly I can try to take a stab at it. Even if it's just a dump of filenames & function calls to take a look at, it would help.

briansmith commented 1 week ago

I find the build setup for this crate quite convoluted to figure out from source (it needs perl & python in addition to Rust it seems)? If you have some pointers on where to look roughly I can try to take a stab at it. Even if it's just a dump of filenames & function calls to take a look at, it would help.

When working on this crate from a Git checkout on Windows, I find it works best to work in a "Git Bash" or "MinGW" prompt. Then it needs nasm too. mk/install-build-tools.ps1 contains the git checkout that will give you the same nasm that is used in ring's CI (and BoringSSL's, incidentally).

I don't know what BoringSSL does for Aarch64 Windows. I would look into what its build system is doing.

build.rs is convoluted because of the pregeneration facility. Look at mk/package.sh to see how pregeneration before publishing is done. See also https://github.com/briansmith/ring/issues/1460#issuecomment-1830305112 and https://github.com/briansmith/ring/issues/1460#issuecomment-1830416384.

IIRC, the main reasons we require clang boiled down to: