When running make check after ./bootstrap and ./configure many tests fail to run on NixOS.
Example failure log excerpt:
FAIL: check-globals.sh
======================
../../test-driver: ./check-globals.sh: /bin/bash: bad interpreter: No such file or directory
FAIL check-globals.sh (exit status: 126)
This issue is caused by the scripts wrongly assuming that bash is at /bin/bash. This is not the case for all unix operating systems. The solution for that is to use /usr/bin/env bash instead of hardcoding the path, because the former finds the bash executable in user's PATH, wherever it may be.
Steps to reproduce on NixOS with flakes enabled:
git clone https://github.com/OpenDataPlane/odp.git && cd odp
nix flake init
- replace contents of
./flake.nix with the following
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs =
{ self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
};
in
{
devShells.${system} = {
default = pkgs.mkShell {
packages = with pkgs; [
libtool
automake
autoconf
asciidoctor
mscgen
cunit
graphviz
valgrind
libcli
pkg-config
libconfig
libpcap
openssl
doxygen
onnxruntime
binutils
gcc
];
NIX_ENFORCE_NO_NATIVE = 0;
};
};
};
}
- Enter nix shell using
nix develop, then
./bootstrap
./configure
make check
- You will get the said error
When running
make checkafter./bootstrapand./configuremany tests fail to run on NixOS.Example failure log excerpt:
This issue is caused by the scripts wrongly assuming that
bashis at/bin/bash. This is not the case for all unix operating systems. The solution for that is to use/usr/bin/env bashinstead of hardcoding the path, because the former finds thebashexecutable in user'sPATH, wherever it may be.Steps to reproduce on NixOS with flakes enabled:
git clone https://github.com/OpenDataPlane/odp.git && cd odpnix flake init./flake.nixwith the followingnix develop, then