nh2 / static-haskell-nix

easily build most Haskell programs into fully static Linux executables
388 stars 36 forks source link

coreutils build failure #29

Closed Gabriella439 closed 5 years ago

Gabriella439 commented 5 years ago

Here's the minimal reproduction:

let
  nixpkgs =
    builtins.fetchTarball {
      url = "https://github.com/nh2/nixpkgs/archive/a2d7e9b875e8ba7fd15b989cf2d80be4e183dc72.tar.gz";

      sha256 = "1hnmp637r99qd6g0sbx4w3za564gbzwl5c4z0x7fvn7kfi2jp1hx";
    };

  static-haskell-nix =
    builtins.fetchTarball {
      url = "https://github.com/nh2/static-haskell-nix/archive/3a7a54a116b10bee0f6d5c67cfda729e8d22e0a4.tar.gz";

      sha256 = "0zb132nj7wlqnanqqv0c1439y0v2ch823bylnmnmcagxvj4cm2hw";
    };

  pkgsLinux = import nixpkgs {
    system = "x86_64-linux";

    config = {};
  };

  pkgsStaticLinux = import "${static-haskell-nix}/survey" {
    normalPkgs = pkgsLinux;
  };

in
  pkgsStaticLinux.haskellPackages.dhall

This fails with:

$ nix build --file ./example.nix
error: build of '/nix/store/dpgwckqh1my76ap6i18q7y3w2qafplf0-coreutils-8.31.drv' on 'ssh://root@107.23.226.1' failed: builder for '/nix/store/dpgwckqh1my76ap6i18q7y3w2qafplf0-coreutils-8.31.drv' failed with exit code 2
builder for '/nix/store/dpgwckqh1my76ap6i18q7y3w2qafplf0-coreutils-8.31.drv' failed with exit code 1; last 10 log lines:
  make[4]: *** [Makefile:12762: tests/test-suite.log] Error 1
  make[4]: Leaving directory '/tmp/nix-build-coreutils-8.31.drv-0/coreutils-8.31'
  make[3]: *** [Makefile:12870: check-TESTS] Error 2
  make[3]: Leaving directory '/tmp/nix-build-coreutils-8.31.drv-0/coreutils-8.31'
  make[2]: *** [Makefile:13125: check-am] Error 2
  make[2]: Leaving directory '/tmp/nix-build-coreutils-8.31.drv-0/coreutils-8.31'
  make[1]: *** [Makefile:12647: check-recursive] Error 1
  make[1]: Leaving directory '/tmp/nix-build-coreutils-8.31.drv-0/coreutils-8.31'
  make: *** [Makefile:13127: check] Error 2
  builder for '/nix/store/dpgwckqh1my76ap6i18q7y3w2qafplf0-coreutils-8.31.drv' failed with exit code 2
cannot build derivation '/nix/store/cjvcpa74knvjspg1a275d06j3s9ssq34-dhall-1.19.1.drv': 1 dependencies couldn't be built
[0 built (1 failed), 0.0 MiB DL]
error: build of '/nix/store/cjvcpa74knvjspg1a275d06j3s9ssq34-dhall-1.19.1.drv' failed
nh2 commented 5 years ago

@Gabriel439

  1. I can't reproduce it: My build succeeds, because it fetches it from the static-haskell-nix cachix, which means that I've built it successfully in the past.
  2. nix-store -qd $(nix-store -qR $(nix-build ./example.nix) | grep coreutils) gives /nix/store/dpgwckqh1my76ap6i18q7y3w2qafplf0-coreutils-8.31.drv (same .drv as yours). I'm re-building it now with nix-store -r --check to check whether re-building it fails on either NixOS or Ubuntu.
  3. What OS is this on, NixOS? Sandbox on or off? Nix version (I use nix (Nix) 2.0.4)?
  4. Can you run with nix-build instead of nix build, or run nix log /nix/store/dpgwckqh1my76ap6i18q7y3w2qafplf0-coreutils-8.31.drv, so that we can see the full output, in particular what part of the test suite failed? It got truncated away in your last 10 log lines.
nh2 commented 5 years ago

nix-store -r /nix/store/dpgwckqh1my76ap6i18q7y3w2qafplf0-coreutils-8.31.drv --check succeeded on my Ubuntu 16.04 and my NixOS.

So I cannot reproduce at all, it seems to be working for me.

Gabriella439 commented 5 years ago

Here's the output from the failed test:

$ nix-store -r /nix/store/dpgwckqh1my76ap6i18q7y3w2qafplf0-coreutils-8.31.drv
...
FAIL: tests/id/zero
===================

uid=30001(nixbld1) gid=30000(nixbld) groups=30000(nixbld)
uid=30001(nixbld1) gid=30000(nixbld) groups=30000(nixbld),30000(nixbld)
--- gtmp1       2019-06-29 23:29:54.677078479 +0000
+++ gtmp3       2019-06-29 23:29:54.678078476 +0000
@@ -1,8 +1,4 @@
-30000
-
-nixbld
-
-30000
-
-nixbld
-
+30000 
+nixbld 
+30000 
+nixbld 
FAIL tests/id/zero.sh (exit status: 1)

...
nh2 commented 5 years ago

@Gabriel439 That looks like some odd extra newlines.

What about question 3, what OS is this on, and with or without sandbox?

Gabriella439 commented 5 years ago

@nh2: It's on Linux, but without a sandbox, and with Nix version 2.1.1

nh2 commented 5 years ago

Hmm, I don't really have an idea. I am not sure it's at all related to static-haskell-nix. Could you find a nix-installed coreutils obtained from cache.nixos.org on your system (ideally the same version 8.31), get the .drv file of it, and rebuild it locally with nix-store -r --check, to see whether all coreutils fail for you, not only the one from static-haskell-nix?

The only other instance of FAIL tests/id/zero.sh I managed to google is in https://github.com/NixOS/nix/issues/512 as FAIL tests/id/zero.

Gabriella439 commented 5 years ago

The sandbox is the difference. Once I enable the sandbox the build passes

nh2 commented 5 years ago

@Gabriel439 You should probably file a nixpkgs issue then -- it would be good to get as much software build and test successfully also without sandbox as possible, especially fundamental things like coreutils.

Gabriella439 commented 5 years ago

Yeah, I think this issue is not static-haskell-nix-specific