Build Error - Dependency Troubleshooting

Hi All,

I am trying to compile UDPCast, first time I couldn’t find a package in Nix.

I see the following error…

cat udp-receiver.txt udp-sender.txt cmd.html | m4 >
make: sh: No such file or directory
make: *** [Makefile:80:] Error 127

I added gnum4 but it still errors. Do I need to add cat as a dependency?

pkgs: attrs:
  with pkgs;
  let defaultAttrs = {
    builder = "${bash}/bin/bash";
    args = [ ./ ];
    baseInputs = [ gnutar gzip gnumake gcc binutils-unwrapped coreutils gawk gnused gnugrep gnum4 ];
    buildInputs = [];
    system = builtins.currentSystem;
  derivation (defaultAttrs // attrs)

How best to troubleshoot this type of error in future?



Use stdenv.mkDerivation instead; it will set up a working build environment for you (see the doc for what it contains, pretty sure a C compiler is already in there).

Nearly all packages in nixpkgs use this and its derived functions to build derivations, if you need examples, look there.

I’ve not used the derivation function much myself, but I think the problem here is most likely that /bin/sh isn’t set up correctly in the sandbox, or some library required for it isn’t accessed correctly. The sandbox is hard to configure manually, which is why you should use the nixpkgs lib, unless you’re writing a distro from scratch - in which case you should probably define your own stdenv before packaging anything.

This is also why I wouldn’t recommend the nix pills for a beginner, they show off a lot of things a beginner shouldn’t worry about, while covering few of the practical packaging things :wink:


Wow, that was easy. This is the final answer, if any other beginner is curious…

with import <nixpkgs> {};

stdenv.mkDerivation {
  name = "udpcast";
  buildInputs = [ gnum4 perl ];

  src = fetchurl {
    url = "";
    sha256 = "a3cebee7a87ecf1bca0645f125be78fbd7b37846a4da82fecef96b92cc64d050";