Nixpkgs: pkgsStatic.busybox no longer builds

Created on 14 Dec 2018  路  8Comments  路  Source: NixOS/nixpkgs

Issue description

On Nixpkgs f2f805d6d8a370379d89972d45b16d008112b56a, pkgsStatic.busybox does not build. The buildPhase seems fine and the issue seems to be in the installPhase.

Steps to reproduce

$ nix-build -A pkgsStatic.busybox
<...>
/nix/store/2wkwpm0qhkwwy393n55d0ag64mbhp9vw-x86_64-unknown-linux-musl-binutils-2.30/bin/x86_64-unknown-linux-musl-ld:INSTALL: file format not recognized; treating as linker script
/nix/store/2wkwpm0qhkwwy393n55d0ag64mbhp9vw-x86_64-unknown-linux-musl-binutils-2.30/bin/x86_64-unknown-linux-musl-ld:INSTALL:2: syntax error
collect2: error: ld returned 1 exit status
builder for '/nix/store/14wlq7nxfx2s4ay7j0l17b43b6ffbvlf-musl-1.1.20-x86_64-unknown-linux-musl.drv' failed with exit code 1
cannot build derivation '/nix/store/4kq0f9icgk481ayy8pbb9k3dzbab74p2-busybox-1.29.3-x86_64-unknown-linux-musl.drv': 1 dependencies couldn't be built
error: build of '/nix/store/4kq0f9icgk481ayy8pbb9k3dzbab74p2-busybox-1.29.3-x86_64-unknown-linux-musl.drv' failed

Technical details

  • system: "x86_64-linux"
  • host os: Linux 4.19.4, NixOS, 18.09.1420.5d4a1a3897e (Jellyfish)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.1.3
  • channels(root): "nixos-18.09.1420.5d4a1a3897e"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

Most helpful comment

Should this be made a PR? Still fails to build, FWIW.

All 8 comments

/cc @Ericson2314 @matthewbauer

Yeah what's happening is that the musl hacks get in the way of an actual musl build. I think the solution is just to remove the musl hacks and use pkgsStatic.busybox whenever this is needed.

This should work:

diff --git a/pkgs/os-specific/linux/busybox/default.nix b/pkgs/os-specific/linux/busybox/default.nix
index 5f4efe943ca..f0bca240e71 100644
--- a/pkgs/os-specific/linux/busybox/default.nix
+++ b/pkgs/os-specific/linux/busybox/default.nix
@@ -1,7 +1,7 @@
 { stdenv, lib, buildPackages, fetchurl
 , enableStatic ? false
 , enableMinimal ? false
-, useMusl ? stdenv.hostPlatform.libc == "musl", musl
+, useMusl ? stdenv.hostPlatform.libc == "musl"
 , extraConfig ? ""
 }:

@@ -88,10 +88,6 @@ stdenv.mkDerivation rec {
     runHook postConfigure
   '';

-  postConfigure = lib.optionalString useMusl ''
-    makeFlagsArray+=("CC=${stdenv.cc.targetPrefix}cc -isystem ${musl.dev}/include -B${musl}/lib -L${musl}/lib")
-  '';
-
   depsBuildBuild = [ buildPackages.stdenv.cc ];

   buildInputs = lib.optionals (enableStatic && !useMusl) [ stdenv.cc.libc stdenv.cc.libc.static ];

The buildInputs can also removed. All that is what we did and if worked!

The buildInputs thing would still be needed if you are building static with glibc (see #51966).

Fair. But now that https://github.com/NixOS/nixpkgs/pull/51966 is merged, isn't that again not needed?

Should this be made a PR? Still fails to build, FWIW.

For anyone looking, this seems to work:

nix-build -E 'with import <nixos>{}; pkgs.pkgsStatic.busybox.overrideAttrs (old:{postConfigure="";})'
Was this page helpful?
0 / 5 - 0 ratings

Related issues

lverns picture lverns  路  3Comments

copumpkin picture copumpkin  路  3Comments

langston-barrett picture langston-barrett  路  3Comments

edolstra picture edolstra  路  3Comments

ob7 picture ob7  路  3Comments