I’m currently trying to build a haskell project which depends on singleton-base. Nevertheless, it fails with error:
wasm32-wasi-cabal build WASM -f WASM
Error: [Cabal-7125]
Failed to build singletons-base-3.4 (which is required by exe:WASM from ICFP2024-0.1.0.0). The failure occurred during the configure step. The exception was:
/home/dan/.ghc-wasm/.cabal/logs/ghc-9.10.1.20241115/singletons-base-3.4-7143523c8a4505d927c5f8fad794d9ef09d9fff6b3616742b4c0a4219b648544.log: withFile: user error (Error: cabal:
'/nix/store/5hmcdnb69b7mbk2pjwv4fjxx85w5bpgd-wasm32-wasi-ghc-9.10/bin/wasm32-wasi-ghc'
exited with an error:
wasm-ld: error: unable to find library -lHSrts-1.0.2_thr
wasm32-wasi-clang: error: linker command failed with exit code 1 (use -v to
see invocation)
wasm32-wasi-ghc-9.10.1.20241115: `wasm32-wasi-clang' failed in phase `Linker'.
(Exit code: 1
I tried following the miso repo. My cabal.project
looks like:
packages:
.
index-state: 2024-11-15T08:25:42Z
if arch(wasm32)
-- Required for TemplateHaskell. When using wasm32-wasi-cabal from
-- ghc-wasm-meta, this is superseded by the global cabal.config.
shared: True
-- https://github.com/haskellari/time-compat/issues/37
-- Older versions of time don't build on WASM.
constraints: time installed
allow-newer: time
package aeson
flags: -ordered-keymap
Whilst my flake.nix
is:
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
haskell-flake.url = "github:srid/haskell-flake";
ghc-wasm.url = "gitlab:haskell-wasm/ghc-wasm-meta?host=gitlab.haskell.org";
};
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = nixpkgs.lib.systems.flakeExposed;
imports = [ inputs.haskell-flake.flakeModule];
perSystem = { self', pkgs, config, ... }:
let
stack-wrapped = pkgs.symlinkJoin {
name = "stack"; # will be available as the usual `stack` in terminal
paths = [ pkgs.stack ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/stack \
--add-flags "\
--no-nix \
--system-ghc \
--no-install-ghc \
"
'';
};
in {
haskellProjects.default = {
basePackages = pkgs.haskell.packages.ghc982;
packages = {
};
settings = {
singletons-base = {
check = false;
};
singletons-base_3_3 = {
check = false;
};
singletons = {
check = false;
};
singletons-th = {
check = false;
};
};
devShell = {
hlsCheck.enable = true;
hoogle = true;
};
autoWire = [ "packages" "apps" "checks" ];
};
packages.default = self'.packages.ICFP2024;
devShells.default = pkgs.mkShell {
name = "haskell-template";
meta.description = "Haskell development environment";
inputsFrom = [
config.haskellProjects.default.outputs.devShell
];
nativeBuildInputs =
[ inputs.ghc-wasm.packages.${pkgs.system}.all_9_10
stack-wrapped
pkgs.hpack
pkgs.just
pkgs.nodejs_20
pkgs.nodePackages.npm
];
};
};
};
}
Beside that, my .cabal
file passes the following ghc-options
to the executable:
ghc-options: -no-hs-main -optl-mexec-model=reactor -optl-Wl,--export=cmain -O2
As far as I know singletons-base
does pure operations only. What am I missing?