Trouble in building c++ environment


#1

Hi everyone !

I am currently a developer for the Societé des arts technologiques in Montreal. We working on open-sourced tools used by several artists and I have suggested to use the nix package manager in order to package our software. I am attempting to add Shmdata, Switcher and Scenic to nixpkgs but I have some trouble with the c++ linker (with Switcher).

I have forked Nixpkgs into our own repositories and I have added Shmdata and Switcher. The CMake process works fine but I have trouble during the compilation :

-- Build files have been written to: /build/switcher/build
cmake: enabled parallel building
building
build flags: -j1 -l1 SHELL=/nix/store/r47p5pzx52m3n34vdgqpk5rvqgm0m24m-bash-4.4-p23/bin/bash
Scanning dependencies of target switcher-1.0
[  1%] Building CXX object switcher/CMakeFiles/switcher-1.0.dir/audio-caps.cpp.o
In file included from /nix/store/6qmfmricr58bjivgr16y9sjisakdykag-gcc-7.3.0/include/c++/7.3.0/ext/string_conversions.h:41:0,
                 from /nix/store/6qmfmricr58bjivgr16y9sjisakdykag-gcc-7.3.0/include/c++/7.3.0/bits/basic_string.h:6349,
                 from /nix/store/6qmfmricr58bjivgr16y9sjisakdykag-gcc-7.3.0/include/c++/7.3.0/string:52,
                 from /build/switcher/switcher/./audio-caps.hpp:23,
                 from /build/switcher/switcher/audio-caps.cpp:20:
/nix/store/6qmfmricr58bjivgr16y9sjisakdykag-gcc-7.3.0/include/c++/7.3.0/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
               ^~~~~~~~~~
compilation terminated.
make[2]: *** [switcher/CMakeFiles/switcher-1.0.dir/build.make:63: switcher/CMakeFiles/switcher-1.0.dir/audio-caps.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:155: switcher/CMakeFiles/switcher-1.0.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

I have found some issues about libcstd++ but I don’t know if it is really an issue in my case.

In order to reproduce my issue, you can use my fork of nixpkgs and then just build switcher nix-build -A switcher.

Thanks :wink:


#2

Looks similar to

  1. https://github.com/NixOS/nixpkgs/pull/28748
  2. https://github.com/NixOS/nixpkgs/commit/29950fe57b92fc53a7682e58a352a2dce7d6321b

Try removing glibc from the buildInputs of the derivation?


#3

oh yeah, it does the trick !
thank you very much