[Nix-dev] broken pipe with bison and recursive make

Rohan Hart rohan.hart17 at gmail.com
Wed Jan 13 03:06:04 CET 2010


Hi

I'm trying to build binutils with gold but bison is giving a "broken
pipe" error.  I thought this might be related to the bug which was
fixed some time ago in nix-env but it turns out that the recursive
make itself has this problem and simply cd'ing to the correct
directory and make'ing allowed bison to build.

I've hacked around this issue with the following preBuild script (in a
copied version of binutils so that I don't rebuild all of Nix) but
would be interested if there's a better way.

thanks
Rohan

------------------------------------------------------------------------

{stdenv, fetchurl, noSysDirs, bison}:

stdenv.mkDerivation rec {
  name = "binutils-gold-2.19.1";

  src = fetchurl {
    url = "mirror://gnu/binutils/binutils-2.19.1.tar.bz2";
    sha256 = "1xirhxwc94bk6hn2k6i5ly4knbcjsqgy2lp7kl1s5q5csys2b0iy";
  };

  patches = [
    # Turn on --enable-new-dtags by default to make the linker set
    # RUNPATH instead of RPATH on binaries.  This is important because
    # RUNPATH can be overriden using LD_LIBRARY_PATH at runtime.
    ./new-dtags.patch
  ];

  inherit noSysDirs;

  buildInputs = [ bison ];

  preConfigure = ''
    # Clear the default library search path.
    if test "$noSysDirs" = "1"; then
        echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
    fi
  '';

  configureFlags = "--disable-werror --enable-gold"; # needed for dietlibc build

  preBuild = ''
    # make gold non-recursively to avoid broken pipe

    # first some dependancies
    make all-bfd
    make all-libiberty

    # now gold
    make configure-gold
    cd gold
    make
  '';

  meta = {
    description = "GNU Binutils, tools for manipulating binaries
(linker, assembler, etc.)";

    longDescription = ''
      The GNU Binutils are a collection of binary tools.  The main
      ones are `ld' (the GNU linker) and `as' (the GNU assembler).
      They also include the BFD (Binary File Descriptor) library,
      `gprof', `nm', `strip', etc.
    '';

    homepage = http://www.gnu.org/software/binutils/;

    license = "GPLv3+";

    /* Give binutils a lower priority than gcc-wrapper to prevent a
       collision due to the ld/as wrappers/symlinks in the latter. */
    priority = "10";
  };
}



More information about the nix-dev mailing list