Nixpkgs: Nix Pill 8.1 fails with "ar: Command not found"

Created on 25 Feb 2018  Â·  4Comments  Â·  Source: NixOS/nixpkgs

Issue description

When running the Nix pill 8.1

$ nix-build hello.nix

... lots of build output

if test "hello" = "gettext-tools"; then \                                                                                                                                                                         
  /nix/store/cb3slv3szhp46xkrczqw7mscy5mnk64l-coreutils-8.29/bin/mkdir -p /nix/store/b7s7l1i5vv5mw3kmbx5jsjzdfc28q01c-hello/share/gettext/po; \
  for file in Makefile.in.in remove-potcdate.sin quot.sed boldquot.sed [email protected] [email protected] insert-header.sin Rules-quot   Makevars.template; do \
    /nix/store/cb3slv3szhp46xkrczqw7mscy5mnk64l-coreutils-8.29/bin/install -c -m 644 ./$file \
                    /nix/store/b7s7l1i5vv5mw3kmbx5jsjzdfc28q01c-hello/share/gettext/po/$file; \
  done; \
  for file in Makevars; do \
    rm -f /nix/store/b7s7l1i5vv5mw3kmbx5jsjzdfc28q01c-hello/share/gettext/po/$file; \
  done; \
else \
  : ; \
fi
make[2]: Leaving directory '/tmp/nix-build-hello.drv-0/hello-2.10/po'                                                                                                                                             
make[2]: Entering directory '/tmp/nix-build-hello.drv-0/hello-2.10'                                                                                                                                               
rm -f lib/libhello.a                                                                                                                                                                                              
ar cru lib/libhello.a lib/c-ctype.o lib/c-strcasecmp.o lib/c-strncasecmp.o lib/close-stream.o lib/closeout.o lib/dirname.o lib/basename.o lib/dirname-lgpl.o lib/basename-lgpl.o lib/stripslash.o lib/exitfail.o lib/localcharset.o lib/progname.o lib/quotearg.o lib/strnlen1.o lib/unistd.o lib/wctype-h.o lib/xmalloc.o lib/xalloc-die.o lib/xstrndup.o 
make[2]: ar: Command not found                                                                                                                                                                                    
make[2]: *** [Makefile:1550: lib/libhello.a] Error 127                                                                                                                                                            
make[2]: Leaving directory '/tmp/nix-build-hello.drv-0/hello-2.10'
make[1]: *** [Makefile:1878: install-recursive] Error 1
make[1]: Leaving directory '/tmp/nix-build-hello.drv-0/hello-2.10'
make: *** [Makefile:2371: install] Error 2                                                                                                                                                                        
builder for ‘/nix/store/d56h8brrfk0him1x46n0zcafs6ygc5zg-hello.drv’ failed with exit code 2                                                                                                                       
error: build of ‘/nix/store/d56h8brrfk0him1x46n0zcafs6ygc5zg-hello.drv’ failed                                                                                                                                    

Steps to reproduce

See above

Technical details

$ nix-shell -p nix-info --run "nix-info -m"                                                                                                                
 - system: `"x86_64-linux"`                                                                                                                                                                                       
 - host os: `Linux 4.14.20, NixOS, 18.03pre129076.831ef4756e3 (Impala)`                                                                                                                                           
 - multi-user?: `yes`                                                                                                                                                                                             
 - sandbox: `no`                                                                                                                                                                                                  
 - version: `nix-env (Nix) 1.11.16`                                                                                                                                                                               
 - channels(root): `"nixos-18.03pre129076.831ef4756e3"`                                                                                                                                                           
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs`

Most helpful comment

@vitiral I run into the same issue when doing a cabal v1-install --dependencies-only on WSL and your solution to install the Nix package binutils.bintools fixed it.

All 4 comments

I found the fix.

  1. add bintools = binutils.bintools; to hello.nix
  2. add :$bintools/bin to PATH in build_hello.sh

This is the top of hello_builder.sh: (I also added inhert ... binutils)

export PATH="$gnutar/bin:$gcc/bin:$gnumake/bin:$coreutils/bin:$gawk/bin:$gzip/bin:$gnugrep/bin:$gnused/bin:$binutils_unwrapped/bin:$bintools/bin"
echo "PATH=$PATH"
echo "binutils=$binutils"
echo "bintools=$bintools"
echo "binutils_unwrapped=$binutils_unwrapped"

It prints the following:

PATH=/nix/store/2p00w952ljb1172nsf3jm7nsjgsw5qpw-gnutar-1.30/bin:/nix/store/gqg2vrcq7krqi9rrl6pphvsg81sb8pjw-gcc-wrapper-7.3.0/bin:/nix/store/lhp5rw0dagi5mgqwr9i3x41240ba4ypz-gnumake-4.2.1/bin:/nix/store/cb3slv3
szhp46xkrczqw7mscy5mnk64l-coreutils-8.29/bin:/nix/store/j79xs2j519bmvq0gihz8ff4nw5aj3vlh-gawk-4.2.0/bin:/nix/store/d7895h1an2pgcd6a3vx3yb5fbg786lci-gzip-1.9/bin:/nix/store/s63b2myh6rxfl4aqwi9yxd6rq66djk33-gnugre
p-3.1/bin:/nix/store/navldm477k3ar6cy0zlw9rk43i459g69-gnused-4.4/bin:/bin:/nix/store/b0zlxla7dmy1iwc3g459rjznx59797xy-binutils-2.28.1/bin
binutils=/nix/store/cmxaqb5cbzy4jk26na842n6hy1s4yn19-binutils-wrapper-2.28.1
bintools=/nix/store/b0zlxla7dmy1iwc3g459rjznx59797xy-binutils-2.28.1
binutils_unwrapped=

It seems that binutils_unwrapped is actually an empty string, which explains why it cannot find the required command.

We have a separate issue tracker for the nix pills, see https://github.com/NixOS/nix-pills/issues/43.

thanks, I figured out the bug as well

@vitiral I run into the same issue when doing a cabal v1-install --dependencies-only on WSL and your solution to install the Nix package binutils.bintools fixed it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

retrry picture retrry  Â·  3Comments

vaibhavsagar picture vaibhavsagar  Â·  3Comments

ob7 picture ob7  Â·  3Comments

tomberek picture tomberek  Â·  3Comments

teto picture teto  Â·  3Comments