pkgsCross.wasi32.haskell.compiler.{ghcHEAD,ghc961}: new wasm backend #225000
pkgsCross.wasi32.haskell.compiler.{ghcHEAD,ghc961}: new wasm backend #225000sternenseemann wants to merge 8 commits intoNixOS:haskell-updatesfrom
Conversation
|
Exciting! Thanks @sternenseemann |
This will catch issue like the one that was present: Since we did not make ../llvm writeable, the patch wouldn't apply.
Seems like sometime between LLVM 12 and 16 the platform check sneaked into libcxx as well.
For some reason, this is required now.
pkgsCross.wasi32.llvmPackages: 12 -> 16 * It appears BULK_MEMORY_SOURCES no longer needs to be set to be empty to compile firefox. Without it, the build of wasilibc would fail if enableThreads is true. * Include preliminary support for the experimental threads support in wasilibc which provides pthreads API. If wasilibc is built with support, is exposed via passthru and libcxx / libcxxabi are built with threads support accordingly. See also: - WebAssembly/wasi-sdk#274 - WebAssembly/wasi-sdk#301 - WebAssembly/wasi-sdk#314 wasi-sdk ships it by default, but as a separate variant of libc which would be a hassle for us. Let's just make it optional for now. You can try it out using the following overlay: self: super: { wasilibc = super.wasilibc.override { enableThreads = true; }; } Flags for libc++abi are copied from wasi-sdk.
This is a quicker way than building firefox to see if linking works.
Seems like in a lot of cases the build->build compiler is propagated (?) somehow, but we can also provide it explicitly and have it accompany the stage0 GHC explicitly by setting the *_STAGE0 environment variables.
|
Progress report: A first step is done with #241739 which updates LLVM and wasilibc which are both a requisite for building GHC's wasm backend in nixpkgs. This doesn't get allow us to build GHC yet, though:
All of this leads me to conclude that the WASM backend is a technology preview in a very different sense to the JS backend. Consequently, I'm quite unenthusiastic about packaging this at the moment, since there is not really a clean way to do so. We'd need something akin to a |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/how-to-get-haskell-wasm-work-for-haskell-flake/38318/3 |
Description of changes
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)