godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.99k stars 21.16k forks source link

Minimal Godot build fails to compile due navigation module problems #80401

Closed qarmin closed 1 year ago

qarmin commented 1 year ago

Godot version

4.2.dev f2acfb1ffc94d0e381064070108e7a773d86177d

System information

Ubuntu 22.04 CI

Issue description

https://github.com/qarmin/GodotBuilds/actions/runs/5790813978/job/15694543373#step:7:679

Command

scons dev_build=yes CCFLAGS="-fpie" LINKFLAGS="-no-pie" module_basis_universal_enabled=no module_bmp_enabled=no module_camera_enabled=no module_csg_enabled=no module_cvtt_enabled=no module_dds_enabled=no module_denoise_enabled=no module_enet_enabled=no module_etcpak_enabled=no module_glslang_enabled=no module_gltf_enabled=no module_gridmap_enabled=no module_hdr_enabled=no module_jpg_enabled=no module_jsonrpc_enabled=no module_lightmapper_rd_enabled=no module_mbedtls_enabled=no module_meshoptimizer_enabled=no module_minimp3_enabled=no module_mobile_vr_enabled=no module_multiplayer_enabled=no module_noise_enabled=no module_ogg_enabled=no module_openxr_enabled=no module_raycast_enabled=no module_regex_enabled=no module_squish_enabled=no module_tga_enabled=no module_theora_enabled=no module_tinyexr_enabled=no module_upnp_enabled=no module_vhacd_enabled=no module_vorbis_enabled=no module_webp_enabled=no module_webrtc_enabled=no module_websocket_enabled=no module_webxr_enabled=no module_xatlas_unwrap_enabled=no target=editor -j2

produce such errors

In file included from modules/navigation/nav_mesh_generator_3d.cpp:33:
modules/navigation/nav_mesh_generator_3d.h:40:7: note: forward declaration of 'class NavigationMesh'
   40 | class NavigationMesh;
      |       ^~~~~~~~~~~~~~
modules/navigation/nav_mesh_generator_3d.cpp:704:42: error: invalid use of incomplete type 'class NavigationMesh'
  704 |                         p_navigation_mesh->add_polygon(nav_indices);
      |                                          ^~
In file included from modules/navigation/nav_mesh_generator_3d.cpp:33:
modules/navigation/nav_mesh_generator_3d.h:40:7: note: forward declaration of 'class NavigationMesh'
   40 | class NavigationMesh;
      |       ^~~~~~~~~~~~~~
In file included from ./core/io/resource_uid.h:34,
                 from ./core/io/resource.h:34,
                 from ./core/input/input_event.h:35,
                 from ./core/os/main_loop.h:34,
                 from ./scene/main/scene_tree.h:34,
                 from ./scene/main/node.h:37,
                 from ./scene/3d/node_3d.h:34,
                 from ./scene/3d/visual_instance_3d.h:34,
                 from ./scene/3d/mesh_instance_3d.h:35,
                 from modules/navigation/nav_mesh_generator_3d.cpp:37:
./core/object/ref_counted.h: In instantiation of 'void Ref<T>::ref(const Ref<T>&) [with T = NavigationMesh]':
./core/object/ref_counted.h:166:3:   required from 'Ref<T>::Ref(const Ref<T>&) [with T = NavigationMesh]'
modules/navigation/nav_mesh_generator_3d.cpp:118:42:   required from here
./core/object/ref_counted.h:69:36: error: invalid use of incomplete type 'class NavigationMesh'
   69 |                         reference->reference();
      |                         ~~~~~~~~~~~^~~~~~~~~
In file included from modules/navigation/nav_mesh_generator_3d.cpp:33:
modules/navigation/nav_mesh_generator_3d.h:40:7: note: forward declaration of 'class NavigationMesh'
   40 | class NavigationMesh;
      |       ^~~~~~~~~~~~~~
In file included from ./core/io/resource_uid.h:34,
                 from ./core/io/resource.h:34,
                 from ./core/input/input_event.h:35,
                 from ./core/os/main_loop.h:34,
                 from ./scene/main/scene_tree.h:34,
                 from ./scene/main/node.h:37,
                 from ./scene/3d/node_3d.h:34,
                 from ./scene/3d/visual_instance_3d.h:34,
                 from ./scene/3d/mesh_instance_3d.h:35,
                 from modules/navigation/nav_mesh_generator_3d.cpp:37:
./core/object/ref_counted.h: In instantiation of 'void Ref<T>::unref() [with T = NavigationMesh]':
./core/object/ref_counted.h:222:3:   required from 'Ref<T>::~Ref() [with T = NavigationMesh]'
modules/navigation/nav_mesh_generator_3d.cpp:118:42:   required from here
./core/object/ref_counted.h:209:45: error: invalid use of incomplete type 'class NavigationMesh'
  209 |                 if (reference && reference->unreference()) {
      |                                  ~~~~~~~~~~~^~~~~~~~~~~
In file included from modules/navigation/nav_mesh_generator_3d.cpp:33:
modules/navigation/nav_mesh_generator_3d.h:40:7: note: forward declaration of 'class NavigationMesh'
   40 | class NavigationMesh;
      |       ^~~~~~~~~~~~~~
scons: *** [modules/navigation/nav_mesh_generator_3d.linuxbsd.editor.dev.x86_64.o] Error 1
scons: building terminated because of errors.

this is 1 day old regression, probably caused by https://github.com/godotengine/godot/commit/7eb047a5edf5b87e519e149b11e2b00543b62e72

AThousandShips commented 1 year ago

Caused by the fact that nav_mesh_generator_3d only has access to this class via gridmap, should include it directly instead

It's a long and convoluted include chain tbh, we need to get better at not relying on them

Making a fix