NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.28k stars 14.27k forks source link

Unable to build monado #137245

Closed georgewsinger closed 3 years ago

georgewsinger commented 3 years ago

Problem. On nixos-unstable, attempting to install monado (latest PR; latest nix expression) yields:

$ nix-env -iA nixos.monado
# ..
[ 78%] Building C object src/xrt/state_trackers/oxr/CMakeFiles/st_oxr.dir/oxr_swapchain_gl.c.o
[ 79%] Building C object src/xrt/state_trackers/oxr/CMakeFiles/st_oxr.dir/oxr_session_egl.c.o
[ 79%] Linking CXX static library libst_oxr.a
[ 79%] Built target st_oxr
In file included from /nix/store/iwd8ic5hhwdxn5dga0im55g5hjl270cd-glibc-2.33-47-dev/include/string.h:519,
                 from /nix/store/dlni53myj53kx20pi4yhm7p68lw17b07-gcc-10.3.0/include/c++/10.3.0/cstring:42,
                 from /build/source/src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp:11:
In function 'char* strncpy(char*, const char*, size_t)',
    inlined from 'CDeviceDriver_Monado_Controller::CDeviceDriver_Monado_Controller(xrt_instance*, xrt_device*, xrt_hand)' at /build/source/src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp:156:10:
/nix/store/iwd8ic5hhwdxn5dga0im55g5hjl270cd-glibc-2.33-47-dev/include/bits/string_fortified.h:95:34: warning: 'char* __builtin_strncpy(char*, const char*, long unsigned int)' specified bound 256 equals destination size [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-truncation-Wstringop-truncation8;;]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   96 |       __glibc_objsize (__dest));
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'char* strncpy(char*, const char*, size_t)',
    inlined from 'CDeviceDriver_Monado_Controller::CDeviceDriver_Monado_Controller(xrt_instance*, xrt_device*, xrt_hand)' at /build/source/src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp:157:10:
/nix/store/iwd8ic5hhwdxn5dga0im55g5hjl270cd-glibc-2.33-47-dev/include/bits/string_fortified.h:95:34: warning: 'char* __builtin_strncpy(char*, const char*, long unsigned int)' specified bound 256 equals destination size [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-truncation-Wstringop-truncation8;;]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   96 |       __glibc_objsize (__dest));
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'char* strncpy(char*, const char*, size_t)',
    inlined from 'CDeviceDriver_Monado_Controller::CDeviceDriver_Monado_Controller(xrt_instance*, xrt_device*, xrt_hand)' at /build/source/src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp:159:10:
/nix/store/iwd8ic5hhwdxn5dga0im55g5hjl270cd-glibc-2.33-47-dev/include/bits/string_fortified.h:95:34: warning: 'char* __builtin_strncpy(char*, const char*, long unsigned int)' specified bound 256 equals destination size [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-truncation-Wstringop-truncation8;;]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   96 |       __glibc_objsize (__dest));
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~
In function 'char* strncpy(char*, const char*, size_t)',
    inlined from 'CDeviceDriver_Monado_Controller::CDeviceDriver_Monado_Controller(xrt_instance*, xrt_device*, xrt_hand)' at /build/source/src/xrt/state_trackers/steamvr_drv/ovrd_driver.cpp:160:10:
/nix/store/iwd8ic5hhwdxn5dga0im55g5hjl270cd-glibc-2.33-47-dev/include/bits/string_fortified.h:95:34: warning: 'char* __builtin_strncpy(char*, const char*, long unsigned int)' specified bound 256 equals destination size [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-truncation-Wstringop-truncation8;;]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   96 |       __glibc_objsize (__dest));
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~
[ 80%] Linking CXX static library libst_ovrd.a
[ 80%] Built target st_ovrd
[ 81%] Linking CXX static library libaux_tracking.a
[ 81%] Built target aux_tracking
[ 82%] Linking CXX static library libst_gui.a
[ 82%] Built target st_gui
make: *** [Makefile:149: all] Error 2
builder for '/nix/store/kqrn3v2z1nhx4fq9308hwkcm3b5vdhf7-monado-21.0.0.drv' failed with exit code 2
error: build of '/nix/store/kqrn3v2z1nhx4fq9308hwkcm3b5vdhf7-monado-21.0.0.drv' failed

Forked monado code (against latest/bleeding edge commit) yields a more informative compilation error.

I forked monado in SimulaVR/monado, and slightly altered this nix expression to get it to compile. The relevant files:

The compilation error then becomes more subtantial/informative:

[ 89%] Building C object src/xrt/drivers/CMakeFiles/drv_survive.dir/survive/survive_driver.c.o
[ 89%] Building C object src/xrt/drivers/CMakeFiles/drv_vive.dir/vive/vive_protocol.c.o
[ 89%] Linking CXX static library libst_prober.a
[ 89%] Built target st_prober
[ 90%] Linking CXX static library libdrv_psmv.a
/build/monado/src/xrt/drivers/survive/survive_driver.c: In function '_process_button_event':
/build/monado/src/xrt/drivers/survive/survive_driver.c:623:51: error: 'const struct SurviveSimpleButtonEvent' has no member named 'time'
  623 |  timepoint_ns ts = survive_timecode_to_monotonic(e->time);
      |                                                   ^~
/build/monado/src/xrt/drivers/survive/survive_driver.c: At top level:
/build/monado/src/xrt/drivers/survive/survive_driver.c:728:52: warning: 'struct SurviveSimpleConfigEvent' declared inside parameter list will not be visible outside of this definition or declaration
  728 | add_device(struct survive_system *ss, const struct SurviveSimpleConfigEvent *e);
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~~~
/build/monado/src/xrt/drivers/survive/survive_driver.c:731:66: warning: 'struct SurviveSimplePoseUpdatedEvent' declared inside parameter list will not be visible outside of this definition or declaration
  731 | _process_pose_event(struct survive_device *survive, const struct SurviveSimplePoseUpdatedEvent *e)
      |                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/monado/src/xrt/drivers/survive/survive_driver.c: In function '_process_pose_event':
/build/monado/src/xrt/drivers/survive/survive_driver.c:733:21: error: invalid use of undefined type 'const struct SurviveSimplePoseUpdatedEvent'
  733 |  pose_to_relation(&e->pose, &e->velocity, &survive->last_relation);
      |                     ^~
/build/monado/src/xrt/drivers/survive/survive_driver.c:733:31: error: invalid use of undefined type 'const struct SurviveSimplePoseUpdatedEvent'
  733 |  pose_to_relation(&e->pose, &e->velocity, &survive->last_relation);
      |                               ^~
/build/monado/src/xrt/drivers/survive/survive_driver.c:734:61: error: invalid use of undefined type 'const struct SurviveSimplePoseUpdatedEvent'
  734 |  survive->last_relation_ts = survive_timecode_to_monotonic(e->time);
      |                                                             ^~
/build/monado/src/xrt/drivers/survive/survive_driver.c: In function '_process_event':
/build/monado/src/xrt/drivers/survive/survive_driver.c:760:7: error: 'SurviveSimpleEventType_ConfigEvent' undeclared (first use in this function); did you mean 'SurviveSimpleEventType_ButtonEvent'?
  760 |  case SurviveSimpleEventType_ConfigEvent: {
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |       SurviveSimpleEventType_ButtonEvent
/build/monado/src/xrt/drivers/survive/survive_driver.c:760:7: note: each undeclared identifier is reported only once for each function it appears in
/build/monado/src/xrt/drivers/survive/survive_driver.c:761:46: error: implicit declaration of function 'survive_simple_get_config_event'; did you mean 'survive_simple_get_button_event'? [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration-Werror=implicit-function-declaration8;;]
  761 |   const struct SurviveSimpleConfigEvent *e = survive_simple_get_config_event(event);
      |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                              survive_simple_get_button_event
/build/monado/src/xrt/drivers/survive/survive_driver.c:761:46: error: initialization of 'const struct SurviveSimpleConfigEvent *' from 'int' makes pointer from integer without a cast [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wint-conversion-Werror=int-conversion8;;]
/build/monado/src/xrt/drivers/survive/survive_driver.c:762:69: error: invalid use of undefined type 'const struct SurviveSimpleConfigEvent'
  762 |   enum SurviveSimpleObject_type t = survive_simple_object_get_type(e->object);
      |                                                                     ^~
/build/monado/src/xrt/drivers/survive/survive_driver.c:763:50: error: invalid use of undefined type 'const struct SurviveSimpleConfigEvent'
  763 |   const char *name = survive_simple_object_name(e->object);
      |                                                  ^~
/build/monado/src/xrt/drivers/survive/survive_driver.c:765:18: error: passing argument 2 of 'add_device' from incompatible pointer type [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wincompatible-pointer-types-Werror=incompatible-pointer-types8;;]
  765 |   add_device(ss, e);
      |                  ^
      |                  |
      |                  const struct SurviveSimpleConfigEvent *
/build/monado/src/xrt/drivers/survive/survive_driver.c:728:78: note: expected 'const struct SurviveSimpleConfigEvent *' but argument is of type 'const struct SurviveSimpleConfigEvent *'
  728 | add_device(struct survive_system *ss, const struct SurviveSimpleConfigEvent *e);
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/build/monado/src/xrt/drivers/survive/survive_driver.c:768:7: error: 'SurviveSimpleEventType_PoseUpdateEvent' undeclared (first use in this function); did you mean 'SurviveSimpleEventType_ButtonEvent'?
  768 |  case SurviveSimpleEventType_PoseUpdateEvent: {
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |       SurviveSimpleEventType_ButtonEvent
/build/monado/src/xrt/drivers/survive/survive_driver.c:769:51: error: implicit declaration of function 'survive_simple_get_pose_updated_event'; did you mean 'survive_simple_get_button_event'? [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration-Werror=implicit-function-declaration8;;]
  769 |   const struct SurviveSimplePoseUpdatedEvent *e = survive_simple_get_pose_updated_event(event);
      |                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                   survive_simple_get_button_event
/build/monado/src/xrt/drivers/survive/survive_driver.c:769:51: error: initialization of 'const struct SurviveSimplePoseUpdatedEvent *' from 'int' makes pointer from integer without a cast [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wint-conversion-Werror=int-conversion8;;]
/build/monado/src/xrt/drivers/survive/survive_driver.c:771:67: error: invalid use of undefined type 'const struct SurviveSimplePoseUpdatedEvent'
  771 |   struct survive_device *event_device = get_device_by_object(ss, e->object);
      |                                                                   ^~
/build/monado/src/xrt/drivers/survive/survive_driver.c:777:37: error: passing argument 2 of '_process_pose_event' from incompatible pointer type [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wincompatible-pointer-types-Werror=incompatible-pointer-types8;;]
  777 |   _process_pose_event(event_device, e);
      |                                     ^
      |                                     |
      |                                     const struct SurviveSimplePoseUpdatedEvent *
/build/monado/src/xrt/drivers/survive/survive_driver.c:731:97: note: expected 'const struct SurviveSimplePoseUpdatedEvent *' but argument is of type 'const struct SurviveSimplePoseUpdatedEvent *'
  731 | _process_pose_event(struct survive_device *survive, const struct SurviveSimplePoseUpdatedEvent *e)
      |                                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
/build/monado/src/xrt/drivers/survive/survive_driver.c:780:7: error: 'SurviveSimpleEventType_DeviceAdded' undeclared (first use in this function); did you mean 'SurviveSimpleEventType_None'?
  780 |  case SurviveSimpleEventType_DeviceAdded: {
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |       SurviveSimpleEventType_None
/build/monado/src/xrt/drivers/survive/survive_driver.c: At top level:
/build/monado/src/xrt/drivers/survive/survive_driver.c:1157:52: warning: 'struct SurviveSimpleConfigEvent' declared inside parameter list will not be visible outside of this definition or declaration
 1157 | add_device(struct survive_system *ss, const struct SurviveSimpleConfigEvent *e)
      |                                                    ^~~~~~~~~~~~~~~~~~~~~~~~
/build/monado/src/xrt/drivers/survive/survive_driver.c:1157:1: error: conflicting types for 'add_device'
 1157 | add_device(struct survive_system *ss, const struct SurviveSimpleConfigEvent *e)
      | ^~~~~~~~~~
/build/monado/src/xrt/drivers/survive/survive_driver.c:728:1: note: previous declaration of 'add_device' was here
  728 | add_device(struct survive_system *ss, const struct SurviveSimpleConfigEvent *e);
      | ^~~~~~~~~~
/build/monado/src/xrt/drivers/survive/survive_driver.c: In function 'add_device':
/build/monado/src/xrt/drivers/survive/survive_driver.c:1159:37: error: invalid use of undefined type 'const struct SurviveSimpleConfigEvent'
 1159 |  struct SurviveSimpleObject *sso = e->object;
      |                                     ^~
/build/monado/src/xrt/drivers/survive/survive_driver.c:1165:27: error: implicit declaration of function 'survive_simple_json_config'; did you mean 'survive_simple_is_running'? [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration-Werror=implicit-function-declaration8;;]
 1165 |  char *conf_str = (char *)survive_simple_json_config(sso);
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                           survive_simple_is_running
/build/monado/src/xrt/drivers/survive/survive_driver.c:1165:19: warning: cast to pointer from integer of different size [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wint-to-pointer-cast-Wint-to-pointer-cast8;;]
 1165 |  char *conf_str = (char *)survive_simple_json_config(sso);
      |                   ^
[ 90%] Built target drv_psmv
/build/monado/src/xrt/drivers/survive/survive_driver.c: In function 'add_connected_devices':
/build/monado/src/xrt/drivers/survive/survive_driver.c:1230:28: error: 'SurviveSimpleEventType_ConfigEvent' undeclared (first use in this function); did you mean 'SurviveSimpleEventType_ButtonEvent'?
 1230 |    if (event.event_type == SurviveSimpleEventType_ConfigEvent) {
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                            SurviveSimpleEventType_ButtonEvent
/build/monado/src/xrt/drivers/survive/survive_driver.c: In function 'run_event_thread':
/build/monado/src/xrt/drivers/survive/survive_driver.c:1262:3: error: implicit declaration of function 'survive_simple_wait_for_event'; did you mean 'survive_simple_wait_for_update'? [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-function-declaration-Werror=implicit-function-declaration8;;]
 1262 |   survive_simple_wait_for_event(ss->ctx, &event);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |   survive_simple_wait_for_update
/build/monado/src/xrt/drivers/survive/survive_driver.c: In function 'survive_device_autoprobe':
/build/monado/src/xrt/drivers/survive/survive_driver.c:1376:7: warning: variable 'found_controllers' set but not used [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-but-set-variable-Wunused-but-set-variable8;;]
 1376 |  bool found_controllers = false;
      |       ^~~~~~~~~~~~~~~~~
/build/monado/src/xrt/drivers/survive/survive_driver.c: At top level:
/build/monado/src/xrt/drivers/survive/survive_driver.c:728:1: warning: 'add_device' used but never defined
  728 | add_device(struct survive_system *ss, const struct SurviveSimpleConfigEvent *e);
      | ^~~~~~~~~~
/build/monado/src/xrt/drivers/survive/survive_driver.c:1157:1: warning: 'add_device' defined but not used [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-function-Wunused-function8;;]
 1157 | add_device(struct survive_system *ss, const struct SurviveSimpleConfigEvent *e)
      | ^~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [src/xrt/drivers/CMakeFiles/drv_survive.dir/build.make:82: src/xrt/drivers/CMakeFiles/drv_survive.dir/survive/survive_driver.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1397: src/xrt/drivers/CMakeFiles/drv_survive.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 90%] Linking CXX static library libdrv_vive.a
[ 90%] Built target drv_vive
[ 90%] Linking CXX static library libdrv_euroc.a
[ 90%] Built target drv_euroc
[ 91%] Linking CXX static library libst_gui.a
[ 91%] Built target st_gui
make: *** [Makefile:149: all] Error 2
builder for '/nix/store/7al08y308l1p8nm9svgyl455bnhg90c2-monado-21.0.0.drv' failed with exit code 2
error: build of '/nix/store/7al08y308l1p8nm9svgyl455bnhg90c2-monado-21.0.0.drv' failed

This first error is also reproduced if we download the monado source pinned at v21, and run it against the nix expressions linked to above:

$ wget https://gitlab.freedesktop.org/monado/monado/-/archive/v21.0.0/monado-v21.0.0.tar.gz
$ tar -xvf monado-v21.0.0.tar.gz
$ cd monado-v21.0.0

# ...add monado.nix and default.nix as in
# link1
# link2

$ nix-build default.nix
# ...
[ 83%] Linking CXX static library libst_gui.a
[ 83%] Built target st_gui
make: *** [Makefile:149: all] Error 2
builder for '/nix/store/gxy8mcvvn7sis961gqm9ksndpc98f4d5-monado-21.0.0.drv' failed with exit code 2
error: build of '/nix/store/gxy8mcvvn7sis961gqm9ksndpc98f4d5-monado-21.0.0.drv' failed

Maintainers.

@prusnak @SuperSandro2000 @Profpatsch @expipiplus1

Metadata.

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.62, NixOS, 21.11 (Porcupine)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.15`
 - channels(george): `""`
 - channels(root): `"nixos-21.11pre313466.bc06c93905f"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
SuperSandro2000 commented 3 years ago

Not sure why you pinged me but this looks like an error which could be caused by a library or gcc update.

expipiplus1 commented 3 years ago

Looks like it was fixed in April, but there's been no release since then. The recent vulkan headers bump must have done this.

tree 02e27c467d87ef1c8fc4ada5966990f1cefbc53a
parent b9b72280bf6a437f9b431f8002d3b54751bf3e12
author Christoph Haag <christoph.haag@collabora.com> Mon Apr 19 13:04:59 2021 +0200
committer Christoph Haag <christoph.haag@collabora.com> Mon Apr 19 13:04:59 2021 +0200

comp: Fix warning after Vulkan 1.2.174 VK_NULL_HANDLE change

../src/xrt/compositor/main/comp_layer_renderer.c:317:17: warning: initialization of 'unsigned int' from 'void *' makes integer from pointer without a cast [-Wint-conversion]
  317 |      .subpass = VK_NULL_HANDLE,
      |                 ^~~~~~~~~~~~~~

diff --git a/src/xrt/compositor/main/comp_layer_renderer.c b/src/xrt/compositor/main/comp_layer_renderer.c
index c59232a9..d8a0a632 100644
--- a/src/xrt/compositor/main/comp_layer_renderer.c
+++ b/src/xrt/compositor/main/comp_layer_renderer.c
@@ -314,7 +314,7 @@ _init_graphics_pipeline(struct comp_layer_renderer *self,
                        VK_DYNAMIC_STATE_SCISSOR,
                    },
            },
-       .subpass = VK_NULL_HANDLE,
+       .subpass = 0,
    };

    VkResult res;
prusnak commented 3 years ago

PR with the proposed fix in https://github.com/NixOS/nixpkgs/pull/144086