-
Notifications
You must be signed in to change notification settings - Fork 11
Skip major/minor/makedev on WASM #16
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
Conversation
We just skip compiling it. Yes, this is horrible, but what can you do.
Alternative solution to building. This allows us to remove the include of HsUnixCompat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been using a very ad-hoc version of this patch (amesgen@50f40ea) in the past, this PR seems like a proper way to integrate it, LGTM 👍
We talked about this during the Agda dev call today (2025-03-26) @L-TChen @wenkokke Would be nice to have a CI for WASM, maybe along the lines of: https://github.com/haskell/unix/blob/master/.github/workflows/ci-wasm32-wasi.yml Also @SquidDev would it be possible to write a https://github.com/haskell-pkg-janitors/unix-compat/blob/main/CHANGELOG.md entry? |
Yep, of course! Running tests is a bit of a pain here, as splitmix does not support targetting WASM. There is a PR for this (haskellari/splitmix#73), but sadly it doesn't look like the maintainer is going to merge it. If we switch to that commit, there's two tests which fail with
|
We need to use a fork of splitmix here. We /should/ be able to still point to the original repo, but Cabal doesn't run a "git fetch" to download the ref, so you can't point to a commit not on a branch. This is fixed in latest, but that won't be released for a while.
GHCUp doesn't appear to have GHC 9.12. While we don't strictly speaking need it here (it would be sufficient to test with GHC 9.10), it feels easier to just rely on the Nix flake.
Sorry for the commit spam, took a while to get CI working. I did try to test locally, I swear! I think this is there now. I'm not thrilled about how the workflow looks (bit of a misuse of Nix), but a) |
@SquidDev : Is it ok to squash the commits? |
Yes! Left them separate as it felt easier to review, but happy for you to squash when merging, or for me to squash now. |
Ok, I put up the "squash" banner, let me know when this PR is ready to merge and release. |
I think this is good to go whenever! It's not pretty, but I think it does what it needs to do for now :). |
This will be released as v0.7.4. |
WebAssembly/WASI does not have
makedev
and friends. When targetting WASI, we skip buildingHsUnixCompat.c
and (like with Windows) just provide dummy implementations instead.This removes the
NEED_setSymbolicLinkOwnerAndGroup
macro fromHsUnixCompat.h
as we can no longer rely on that file existing, and so inline the definition directly intoFiles.hsc
. I do not believe any other packages rely on this macro existing, so this should not cause any breakage.However, if preferred, I'm happy to revert this, and instead put the definitions of
unix_makedev
inside a#ifndef wasm32_HOST_ARCH
.