Trying to build ALVR (again): 'stdbool.h' not found

Hi! Since the version of ALVR on nixpkgs is out of date and they’re not supplying an appimage anymore, I’m trying to build ALVR again. I think I’m almost there, but I’m currently stuck on this stupid error when building:

  --- stderr
  /nix/store/9yy7xs00m97wrr1fj9bh2x4zmh4kfbvw-pipewire-1.2.3-dev/include/pipewire-0.3/pipewire/version.h:14:10: fatal error: 'stdbool.h' file not found
  thread 'main' panicked at /tmp/nix-shell.7BFMgj/tmp.FAjH2fmqEa/cargo-vendor-dir/libspa-sys-0.8.0/build.rs:46:39:
  Unable to generate bindings: ClangDiagnostic("/nix/store/9yy7xs00m97wrr1fj9bh2x4zmh4kfbvw-pipewire-1.2.3-dev/include/pipewire-0.3/pipewire/version.h:14:10: fatal error: 'stdbool.h' file not 
und\n")

I’m guessing that pipewire is built and can’t find the standard C-headers. But I’ve not succeeded in supplying those. They are in my nix store. But I couldn’t supply them yet. :confused:

Here’s my current default.nix file (note that it’s still WIP):

{ stdenv, pkgs, lib,...}:
pkgs.rustPlatform.buildRustPackage (let 
  version = "20.10.0"; 
in rec {
  buildInputs = with pkgs; [
    clang
    libclang
    curl
    nasm
    yasm
    pkgconf
    build2
    vulkan-headers
    libva
    unzip
    ffmpeg
    x264
    dbus
    openssl 
    pipewire
    jack2
    alsa-lib
    glib
  ];
  nativeBuildInput = with pkgs; [ 
    rustup
    pkg-config 
  ] ++ pkgs.pipewire.buildInputs;
  inputsFrom = with pkgs; [ openssl ];
  pname = "alvr-git";
  inherit version;

  src = pkgs.fetchFromGitHub {
    owner = "alvr-org";
    repo = "ALVR";
    rev = "v${version}";
    hash = "sha256-2d5+9rxCpqgLMab7i1pLKaY1qSKRxzPI7pgh54rQBdg=";
    fetchSubmodules = true;
  };

  cargoLock = {
    lockFile = "${src}/Cargo.lock";
    allowBuiltinFetchGit = true;
  };

  buildPhase = /*bash*/ ''
    # NOTE: `prepare-deps` shouldn't be necessary, since should be able to fetch all that in the buildInputs

    # cargo xtask prepare-deps --platform linux # [--gpl] [--no-nvidia]

    cargo xtask build-streamer --release
  '';

  RUST_BACKTRACE=1;
  OPENSSL_DIR = with pkgs; "${openssl.dev}";
  OPENSSL_LIB_DIR = with pkgs; "${lib.getLib openssl}/lib";
  # PKG_CONFIG_PATH = with pkgs; "${openssl.dev}/lib/pkgconfig:${pipewire.dev}/lib/pkgconfig:${jack2.dev}/lib/pkgconfig";
  PKG_CONFIG_PATH = lib.strings.concatStringsSep ":" (
    map (l: "${l.dev}/lib/pkgconfig") (
      with pkgs; [ openssl pipewire jack2 alsa-lib ]
    )
  );

  LIBCLANG_PATH = with pkgs; "${lib.getLib libclang}/lib";

There’s a work in progress PR which successfully builds ALVR from source. In the thread there are also examples of building from their binary releases. You might have better luck building upon that. https://github.com/NixOS/nixpkgs/pull/308097

1 Like

add rustPlatform.bindgenHook to nativeBuildInputs.

1 Like

Dang, that’s convenient. Thanks fo pointing it out. :slight_smile:

@symphorien Thanks! I’ll remember that for the future! :slight_smile: