I’m trying to get clang
working with buildFHSEnv
. My ultimate goal is to use bazel
to build a cpp project. Bazel uses clang
to build the project. The project depends on openssl, sdbus-cpp and curl
installed on the system as libraries. This is my flake.nix so far
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {self, nixpkgs, flake-utils}:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs { inherit system;};
fhs = pkgs.buildFHSEnv {
name = "bazel-fhs-shell";
targetPkgs = pkgs: with pkgs; [
pkg-config
llvmPackages.libcxxClang
curl
systemd
sdbus-cpp
bazel_7
openssl
];
extraOutputsToInstall = ["dev"];
};
in with pkgs;
{
devShells.default = fhs.env;
}
);
}
When I try to build with this, I get errors like
...fatal error: 'atomic' file not found
45 | #include <atomic>
Afaik, atomic
is included in the std library so I think its an issue with the build environment ( I could be wrong since I’m kinda new to building C applications ). gcc
worked fine (meaning it doesn’t give errors for basic std library imports but fails due to unknown reasons. The project recommends using clang
so now I’m trying to use clang
instead of gcc, assuming the issue is with using gcc
instead of clang