nh2 / static-haskell-nix

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

Update nixpkgs to master from 2019-10-20 #61

Closed nh2 closed 4 years ago

nh2 commented 4 years ago

Important change: https://github.com/NixOS/nixpkgs/issues/61682#issuecomment-544215621

nh2 commented 4 years ago

Now I get the build errors from #56.

nh2 commented 4 years ago

Now I get the build errors from #56.

https://github.com/NixOS/nixpkgs/pull/71480 fixes that.

Next problem:

https://buildkite.com/nh2/static-haskell-nix/builds/109#e544003f-8609-44af-80a5-b6e38d046b1b

configure: error: cannot execute: /nix/store/9dlxvh3z38bfz9zv0fcklrd53xdw4b36-x86_64-unknown-linux-musl-binutils-wrapper-2.31.1/bin/x86_64-unknown-linux-musl-as: check --with-as or env. var. DEFAULT_ASSEMBLER
...
make[1]: *** [Makefile:4188: configure-gcc] Error 1
...
builder for '/nix/store/hsc2n472r2il8zp9p31wcwn4mml7lgp5-gcc-debug-8.3.0-x86_64-unknown-linux-musl-stage-static.drv' failed with exit code 2
% ls -l /nix/store/9dlxvh3z38bfz9zv0fcklrd53xdw4b36-x86_64-unknown-linux-musl-binutils-wrapper-2.31.1/bin/
total 8
-r-xr-xr-x 1 niklas niklas 8065 Jan  1  1970 x86_64-unknown-linux-musl-ld*

The x86_64-unknown-linux-musl-as it's trying to execute does not exist.

nh2 commented 4 years ago

The x86_64-unknown-linux-musl-as it's trying to execute does not exist.

Expanding the builder for the musl-binutils-wrapper, I can see:

      ldPath="/nix/store/wpj60n3r8amjlkxxj7x4dzs6ksy8k4pf-x86_64-unknown-linux-musl-binutils-2.31.1/bin"
      # Create a symlink to as (the assembler).
      if [ -e $ldPath/x86_64-unknown-linux-musl-as ]; then
        ln -s $ldPath/x86_64-unknown-linux-musl-as $out/bin/x86_64-unknown-linux-musl-as
      fi

But here the thing inside is called as:

% ls /nix/store/wpj60n3r8amjlkxxj7x4dzs6ksy8k4pf-x86_64-unknown-linux-musl-binutils-2.31.1/bin
addr2line*  ar*  as*  c++filt*  dwp*  elfedit*  gprof*  ld@  ld.bfd*  ld.gold*  nm*  objcopy*  objdump*  ranlib*  readelf*  size*  strings*  strip*

so the if is false.

Not sure yet why the x86_64-unknown-linux-musl-ld works.

nh2 commented 4 years ago

Got some progress with https://buildkite.com/nh2/static-haskell-nix/builds/113:

The -A working set and stack2nix-example are building with 8.6.5, but the other things not yet.

nh2 commented 4 years ago

-A workingStackageExecutables needs https://github.com/NixOS/nixpkgs/pull/72019

nh2 commented 4 years ago

I now discovered I need, via this dependency chain:

haskellPackages.H
  R
    openjdk-8u222
      cups-2.2.12
        systemd-243

these PRs that @cdepillabout made solve it:

I'll cherry-pick those.

I also need: https://github.com/NixOS/nixpkgs/pull/72032

nh2 commented 4 years ago

I also need: NixOS/nixpkgs#72032

Made improved PR https://github.com/NixOS/nixpkgs/pull/72057 for better polkit support.

May not need it in the end for static-haskell-nix because I've disabled (for H) R's openjdk support; it came in via

haskellPackages.H
  R
    openjdk-8u222
      gconf
        polkit

The PR may nevertheless improve musl support for the future.

nh2 commented 4 years ago

Another PR for R static libs: https://github.com/NixOS/nixpkgs/pull/72058

nh2 commented 4 years ago

I found that before this master update, I didn't encounter H's dependency problems like R and openjdk, because H didn't evaluate even, because openjdk hasassert stdenv.hostPlatform.libc == "glibc";` in

https://github.com/NixOS/nixpkgs/blob/4c0afa17702c32f40c70482bd16e47b37b30214e/pkgs/development/compilers/openjdk/bootstrap.nix#L7

that was triggered; apparently now it no longer is when evaluating haskellPackages.H.

nh2 commented 4 years ago

I have squashed.