Haskell GHCJS with Diagrams gives error: no C compiler provided for this platform

192 views Asked by At

I am trying to build a POC, using Reflex and Diagrams. I am using WSL2 with Ubuntu-20.04. I've used the Reflex-stone template, which builds fine. I then add diagrams-lib to the dependency list, and get this error.

xeno@PCB-CWO:/mnt/c/Users/CWO/repos/reflex-platform/Animazing$ nix-build --show-trace
error: while evaluating the attribute 'buildCommand' of the derivation 'reflex-stone-site' at /nix/store/p3x4ha4dwj9agifi05wq0vf3m93p3vsx-source/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating the attribute 'buildInputs' of the derivation 'reflex-stone-0.1.0.0-js-unknown-ghcjs' at /nix/store/p3x4ha4dwj9agifi05wq0vf3m93p3vsx-source/pkgs/stdenv/generic/make-derivation.nix:197:11:
while evaluating the attribute 'propagatedBuildInputs' of the derivation 'diagrams-lib-1.4.2.3-js-unknown-ghcjs' at /nix/store/p3x4ha4dwj9agifi05wq0vf3m93p3vsx-source/pkgs/stdenv/generic/make-derivation.nix:197:11:
while evaluating the attribute 'propagatedBuildInputs' of the derivation 'JuicyPixels-3.3.3.1-js-unknown-ghcjs' at /nix/store/p3x4ha4dwj9agifi05wq0vf3m93p3vsx-source/pkgs/stdenv/generic/make-derivation.nix:197:11:
while evaluating the attribute 'buildInputs' of the derivation 'zlib-0.6.2.1-js-unknown-ghcjs' at /nix/store/p3x4ha4dwj9agifi05wq0vf3m93p3vsx-source/pkgs/stdenv/generic/make-derivation.nix:197:11:
while evaluating the attribute 'makeFlags' of the derivation 'zlib-1.2.11-js-unknown-ghcjs' at /nix/store/p3x4ha4dwj9agifi05wq0vf3m93p3vsx-source/pkgs/stdenv/generic/make-derivation.nix:197:11:
while evaluating the attribute 'cc.targetPrefix' at /nix/store/p3x4ha4dwj9agifi05wq0vf3m93p3vsx-source/pkgs/stdenv/generic/default.nix:158:14:
no C compiler provided for this platform

I got a bit of help, and someone suggested that it might be a test that requires a c. So I added this to my project.nix

overrides = self: super: {
    diagrams-lib = pkgs.haskell.lib.dontCheck super.diagrams-lib;
    JuicyPixels = pkgs.haskell.lib.dontCheck super.JuicyPixels;
    zlib = pkgs.haskell.lib.dontCheck super.zlib;
};

But with no effect. There exists a Diagrams-Reflex repo, but I couldn't get this to build either. I am very new to Nix though.

1

There are 1 answers

0
Nathan BeDell On

It seems like this can be resolved (at least in addition to what you have here), by overriding nixpkgs to use a newer zlib version with better support for ghcjs.

This ended up working for me:

overrides = self: super: {
    diagrams-lib = pkgs.haskell.lib.dontCheck super.diagrams-lib;
    JuicyPixels = pkgs.haskell.lib.dontCheck super.JuicyPixels;
    zlib = self.callHackageDirect {
        pkg = "zlib";
        ver = "0.6.3.0";
        sha256 = "3PLCQ94ONQtjQc8AqVMgCVrZZW766T8PDevOvKC4VDw=";
    } {};
};