Hi guys! i’m trying to compile a cabal project using the wasm backend with flavor 9.12, but i’m hitting the following error:
building library for time-1.12.2...
ib/cbits/HsTime.c:14:5: error:
error: call to undeclared function 'tzset'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
14 | tzset();
| ^
|
14 | tzset();
| ^
1 error generated.
`wasm32-wasi-clang' failed in phase `C Compiler'. (Exit code: 1)
Error: [Cabal-7125]
In my current cabal.project file i have the following fields:
allow-newer:
template-haskell,
base,
ghc-prim,
ghc-experimental
if arch(wasm32)
shared: True
package aeson
flags: -ordered-keymap
I have to use allow newer since i’m hitting conflicts on base and template-haskell when trying to compile the following packages :
base >= 4.7 && < 5
text >= 1.2
jsaddle
jsaddle-wasm
singletons
singletons-base
ghc-experimental
template-haskell
However, if instead of calling wasm32-wasi-cabal, i call normal cabal, the project compiles fine. Any idea what might be happening?
With a little bit of help of the great Terror jack I found out that the time version 1.12 is too old. If i add a constraint: time >= 1.14 and add time to the allow newer list it now compiles.
However, adding so many allow newer feels strange. Specially since the wasi-wasm32-cabal package list seems to include packages that are tested with the 9.10 instead of the latest versions which are tested with 9.12 (which is the flavor I’m using). Is this supposed to work like this?
I’m dropping my flake.nix for reference
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
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 = [];
perSystem = { self', pkgs, config, ... }: {
devShells.default = pkgs.mkShell {
name = "haskell-template";
meta.description = "Haskell development environment";
inputsFrom = [
];
nativeBuildInputs =
[ inputs.ghc-wasm.packages.${pkgs.system}.all_9_12
pkgs.hpack
pkgs.just
pkgs.haskellPackages.Cabal_3_14_2_0
pkgs.haskell.compiler.ghc912
(pkgs.haskell-language-server.override { supportedGhcVersions = [ "912" ]; })
pkgs.haskellPackages.hoogle
];
};
};
};
}