godotengine / godot

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

Unable to build master branch due to `expected unqualified-id` errors in camera_3d_gizmo_plugin.cpp on Windows llvm-mingw #95766

Closed Anutrix closed 1 month ago

Anutrix commented 1 month ago

Tested versions

System information

Godot master (1bd740d18d714f815486b04bf4c6154ef6c355d9) - Windows 10.0.22631 - Vulkan (Forward+) - dedicated Radeon RX 570 Series (Advanced Micro Devices, Inc.; 31.0.21916.2) - AMD Ryzen 9 5900X 12-Core Processor (24 Threads)

Issue description

It fails with following when trying to build godot with llvm-mingw:

> scons dev_build=yes use_mingw=yes
scons: Reading SConscript files ...
Automatically detected platform: windows
Auto-detected 24 CPU cores available for build parallelism. Using 23 cores by default. You can override it with the -j argument.
Using MinGW, arch x86_64
Building for platform "windows", architecture "x86_64", target "editor".
NOTE: Developer build, with debug optimization level and debug symbols (unless overridden).
Checking for C header file mntent.h... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
[Initial build] Compiling editor\plugins\gizmos\camera_3d_gizmo_plugin.cpp ...
[Initial build] Compiling editor\plugins\gizmos\ray_cast_3d_gizmo_plugin.cpp ...
[Initial build] Compiling editor\plugins\gizmos\reflection_probe_gizmo_plugin.cpp ...
[Initial build] Compiling editor\plugins\gizmos\shape_cast_3d_gizmo_plugin.cpp ...
[Initial build] Compiling editor\plugins\gizmos\soft_body_3d_gizmo_plugin.cpp ...
[Initial build] Compiling editor\plugins\gizmos\spring_arm_3d_gizmo_plugin.cpp ...
[Initial build] Compiling editor\plugins\gizmos\sprite_base_3d_gizmo_plugin.cpp ...
[Initial build] Compiling editor\plugins\gizmos\vehicle_body_3d_gizmo_plugin.cpp ...
[Initial build] Compiling editor\plugins\gizmos\visible_on_screen_notifier_3d_gizmo_plugin.cpp ...
[Initial build] Compiling editor\plugins\gizmos\voxel_gi_gizmo_plugin.cpp ...
[Initial build] Compiling editor\plugins\tiles\atlas_merging_dialog.cpp ...
[Initial build] Compiling editor\plugins\tiles\tile_atlas_view.cpp ...
[Initial build] Compiling editor\plugins\tiles\tile_data_editors.cpp ...
[Initial build] Compiling editor\plugins\tiles\tile_map_layer_editor.cpp ...
[Initial build] Compiling editor\plugins\tiles\tile_proxies_manager_dialog.cpp ...
[Initial build] Compiling editor\plugins\tiles\tile_set_atlas_source_editor.cpp ...
[Initial build] Compiling editor\plugins\tiles\tile_set_editor.cpp ...
[Initial build] Compiling editor\plugins\tiles\tile_set_scenes_collection_source_editor.cpp ...
[Initial build] Compiling editor\plugins\tiles\tiles_editor_plugin.cpp ...
[Initial build] Compiling editor\project_manager\project_dialog.cpp ...
[Initial build] Compiling editor\project_manager\project_list.cpp ...
[Initial build] Compiling editor\project_manager\project_tag.cpp ...
[Initial build] Compiling editor\project_manager\quick_settings_dialog.cpp ...
[Initial build] Compiling editor\themes\editor_color_map.cpp ...
[Initial build] Generating editor\themes\builtin_fonts.gen.h ...
ERROR: clang-18: warning: argument unused during compilation: '-mwindows' [-Wunused-command-line-argument]
editor\plugins\gizmos\camera_3d_gizmo_plugin.cpp:116:15: error: expected unqualified-id
  116 |                 Vector3 far = aspect == Camera3D::KeepAspect::KEEP_WIDTH ? Vector3(4096, 0, -1) : Vector3(0, 4096, -1);
      |                             ^
editor\plugins\gizmos\camera_3d_gizmo_plugin.cpp:119:73: error: expected expression
  119 |                 Geometry3D::get_closest_points_between_segments(Vector3(0, 0, -1), far, s[0], s[1], ra, rb);
      |                                                                                       ^
2 errors generated.

scons: *** [editor\plugins\gizmos\camera_3d_gizmo_plugin.windows.editor.dev.x86_64.o] Error 1
scons: building terminated because of errors.
[Time elapsed: 00:00:23.41]

Not sure if this specific to llvm-mingw as I don't use MSVC. It used to work fine with this compiler before. Note that I haven't built godot in a while(about 2k commits ago). Tried clean build but it didn't help.

Update: The change between 4.3 and master for that file seems to be from https://github.com/godotengine/godot/pull/90690 .

Steps to reproduce

  1. Add llvm-mingw to path.
  2. Switch to godot repo directory and checkout into master branch.
  3. Run scons dev_build=yes use_mingw=yes in godot folder.

Minimal reproduction project (MRP)

NA

AThousandShips commented 1 month ago

This is because far is a macro in some Windows environments, it's been a serious issue across versions in the past and was fixed, but seems the general improvement wasn't complete, I'll write up a quick fix