Need help with building Huestacean project with cmake and Qt

Hello, I am trying to build Huestacean project which uses Qt and should be built with cmake. But I run into issues that I am unable to get past. I am using nixos-unstable channel as nixpkgs. My first attempt was this:

nix-shell -p qt5Full -p cmake --pure

which resulted in

[nix-shell:~/pgm/qt/huestacean/build]$ cmake ..
CMake Error at /nix/store/56ylm54229k8wr05mn1rj0wkssb1hg95-qt-full-5.15.2/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:9 (message):
  Failed to find "GL/gl.h" in
  "/nix/store/m07ifas9wwf5j7bhlj9js6zbqbk142qr-mesa-20.3.3-dev/include".
Call Stack (most recent call first):
  /nix/store/56ylm54229k8wr05mn1rj0wkssb1hg95-qt-full-5.15.2/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:229 (include)
  /nix/store/56ylm54229k8wr05mn1rj0wkssb1hg95-qt-full-5.15.2/lib/cmake/Qt5Quick/Qt5QuickConfig.cmake:97 (find_package)
  CMakeLists.txt:28 (find_package)

-- Configuring incomplete, errors occurred!

So I checked the path:

% ll /nix/store/m07ifas9wwf5j7bhlj9js6zbqbk142qr-mesa-20.3.3-dev/include/GL
celkem 24
dr-xr-xr-x  3 root root  4096  1. led  1970 .
dr-xr-xr-x  6 root root  4096  1. led  1970 ..
dr-xr-xr-x  2 root root  4096  1. led  1970 internal
-r--r--r-- 18 root root 10360  1. led  1970 osmesa.h

and no “GL/gl.h” header is there. So I looked at /nix/store/56ylm54229k8wr05mn1rj0wkssb1hg95-qt-full-5.15.2/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake why that header is looked for at such place.

4 set(_GL_INCDIRS "/nix/store/m07ifas9wwf5j7bhlj9js6zbqbk142qr-mesa-20.3.3-dev/include")
5 find_path(_qt5gui_OPENGL_INCLUDE_DIR GL/gl.h
6     PATHS ${_GL_INCDIRS}
7 )
8 if (NOT _qt5gui_OPENGL_INCLUDE_DIR)
9     message(FATAL_ERROR "Failed to find \"GL/gl.h\" in \"${_GL_INCDIRS}\".")
10 endif()
11 unset(_GL_INCDIRS)

It seems that path is hardcoded here, I don’t know why it is wrong path.
So I thought “Well, QT 5.15.2 is broken, so I will try other version”.
Now it gets even more interesting (well, I don’t know if I am doing this right).

% nix-shell -E 'with import <nixpkgs> { }; runCommand "dummy" { buildInputs = [ (libsForQt512.callPackage ~/.nix-defexpr/channels/nixpkgs/pkgs/development/tools/build-managers/cmake { }) qt512.full ]; } ""' --pure
[nix-shell:~/pgm/qt/huestacean/build]$ cmake ..
CMake Error at /nix/store/56ylm54229k8wr05mn1rj0wkssb1hg95-qt-full-5.15.2/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:9 (message):
  Failed to find "GL/gl.h" in
  "/nix/store/m07ifas9wwf5j7bhlj9js6zbqbk142qr-mesa-20.3.3-dev/include".
Call Stack (most recent call first):
  /nix/store/56ylm54229k8wr05mn1rj0wkssb1hg95-qt-full-5.15.2/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:229 (include)
  /nix/store/56ylm54229k8wr05mn1rj0wkssb1hg95-qt-full-5.15.2/lib/cmake/Qt5Quick/Qt5QuickConfig.cmake:97 (find_package)
  CMakeLists.txt:28 (find_package)

-- Configuring incomplete, errors occurred!

I thought that this will use cmake with Qt 5.12. It did not. So I thought that I should not use unstable channel and tried to use my system channel, which is nixos-20.09, but it didn’t went well.

% nix-shell "<nixos>" -p qt5Full -p cmake --pure
[nix-shell:~/pgm/qt/huestacean/build]$ cmake ..
CMake Error at /nix/store/56ylm54229k8wr05mn1rj0wkssb1hg95-qt-full-5.15.2/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:9 (message):
  Failed to find "GL/gl.h" in
  "/nix/store/m07ifas9wwf5j7bhlj9js6zbqbk142qr-mesa-20.3.3-dev/include".
Call Stack (most recent call first):
  /nix/store/56ylm54229k8wr05mn1rj0wkssb1hg95-qt-full-5.15.2/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:229 (include)
  /nix/store/56ylm54229k8wr05mn1rj0wkssb1hg95-qt-full-5.15.2/lib/cmake/Qt5Quick/Qt5QuickConfig.cmake:97 (find_package)
  CMakeLists.txt:28 (find_package)

-- Configuring incomplete, errors occurred!

So I am hitting the same error again and again and don’t know how to resolve this. Can anybody point me in the right direction? Thank you.

2 Likes