Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkgsStatic.busybox no longer builds #52074

Closed
vaibhavsagar opened this issue Dec 14, 2018 · 8 comments · Fixed by #67644
Closed

pkgsStatic.busybox no longer builds #52074

vaibhavsagar opened this issue Dec 14, 2018 · 8 comments · Fixed by #67644

Comments

@vaibhavsagar
Copy link
Member

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
@vaibhavsagar
Copy link
Member Author

/cc @Ericson2314 @matthewbauer

@vaibhavsagar vaibhavsagar changed the title pkgsStatic.busybox no longer builds pkgsStatic.musl no longer builds Dec 14, 2018
@vaibhavsagar vaibhavsagar changed the title pkgsStatic.musl no longer builds pkgsStatic.busybox no longer builds Dec 14, 2018
@Ericson2314
Copy link
Member

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.

@matthewbauer
Copy link
Member

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 ];

@Ericson2314
Copy link
Member

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

@matthewbauer
Copy link
Member

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

@Ericson2314
Copy link
Member

Fair. But now that #51966 is merged, isn't that again not needed?

@dtzWill
Copy link
Member

dtzWill commented Feb 4, 2019

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

@dtzWill dtzWill mentioned this issue May 1, 2019
10 tasks
@tomberek
Copy link
Contributor

For anyone looking, this seems to work:

nix-build -E 'with import <nixos>{}; pkgs.pkgsStatic.busybox.overrideAttrs (old:{postConfigure="";})'

matthewbauer added a commit that referenced this issue Aug 28, 2019
dtzWill pushed a commit to dtzWill/nixpkgs that referenced this issue Sep 9, 2019
Fixes NixOS#52074

(cherry picked from commit b4f6931)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants