Nixpkgs: glibc-iconv does not build using a custom store location

Created on 9 Oct 2019  路  12Comments  路  Source: NixOS/nixpkgs

Describe the bug
Impossible to compile glibc-iconv, it exit with error:

I tried to get help in the forum without, yet, much success: https://discourse.nixos.org/t/error-in-installing-glibc-iconv/4296

To Reproduce
Steps to reproduce the behavior:

  1. run the docker image siscia/nix-ubuntu:latest
  2. su - ubuntu
  3. nix-env -i glibc-iconv

Expected behavior
It should install glibc-iconv

bug non-nixos

All 12 comments

Simpler step to reproduce::

  1. Start the docker image, is a little big but contains the GCC alredy:
    docker run -it siscia/nix-ubuntu-gcc:latest
  2. Use the ubuntu user:
    su - ubuntu
  3. check that is actually able to install stuff, indeed we installed gcc:
    nix-env -q
  4. Try to install libiconv:
    nix-env -i libiconv
  5. Having it fails with something like:
checking for references to /build/ in /cvmfs/packages.redbeardlab.com/nix/store/achg5k3vsdi98qk9ydh0sbrsq2b508nw-bootstrap-stage4-gcc-wrapper-7.4.0...
building '/cvmfs/packages.redbeardlab.com/nix/store/fa010zi44ghgaksx32bzginmipplka82-glibc-iconv-2.27.drv'...
unpacking sources
variable $src or $srcs should point to the source
builder for '/cvmfs/packages.redbeardlab.com/nix/store/fa010zi44ghgaksx32bzginmipplka82-glibc-iconv-2.27.drv' failed with exit code 1
building '/cvmfs/packages.redbeardlab.com/nix/store/88rn21amffzvj156n9r4jnpxqzk28km7-bootstrap-stage4-stdenv-linux.drv'...
cannot build derivation '/cvmfs/packages.redbeardlab.com/nix/store/1z99w75jq7zp61zfmwa004cv0ysgbafr-gnugrep-3.3.drv': 1 dependencies couldn't be built
cannot build derivation '/cvmfs/packages.redbeardlab.com/nix/store/kly2gfcv9d6ckr0ls44rzad6d5cxzyf0-gcc-wrapper-7.4.0.drv': 1 dependencies couldn't be built
cannot build derivation '/cvmfs/packages.redbeardlab.com/nix/store/99nnlfn2rwvwa4i3nmhvwjdc4a0x917g-stdenv-linux.drv': 1 dependencies couldn't be built
cannot build derivation '/cvmfs/packages.redbeardlab.com/nix/store/zv63miikwbsr5sqpm8qchlndkn0p59f1-stdenv-linux.drv': 1 dependencies couldn't be built
cannot build derivation '/cvmfs/packages.redbeardlab.com/nix/store/bydvww6rxh4bglbnjqh6iws4pl15ix36-libiconv-1.15.drv': 1 dependencies couldn't be built
error: build of '/cvmfs/packages.redbeardlab.com/nix/store/bydvww6rxh4bglbnjqh6iws4pl15ix36-libiconv-1.15.drv' failed

This is weird! glibcIconv is using runCommand so it shouldn't require unpacking a source. There may be some issue involving a custom Nix store path here.

How can I debug this?

Can you provide the output of /cvmfs/packages.redbeardlab.com/nix/store/fa010zi44ghgaksx32bzginmipplka82-glibc-iconv-2.27.drv'?

Hi there,

surely.

$ nix show-derivation /cvmfs/packages.redbeardlab.com/nix/store/fa010zi44ghgaksx32bzginmipplka82-glibc-iconv-2.27.drv
{
  "/cvmfs/packages.redbeardlab.com/nix/store/fa010zi44ghgaksx32bzginmipplka82-glibc-iconv-2.27.drv": {
    "outputs": {
      "out": {
        "path": "/cvmfs/packages.redbeardlab.com/nix/store/s4ngz2ldi99w6akynd2q8v9rw828xy61-glibc-iconv-2.27"
      }
    },
    "inputSrcs": [
      "/cvmfs/packages.redbeardlab.com/nix/store/hsh249gg9vw61kg2czbw53f66wshn95f-default-builder.sh"
    ],
    "inputDrvs": {
      "/cvmfs/packages.redbeardlab.com/nix/store/20njp15bqm4j9fyx6yl7rjs2haija33a-glibc-2.27.drv": [
        "dev"
      ],
      "/cvmfs/packages.redbeardlab.com/nix/store/7vb2ng9qqrakllzq3xlzh3x1pjx0pgrg-bootstrap-tools.drv": [
        "out"
      ],
      "/cvmfs/packages.redbeardlab.com/nix/store/i0bxhaym4vnykrgl89g2apl2d8wqnx19-bootstrap-stage4-stdenv-linux.drv": [
        "out"
      ]
    },
    "platform": "x86_64-linux",
    "builder": "/cvmfs/packages.redbeardlab.com/nix/store/h7qkq8vh4xnm0d3r23l08f10nqx2yylv-bootstrap-tools/bin/bash",
    "args": [
      "-e",
      "/cvmfs/packages.redbeardlab.com/nix/store/hsh249gg9vw61kg2czbw53f66wshn95f-default-builder.sh"
    ],
    "env": {
      "buildCommand": "mkdir -p $out/include\nln -sv /cvmfs/packages.redbeardlab.com/nix/store/b6qgg8bag7cn1yn4dnhn30svi1p3gzr3-glibc-2.27-dev/include/iconv.h $out/include\n",
      "buildInputs": "",
      "builder": "/cvmfs/packages.redbeardlab.com/nix/store/h7qkq8vh4xnm0d3r23l08f10nqx2yylv-bootstrap-tools/bin/bash",
      "configureFlags": "",
      "depsBuildBuild": "",
      "depsBuildBuildPropagated": "",
      "depsBuildTarget": "",
      "depsBuildTargetPropagated": "",
      "depsHostHost": "",
      "depsHostHostPropagated": "",
      "depsTargetTarget": "",
      "depsTargetTargetPropagated": "",
      "doCheck": "",
      "doInstallCheck": "",
      "name": "glibc-iconv-2.27",
      "nativeBuildInputs": "",
      "out": "/cvmfs/packages.redbeardlab.com/nix/store/s4ngz2ldi99w6akynd2q8v9rw828xy61-glibc-iconv-2.27",
      "outputs": "out",
      "passAsFile": "buildCommand",
      "propagatedBuildInputs": "",
      "propagatedNativeBuildInputs": "",
      "stdenv": "/cvmfs/packages.redbeardlab.com/nix/store/0af07q9zna7mdyqk0nkyhpmv27dn7yf9-bootstrap-stage4-stdenv-linux",
      "strictDeps": "",
      "system": "x86_64-linux"
    }
  }
}
$ nix-store -r /cvmfs/packages.redbeardlab.com/nix/store/fa010zi44ghgaksx32bzginmipplka82-glibc-iconv-2.27.drv
these derivations will be built:
  /cvmfs/packages.redbeardlab.com/nix/store/fa010zi44ghgaksx32bzginmipplka82-glibc-iconv-2.27.drv
building '/cvmfs/packages.redbeardlab.com/nix/store/fa010zi44ghgaksx32bzginmipplka82-glibc-iconv-2.27.drv'...
unpacking sources
variable $src or $srcs should point to the source
builder for '/cvmfs/packages.redbeardlab.com/nix/store/fa010zi44ghgaksx32bzginmipplka82-glibc-iconv-2.27.drv' failed with exit code 1
error: build of '/cvmfs/packages.redbeardlab.com/nix/store/fa010zi44ghgaksx32bzginmipplka82-glibc-iconv-2.27.drv' failed

But I can't see anything wrong on it...

I was actually going to open an issue for the very same problem. I'm trying to deploy on RHEL6, with a non-standard location on NFS (_enterprise_, mmmkay? 馃樅 )

I'm also able to build everything up to that point, so it's not the build environment per se. I tried both the nixpkgs-unstable channel and the 19.03 pre-packaged archive, it stops at the exact same package, glibc-iconv-2.27, with the exact same error message. My 4hi2rfdj4vz8kdxak76bj8rihb403z5c-glibc-iconv-2.27.drv file looks very similar to @siscia's

This looks like "passAsFile" is not working correctly. Could you try running this:

$ nix-shell /cvmfs/packages.redbeardlab.com/nix/store/fa010zi44ghgaksx32bzginmipplka82-glibc-iconv-2.27.drv --run 'echo $buildCommandPath'

Hi!

Yes I can definitely, but you can do it as well using the docker images mentioned above!

$ nix-shell /cvmfs/packages.redbeardlab.com/nix/store/fa010zi44ghgaksx32bzginmipplka82-glibc-iconv-2.27.drv --run 'echo $buildCommandPath'
warning: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:9; will use bash from your environment
/tmp/nix-shell-16-0/.attr-0
$ cat /tmp/nix-shell-16-0/.attr-0
mkdir -p $out/include
ln -sv /cvmfs/packages.redbeardlab.com/nix/store/b6qgg8bag7cn1yn4dnhn30svi1p3gzr3-glibc-2.27-dev/include/iconv.h $out/include
$ cat /tmp/nix-shell-16-0/rc 
[ -n "$PS1" ] && [ -e ~/.bashrc ] && source ~/.bashrc; p=$PATH; dontAddDisableDepTrack=1; [ -e $stdenv/setup ] && source $stdenv/setup; PATH=$PATH:$p; unset p; PATH=".:$PATH"; SHELL=bash; set +e; [ -n "$PS1" ] && PS1='\n\[\033[1;32m\][nix-shell:\w]\$\[\033[0m\] '; if [ "$(type -t runHook)" = function ]; then runHook shellHook; fi; unset NIX_ENFORCE_PURITY; shopt -u nullglob; unset TZ; echo $buildCommandPath

Appears to be some issue in sandboxing. You should be able to get around it by adding:

nix-env -i libiconv --option sandbox false

I'll look into the root cause.

So it looks like a bug I originally introduced in Nix. The sandbox-fallback logic was not correctly handling things. This patch should resolve the issue:

https://patch-diff.githubusercontent.com/raw/NixOS/nix/pull/3144.patch

Successfully got it working with:

$ su - ubuntu
$ cd ~/nix-2.3
$ curl https://patch-diff.githubusercontent.com/raw/NixOS/nix/pull/3144.patch | patch -p1
$ make
$ sudo make install # password "ubuntu"
$ nix-env -i glibc-iconv

Thanks! It actually worked!

Just to confirm, it worked for me too. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

edolstra picture edolstra  路  3Comments

sid-kap picture sid-kap  路  3Comments

rzetterberg picture rzetterberg  路  3Comments

tomberek picture tomberek  路  3Comments

vaibhavsagar picture vaibhavsagar  路  3Comments