godotengine / godot

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

XRInterfaceExtension conflicts with XRInterface in godot-cpp #53999

Closed fire closed 3 years ago

fire commented 3 years ago

Godot version

a4fbb67902f493bff503dafd0ccc6277af85f3a1

System information

Win11, RTX 3000 series

Issue description

Building godot-cpp fails with:

&2|16:47:56.286 In file included from gen/src/classes/xr_interface_extension.cpp:33:
&2|16:47:56.286 gen/include/godot_cpp/classes/xr_interface_extension.hpp:84:18: error: class member cannot be redeclared
&2|16:47:56.286         virtual int64_t _get_tracking_status() const;
&2|16:47:56.287                         ^
&2|16:47:56.287 gen/include/godot_cpp/classes/xr_interface_extension.hpp:69:18: note: previous declaration is here
&2|16:47:56.287         virtual int64_t _get_tracking_status() const;
&2|16:47:56.287                         ^
&2|16:47:56.301 gen/src/classes/xr_interface_extension.cpp:142:31: error: redefinition of '_get_tracking_status'
&2|16:47:56.301 int64_t XRInterfaceExtension::_get_tracking_status() const {
&2|16:47:56.301                               ^
&2|16:47:56.302 gen/src/classes/xr_interface_extension.cpp:88:31: note: previous definition is here
&2|16:47:56.302 int64_t XRInterfaceExtension::_get_tracking_status() const {
&2|16:47:56.302                               ^
&2|16:47:56.479 2 errors generated.

I think the bug is because XRInterfaceExtension isn't in a c++ namespace like core_bind.

Steps to reproduce

godot

  1. godot.windows.opt.tools.64.exe --dump-extension-api extension_api.json

godot-cpp

  1. copy extension_api.json to godot-cpp/godot-/headers/extension_api.json
  2. scons werror=no platform=windows target=release -j34 use_lto=no deprecated=no generate_bindings=yes use_mingw=yes use_llvm=yes use_lld=yes use_thinlto=yes LINKFLAGS="-Wl,-pdb= CCFLAGS='-g -gcodeview'" debug_symbols=no

Note that these build flags aren't optimal.

Minimal reproduction project

2021-10-19-openvr-compile-fail.txt

extension_api.json.txt

I'm trying to debug this so you'll need to refer to godot-cpp and godot master.

fire commented 3 years ago

@mhilbrunner I think you know the most about this area.

BastiaanOlij commented 3 years ago

Oops, this was introduced late last night when I rebased my play area PR. Simple oversight that is not (yet) caught by CI, it's simply declared twice:

https://github.com/godotengine/godot/blob/master/servers/xr/xr_interface_extension.cpp#L44

and

https://github.com/godotengine/godot/blob/master/servers/xr/xr_interface_extension.cpp#L66

That second entry needs to be removed.

I'll be working on updating the CI to test compile godot-cpp to catch issues like these later today.