fix: support compiling on Windows ARM64#298
Open
filipw wants to merge 1 commit intoopen-quantum-safe:mainfrom
Open
fix: support compiling on Windows ARM64#298filipw wants to merge 1 commit intoopen-quantum-safe:mainfrom
filipw wants to merge 1 commit intoopen-quantum-safe:mainfrom
Conversation
`libc::c_char` in Rust differs by target architecture: - On most platforms (x86-64 Windows, Linux, macOS) it is `i8`. - On Windows ARM64 (AArch64) it is `u8`. This change unconditionally casts pointers with `as *const _`: - On Windows ARM64, this converts `*const i8` to `*const u8` (or vice versa), resolving the type mismatch that caused compilation to fail. - On other platforms, the cast is effectively a no-op but ensures the code compiles everywhere. `CStr::from_ptr` only requires a pointer to a null-terminated byte sequence. The underlying representation of `i8` and `u8` is identical, so the cast is sound. Signed-off-by: filipw <filip@strathweb.com>
dstebila
approved these changes
Sep 11, 2025
Member
|
Thanks very much! I've created #300 to add builds on Windows ARM. |
Member
|
It looks like it is failing on some CI tests now, e.g. https://github.com/open-quantum-safe/liboqs-rust/actions/runs/17648174011/job/50151644796. I'm not sure what's going on here -- do any of those errors mean anything to you? |
Author
|
I don't think this is related to this PR (after all the original checks passed fine). Most likely cause is this actions/runner-images#12677 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
libc::c_charin Rust differs by target architecture:i8.u8.This change unconditionally casts pointers with
as *const _:*const i8to*const u8(or vice versa), resolving the type mismatch that caused compilation to fail.CStr::from_ptronly requires a pointer to a null-terminated byte sequence. The underlying representation ofi8andu8is identical, so the cast is sound.This change allows building and running on Windows ARM (yes, under
OQS_PERMIT_UNSUPPORTED_ARCHITECTURE)By the way - Windows on arm Github Agents are available for free now, so it might be nice to extend the CI setup with that https://github.com/orgs/community/discussions/155713.