Stdlib.h: No such file or directory

I’m trying to build a fork of textadept, but I think this issue is more general. My shell.nix:

with (import <nixpkgs> {});
mkShell {
  buildInputs = [
    gtk2 ncurses glib glibc
  ];
}

When I try to build it, i get the following. I don’t think the messages about gtk±3.0 are a problem. What I’m trying to fix is the error about not being able to find stdlib.h.

$ make GTK2=1      
Package gtk+-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-3.0' found
g++ -Os -std=c++17 -pedantic -DSCI_LEXER -DNDEBUG -Iscintilla/include -Iscintilla/src -Ilexilla/include -Ilexilla/lexlib -Wall -DGTK -pthread -I/nix/store/bx37c5k341z2wyv2wcnhw1n4vffk27fg-gtk+-2.24.33-dev/include/gtk-2.0 -I/nix/store/49sn3dprhlsw698fj4y25yw6kxmjd5yg-gtk+-2.24.33/lib/gtk-2.0/include -I/nix/store/0a9b4bv93s2b94q0fa2h4r0m55qy92fx-glib-2.72.3-dev/include -I/nix/store/0a9b4bv93s2b94q0fa2h4r0m55qy92fx-glib-2.72.3-dev/include/glib-2.0 -I/nix/store/i4k2ahrb0rzr7f2ni02nljcffawvpqpg-glib-2.72.3/lib/glib-2.0/include -I/nix/store/vxkj5z9f1fb1vpygxxxpncy9x1aay4k7-cairo-1.16.0-dev/include/cairo -I/nix/store/ifapwp4j01rj1800abwq7xqc5ymr6cv6-freetype-2.12.1-dev/include/freetype2 -I/nix/store/ifapwp4j01rj1800abwq7xqc5ymr6cv6-freetype-2.12.1-dev/include -I/nix/store/lws03c473q66ppg7czngvfbdmsg39j1f-fontconfig-2.14.0-dev/include -I/nix/store/ifapwp4j01rj1800abwq7xqc5ymr6cv6-freetype-2.12.1-dev/include/freetype2 -I/nix/store/x61p9rbkrh362sl3xxzhw1qvnlklylam-pango-1.50.7-dev/include/pango-1.0 -I/nix/store/qpglawyvc4ybhqkkz368zlpq1gw00h44-harfbuzz-3.3.2-dev/include/harfbuzz -I/nix/store/v99pf1pni85bxccfn1yhy4fanq4idagw-gdk-pixbuf-2.42.8-dev/include/gdk-pixbuf-2.0 -I/nix/store/mkn4f22mpfk654j46r5644fvg73cxz82-atk-2.38.0-dev/include/atk-1.0 -c scintilla/gtk/PlatGTK.cxx -o PlatGTK.o
In file included from scintilla/gtk/PlatGTK.cxx:7:
/nix/store/zs6hnk47hcrrcrd885d66xmhlvp05jxm-gcc-11.3.0/include/c++/11.3.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
   75 | #include_next <stdlib.h>
      |               ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:92: PlatGTK.o] Error 1

Is there something else i need to add to buildInputs?

To make it a little simpler to diagnose, I got rid of the message about gtk±3.0.

✦ ❯ cat shell.nix
with (import <nixpkgs> {});
mkShell {
  buildInputs = [
    gtk2 gtk3 ncurses glib glibc pkg-config
  ];
}

✦ ❯ make                         
g++ -Os -std=c++17 -pedantic -DSCI_LEXER -DNDEBUG -Iscintilla/include -Iscintilla/src -Ilexilla/include -Ilexilla/lexlib -Wall -DGTK -pthread -I/nix/store/0a9b4bv93s2b94q0fa2h4r0m55qy92fx-glib-2.72.3-dev/include -I/nix/store/0a9b4bv93s2b94q0fa2h4r0m55qy92fx-glib-2.72.3-dev/include/glib-2.0 -I/nix/store/i4k2ahrb0rzr7f2ni02nljcffawvpqpg-glib-2.72.3/lib/glib-2.0/include -I/nix/store/vxkj5z9f1fb1vpygxxxpncy9x1aay4k7-cairo-1.16.0-dev/include/cairo -I/nix/store/ifapwp4j01rj1800abwq7xqc5ymr6cv6-freetype-2.12.1-dev/include/freetype2 -I/nix/store/ifapwp4j01rj1800abwq7xqc5ymr6cv6-freetype-2.12.1-dev/include -I/nix/store/x61p9rbkrh362sl3xxzhw1qvnlklylam-pango-1.50.7-dev/include/pango-1.0 -I/nix/store/qpglawyvc4ybhqkkz368zlpq1gw00h44-harfbuzz-3.3.2-dev/include/harfbuzz -I/nix/store/v99pf1pni85bxccfn1yhy4fanq4idagw-gdk-pixbuf-2.42.8-dev/include/gdk-pixbuf-2.0 -I/nix/store/mkn4f22mpfk654j46r5644fvg73cxz82-atk-2.38.0-dev/include/atk-1.0 -I/nix/store/qbvaw0nl5rvmwm6ljsmvq7ciazqvcd2j-gtk+3-3.24.34-dev/include/gtk-3.0 -Wno-deprecated-declarations -c scintilla/gtk/PlatGTK.cxx -o PlatGTK.o
In file included from scintilla/gtk/PlatGTK.cxx:7:
/nix/store/zs6hnk47hcrrcrd885d66xmhlvp05jxm-gcc-11.3.0/include/c++/11.3.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
   75 | #include_next <stdlib.h>
      |               ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:92: PlatGTK.o] Error 1

As discussed in Cstdlib can't find stdlib.h (simple example!)
you need to leave out glibc from buildInputs.

2 Likes