I’m trying to compile the following C++ program:
#include <iostream>
#include <optional>
int main() {}
I’m on NixOs 23.05 with the following shell:
# default.nix
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "cdev"; # Probably put a more meaningful name here
nativeBuildInputs = [ gnat boost stdenv glibc libcxx ];
buildInputs = [ gnat boost stdenv glibc libcxx ];
}
However, when I try to compile the C++ file, I get the following errors:
In file included from /nix/store/6z13b1vgvrw4kav1b9dh6ap4r101g5xq-gnat-12.2.0/include/c++/12.2.0/ext/string_conversions.h:41,
from /nix/store/6z13b1vgvrw4kav1b9dh6ap4r101g5xq-gnat-12.2.0/include/c++/12.2.0/bits/basic_string.h:3960,
from /nix/store/6z13b1vgvrw4kav1b9dh6ap4r101g5xq-gnat-12.2.0/include/c++/12.2.0/string:53,
from /nix/store/6z13b1vgvrw4kav1b9dh6ap4r101g5xq-gnat-12.2.0/include/c++/12.2.0/bits/locale_classes.h:40,
from /nix/store/6z13b1vgvrw4kav1b9dh6ap4r101g5xq-gnat-12.2.0/include/c++/12.2.0/bits/ios_base.h:41,
from /nix/store/6z13b1vgvrw4kav1b9dh6ap4r101g5xq-gnat-12.2.0/include/c++/12.2.0/ios:42,
from /nix/store/6z13b1vgvrw4kav1b9dh6ap4r101g5xq-gnat-12.2.0/include/c++/12.2.0/ostream:38,
from /nix/store/6z13b1vgvrw4kav1b9dh6ap4r101g5xq-gnat-12.2.0/include/c++/12.2.0/iostream:39,
from test.cpp:1:
/nix/store/6z13b1vgvrw4kav1b9dh6ap4r101g5xq-gnat-12.2.0/include/c++/12.2.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
75 | #include_next <stdlib.h>
| ^~~~~~~~~~
compilation terminated.
It seems like glibc is missing, but it was explicitly installed in the shell. Is there something I’ve neglected to consider? Thanks in advance!