That’s the error log of my cargo clippy inside a rust project:
Checking bevy_render v0.14.2
Checking matchers v0.1.0
Compiling alsa-sys v0.3.1
Compiling nix v0.29.0
error: failed to run custom build command for `alsa-sys v0.3.1`
Caused by:
process didn't exit successfully: `/home/azrael/projects/rust/bevy_app/target/debug/build/alsa-sys-174f5531b95e51b6/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=ALSA_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=ALSA_STATIC
cargo:rerun-if-env-changed=ALSA_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_STATIC
cargo:rerun-if-env-changed=PKG_CONFIG_ALL_DYNAMIC
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
--- stderr
thread 'main' panicked at /home/azrael/.cargo/registry/src/index.crates.io-6f17d22bba15001f/alsa-sys-0.3.1/build.rs:13:18:
pkg-config exited with status code 1
> PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags alsa
The system library `alsa` required by crate `alsa-sys` was not found.
The file `alsa.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
The PKG_CONFIG_PATH environment variable is not set.
HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `alsa.pc`.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
It might be too late for the original asker, but since this is likely to come up via search here are a few thoughts.
First for the alsa.pc (pkg-config) you want to use pkgs.alsa-lib.dev.
Second to get a working shell I prefer to define a flake with all the dependencies including LD_LIBRARY_PATH and use nix develop. For a simple ‘hello world’ bevy program that uses DefaultPlugins (and thus requires working GPU drivers among other libraries) the following flake has worked for me:
{
description = "Bevy-based hello world";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
oxalica.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, flake-utils, oxalica }:
with flake-utils.lib;
eachSystem allSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system}.extend oxalica.overlays.default;
in rec {
packages = {
bevy-program = let
rustPlatform = pkgs.makeRustPlatform {
cargo = pkgs.rust-bin.stable.latest.minimal;
rustc = pkgs.rust-bin.stable.latest.minimal;
};
in rustPlatform.buildRustPackage rec {
name = "bevy-hello-world";
src = self;
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [
alsa-lib.dev
udev.dev
xorg.libX11
xorg.libXrandr
xorg.libXcursor
xorg.libxcb
xorg.libXi
wayland
libxkbcommon
libxkbcommon.dev
vulkan-loader
vulkan-tools
glfw
xorg.xf86videoamdgpu # notice this line might not match your needs or desires
];
cargoLock = { lockFile = ./Cargo.lock; };
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
};
};
defaultPackage = packages.bevy-program;
formatter = pkgs.nixfmt;
});
}
The nix build . of the flake is slow as molasses even for rebuilds, but for development purposes we can work faster by using nix develop:
Projects/bevy-hello-world% nix develop
warning: Git tree '/home/tommd/Projects/bevy-hello-world' is dirty
[~/Projects/bevy-hello-world]$ cargo run
...