Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCons: Fix get_mingw_tool regression #91734

Closed

Conversation

Repiteo
Copy link
Contributor

@Repiteo Repiteo commented May 8, 2024

Closes #91710

get_mingw_tool was refactored to take SConsEnvironment as an optional argument. It only looks for a prefixed executable when checking if Windows is a supported platform, ensuring no false positives. If Windows is supported & selected for building, the mingw_prefix bin folder is prepended to the SCons Environment's path.

@Repiteo Repiteo force-pushed the scons/get_mingw_tool-fixes branch from 020c018 to 9ef4470 Compare May 8, 2024 21:00
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's becoming a bit convoluted, but if it fixes the issue, seems fine.

@TokageItLab
Copy link
Member

Seems this doesn't fix #91710

 *  Executing task: scons platform=windows target=editor -j 16 

scons: Reading SConscript files ...
Using MinGW, arch x86_64
Building for platform "windows", architecture "x86_64", target "editor".
Checking for C header file mntent.h... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
[  0%] build_res_file(["platform\windows\godot_res_wrap.windows.editor.x86_64.o"], ["platform\windows\godot_res_wrap.rc"])
[  1%] Compiling platform\windows\godot_windows.cpp ...
[  1%] Generating servers\rendering\renderer_rd\shaders\blit.glsl.gen.h ...
[  1%] Generating servers\rendering\renderer_rd\shaders\environment\volumetric_fog.glsl.gen.h ...
[  1%] Generating servers\rendering\renderer_rd\shaders\environment\volumetric_fog_process.glsl.gen.h ...
[  1%] Generating servers\rendering\renderer_rd\shaders\forward_clustered\best_fit_normal.glsl.gen.h ...
[  1%] Generating servers\rendering\renderer_rd\shaders\forward_clustered\scene_forward_clustered.glsl.gen.h ...
[  1%] Generating servers\rendering\renderer_rd\shaders\canvas.glsl.gen.h ...
[  1%] Generating servers\rendering\renderer_rd\shaders\canvas_occlusion.glsl.gen.h ...
[  1%] Generating servers\rendering\renderer_rd\shaders\skeleton.glsl.gen.h ...
[  1%] Generating servers\rendering\renderer_rd\shaders\particles.glsl.gen.h ...
[  1%] Generating servers\rendering\renderer_rd\shaders\particles_copy.glsl.gen.h ...
[  2%] Generating servers\rendering\renderer_rd\shaders\canvas_sdf.glsl.gen.h ...
[  2%] Generating servers\rendering\renderer_rd\shaders\cluster_debug.glsl.gen.h ...
[  2%] Generating servers\rendering\renderer_rd\shaders\cluster_render.glsl.gen.h ...
[  2%] scons: *** [platform\windows\godot_res_wrap.windows.editor.x86_64.o] Error -1
Generating servers\rendering\renderer_rd\shaders\cluster_store.glsl.gen.h ...
scons: building terminated because of errors.
[Time elapsed: 00:00:06.60]

 *  The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command scons platform=windows target=editor -j 16" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

@Repiteo
Copy link
Contributor Author

Repiteo commented May 9, 2024

Oh wow, so you're experiencing a different issue than what I was able to replicate; it must be very specific to res then. This PR still addresses bruvzg's concerns at least, but it's not the full "fix" I was hoping for.

@bruvzg
Copy link
Member

bruvzg commented May 9, 2024

Seems this doesn't fix #91710

Try running it with verbose=yes.

I was thinking it's the issue with MSYS2 paths, but now I am not sure since there's powershell mentioned in your log.

@TokageItLab
Copy link
Member

Try running it with verbose=yes.

scons platform=windows target=editor -j 16 verbose=yes
scons: Reading SConscript files ...
Using MinGW, arch x86_64
Building for platform "windows", architecture "x86_64", target "editor".
Checking for C header file mntent.h... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
[  0%] build_res_file(["platform\windows\godot_res_wrap.windows.editor.x86_64.o"], ["platform\windows\godot_res_wrap.rc"])
[  2%] build_rd_headers(["servers\rendering\renderer_rd\shaders\effects\ssao_interleave.glsl.gen.h"], ["servers\rendering\renderer_rd\shaders\effects\ssao_interleave.glsl"])        
[  2%] build_rd_headers(["servers\rendering\renderer_rd\shaders\effects\ssil.glsl.gen.h"], ["servers\rendering\renderer_rd\shaders\effects\ssil.glsl"])
[  2%] build_rd_headers(["servers\rendering\renderer_rd\shaders\effects\ssil_blur.glsl.gen.h"], ["servers\rendering\renderer_rd\shaders\effects\ssil_blur.glsl"])
[  2%] build_rd_headers(["servers\rendering\renderer_rd\shaders\effects\ssil_importance_map.glsl.gen.h"], ["servers\rendering\renderer_rd\shaders\effects\ssil_importance_map.glsl"])
[  2%] build_rd_headers(["servers\rendering\renderer_rd\shaders\effects\ssil_interleave.glsl.gen.h"], ["servers\rendering\renderer_rd\shaders\effects\ssil_interleave.glsl"])        
[  2%] build_rd_headers(["servers\rendering\renderer_rd\shaders\effects\ss_effects_downsample.glsl.gen.h"], ["servers\rendering\renderer_rd\shaders\effects\ss_effects_downsample.glsl"])
[  2%] build_rd_headers(["servers\rendering\renderer_rd\shaders\effects\subsurface_scattering.glsl.gen.h"], ["servers\rendering\renderer_rd\shaders\effects\subsurface_scattering.glsl"])
[  2%] build_rd_headers(["servers\rendering\renderer_rd\shaders\effects\taa_resolve.glsl.gen.h"], ["servers\rendering\renderer_rd\shaders\effects\taa_resolve.glsl"])
[  3%] build_rd_headers(["servers\rendering\renderer_rd\shaders\forward_mobile\scene_forward_mobile.glsl.gen.h"], ["servers\rendering\renderer_rd\shaders\forward_mobile\scene_forward_mobile.glsl"])
[  3%] build_rd_headers(["servers\rendering\renderer_rd\shaders\environment\sky.glsl.gen.h"], ["servers\rendering\renderer_rd\shaders\environment\sky.glsl"])
[  3%] build_rd_headers(["servers\rendering\renderer_rd\shaders\effects\sort.glsl.gen.h"], ["servers\rendering\renderer_rd\shaders\effects\sort.glsl"])
[  3%] build_rd_headers(["servers\rendering\renderer_rd\shaders\effects\bokeh_dof.glsl.gen.h"], ["servers\rendering\renderer_rd\shaders\effects\bokeh_dof.glsl"])
[  3%] build_rd_headers(["servers\rendering\renderer_rd\shaders\effects\bokeh_dof_raster.glsl.gen.h"], ["servers\rendering\renderer_rd\shaders\effects\bokeh_dof_raster.glsl"])
[  3%] build_rd_headers(["servers\rendering\renderer_rd\shaders\effects\blur_raster.glsl.gen.h"], ["servers\rendering\renderer_rd\shaders\effects\blur_raster.glsl"])
[  3%] scons: *** [platform\windows\godot_res_wrap.windows.editor.x86_64.o] Error -1
build_rd_headers(["servers\rendering\renderer_rd\shaders\effects\copy.glsl.gen.h"], ["servers\rendering\renderer_rd\shaders\effects\copy.glsl"])
scons: building terminated because of errors.
[Time elapsed: 00:00:02.85]

@bruvzg
Copy link
Member

bruvzg commented May 9, 2024

Try running it with verbose=yes.

Strange, seems like output is the same, I was expecting it to print full commands. Maybe it only works if it's added before -j 16, or it's only working for compiler not a custom tools like windres.

@TokageItLab
Copy link
Member

TokageItLab commented May 9, 2024

Ah, right. So:

scons verbose=yes platform=windows target=editor -j 16
scons: Reading SConscript files ...
Using MinGW, arch x86_64
Building for platform "windows", architecture "x86_64", target "editor".
Checking for C header file mntent.h... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
[  0%] build_res_file(["platform\windows\godot_res_wrap.windows.editor.x86_64.o"], ["platform\windows\godot_res_wrap.rc"])
[  3%] build_rd_headers(["servers\rendering\renderer_rd\shaders\effects\vrs.glsl.gen.h"], ["servers\rendering\renderer_rd\shaders\effects\vrs.glsl"])
[  3%] build_gles3_headers(["drivers\gles3\shaders\effects\copy.glsl.gen.h"], ["drivers\gles3\shaders\effects\copy.glsl"])
[  3%] build_gles3_headers(["drivers\gles3\shaders\effects\cubemap_filter.glsl.gen.h"], ["drivers\gles3\shaders\effects\cubemap_filter.glsl"])
[  3%] build_gles3_headers(["drivers\gles3\shaders\effects\glow.glsl.gen.h"], ["drivers\gles3\shaders\effects\glow.glsl"])
[  3%] build_gles3_headers(["drivers\gles3\shaders\effects\post.glsl.gen.h"], ["drivers\gles3\shaders\effects\post.glsl"])
[  3%] build_gles3_headers(["drivers\gles3\shaders\canvas.glsl.gen.h"], ["drivers\gles3\shaders\canvas.glsl"])
[  3%] build_gles3_headers(["drivers\gles3\shaders\canvas_occlusion.glsl.gen.h"], ["drivers\gles3\shaders\canvas_occlusion.glsl"])
[  3%] build_gles3_headers(["drivers\gles3\shaders\sky.glsl.gen.h"], ["drivers\gles3\shaders\sky.glsl"])
[  3%] build_gles3_headers(["drivers\gles3\shaders\particles.glsl.gen.h"], ["drivers\gles3\shaders\particles.glsl"])
[  3%] build_gles3_headers(["drivers\gles3\shaders\scene.glsl.gen.h"], ["drivers\gles3\shaders\scene.glsl"])
[  3%] build_gles3_headers(["drivers\gles3\shaders\skeleton.glsl.gen.h"], ["drivers\gles3\shaders\skeleton.glsl"])
[  3%] build_gles3_headers(["drivers\gles3\shaders\particles_copy.glsl.gen.h"], ["drivers\gles3\shaders\particles_copy.glsl"])
[  3%] build_gles3_headers(["drivers\gles3\shaders\canvas_sdf.glsl.gen.h"], ["drivers\gles3\shaders\canvas_sdf.glsl"])
[  4%] x86_64-w64-mingw32-g++ -o platform\windows\key_mapping_windows.windows.editor.x86_64.o -c -std=gnu++17 -fno-exceptions -mwindows -O2 -Wall -Wshadow -Wno-misleading-indentation -isystem thirdparty\glad -DTOOLS_ENABLED -DDEBUG_ENABLED -DNDEBUG -DENGINE_UPDATE_CHECK_ENABLED -DNO_EDITOR_SPLASH -DWINDOWS_ENABLED -DWASAPI_ENABLED -DWINMIDI_ENABLED -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DVULKAN_ENABLED -DRD_ENABLED -DGLES3_ENABLED -DMINGW_ENABLED -DMINGW_HAS_SECURE_API=1 -DMINIZIP_ENABLED -DBROTLI_ENABLED -DTHREADS_ENABLED -DCLIPPER2_ENABLED -DZSTD_STATIC_LINKING_ONLY -DUSE_VOLK -DVK_USE_PLATFORM_WIN32_KHR -DGLAD_ENABLED -DEGL_ENABLED -Ithirdparty\freetype\include -Ithirdparty\libpng -Ithirdparty\volk -Ithirdparty\vulkan -Ithirdparty\vulkan\include -Ithirdparty\zstd -Ithirdparty\zlib -Ithirdparty\clipper2\include -Ithirdparty\brotli\include -Ithirdparty\angle\include -Iplatform\windows -I. platform\windows\key_mapping_windows.cpp
[  4%] scons: *** [platform\windows\godot_res_wrap.windows.editor.x86_64.o] Error -1
x86_64-w64-mingw32-g++ -o platform\windows\joypad_windows.windows.editor.x86_64.o -c -std=gnu++17 -fno-exceptions -mwindows -O2 -Wall -Wshadow -Wno-misleading-indentation -isystem thirdparty\glad -DTOOLS_ENABLED -DDEBUG_ENABLED -DNDEBUG -DENGINE_UPDATE_CHECK_ENABLED -DNO_EDITOR_SPLASH -DWINDOWS_ENABLED -DWASAPI_ENABLED -DWINMIDI_ENABLED -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DVULKAN_ENABLED -DRD_ENABLED -DGLES3_ENABLED -DMINGW_ENABLED -DMINGW_HAS_SECURE_API=1 -DMINIZIP_ENABLED -DBROTLI_ENABLED -DTHREADS_ENABLED -DCLIPPER2_ENABLED -DZSTD_STATIC_LINKING_ONLY -DUSE_VOLK -DVK_USE_PLATFORM_WIN32_KHR -DGLAD_ENABLED -DEGL_ENABLED -Ithirdparty\freetype\include -Ithirdparty\libpng -Ithirdparty\volk -Ithirdparty\vulkan -Ithirdparty\vulkan\include -Ithirdparty\zstd -Ithirdparty\zlib -Ithirdparty\clipper2\include -Ithirdparty\brotli\include -Ithirdparty\angle\include -Iplatform\windows -I. platform\windows\joypad_windows.cpp
scons: building terminated because of errors.
[Time elapsed: 00:00:06.21]

Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only differences from the logic before #85319 I see, it was not using try_cmd for windres and was doing if len(out[1]): on the windres output and retrying without prefix, this is probably intentional, but I do not remember why.

So it's possible that there are multiple copiers of windres and only some of them work, support different set or architectures for example (but all might run with --version only).

Or it's possible that some version of windres does not respond to --version or return non-zero exit code.

I would probably consider reverting #85319, there's no benefit to this change beside code readability, and with newly added unclear env checks and addition of the prefix to PATH, I think it's now less readable that it was before #85319.

@akien-mga
Copy link
Member

I agree, let's revert to the previous state for now, and maybe reconsider in a new PR how to improve this code's readability and maintainability without regressions.

Superseded by #91751.

@akien-mga akien-mga closed this May 9, 2024
@akien-mga akien-mga removed this from the 4.3 milestone May 9, 2024
@Repiteo Repiteo deleted the scons/get_mingw_tool-fixes branch May 11, 2024 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't build Godot on Windows 10 with MinGW
4 participants