Aarch64-darwin C++ <cstddef> not found

I created the following flake to compile a C++23 project, using vcpkg to pull boost-log. I used nix develop --unset PATH to access the dev shell and compile, but I keep getting that cstddef is not found. I created a minimal repository here. How should I go about this?

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  };
  outputs =
    { self, nixpkgs }:
    let
      system = "aarch64-darwin";
      pkgs = import nixpkgs {
        inherit system;
      };
    in
    {
      devShells.${system}.default = pkgs.mkShell {
        buildInputs = with pkgs; [
          apple-sdk_15
        ];
        nativeBuildInputs = with pkgs; [
          autoconf
          autoconf-archive
          automake
          cmake
          ninja
          pkg-config
          vcpkg
        ];
        shellHook = ''
          export VCPKG_ROOT=${pkgs.vcpkg}/share/vcpkg
          export VCPKG_FORCE_SYSTEM_BINARIES=1
        '';
      };
    };
}
FAILED: CMakeFiles/exe_test.dir/src/main.cpp.o.ddi
"/nix/store/2rij3brrzn54mzd82hs496cqxdx82n2f-clang-19.1.7/bin/clang-scan-deps" -format=p1689 -- clang++ -DBOOST_ATOMIC_NO_LIB -DBOOST_ATOMIC_STATIC_LINK -DBOOST_CHRONO_NO_LIB -DBOOST_CHRONO_STATIC_LINK -DBOOST_CONTAINER_NO_LIB -DBOOST_CONTAINER_STATIC_LINK -DBOOST_DATE_TIME_NO_LIB -DBOOST_DATE_TIME_STATIC_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_FILESYSTEM_STATIC_LINK=1 -DBOOST_LOG_NO_LIB -DBOOST_LOG_STATIC_LINK -DBOOST_SERIALIZATION_NO_LIB -DBOOST_SERIALIZATION_STATIC_LINK -DBOOST_THREAD_NO_LIB -DBOOST_THREAD_STATIC_LINK -DBOOST_THREAD_USE_LIB -I/Users/denniseum/Projects/internal/nixclang/src -isystem /Users/denniseum/Projects/internal/nixclang/build/vcpkg_installed/arm64-osx/include -g -std=c++23 -isysroot /nix/store/lwvpvq4ahba5y5l3zf58wj4llay4cq7v-apple-sdk-15.2/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -x c++ /Users/denniseum/Projects/internal/nixclang/src/main.cpp -c -o CMakeFiles/exe_test.dir/src/main.cpp.o -resource-dir "/nix/store/5qawh29l2yhzj0l9a7ybbb3nzwkpis4a-clang-wrapper-19.1.7/resource-root" -MT CMakeFiles/exe_test.dir/src/main.cpp.o.ddi -MD -MF CMakeFiles/exe_test.dir/src/main.cpp.o.ddi.d > CMakeFiles/exe_test.dir/src/main.cpp.o.ddi.tmp && mv CMakeFiles/exe_test.dir/src/main.cpp.o.ddi.tmp CMakeFiles/exe_test.dir/src/main.cpp.o.ddi
Error while scanning dependencies for /Users/denniseum/Projects/internal/nixclang/src/main.cpp:
In file included from /Users/denniseum/Projects/internal/nixclang/src/main.cpp:1:
/Users/denniseum/Projects/internal/nixclang/build/vcpkg_installed/arm64-osx/include/boost/log/trivial.hpp:18:10: fatal error: 'cstddef' file not found
ninja: build stopped: subcommand failed.

There’s a related issue: `llvmPackages_17.clang`: `clang` 17 cannot locate C++ std headers · Issue #273875 · NixOS/nixpkgs · GitHub. You can work around the clang-scan-deps issue by adding llvmPackages.clang-tools to your nativeBuildInputs.

1 Like