Skip to content

windows: disable the RC dependency detection script for Microsoft clang#15873

Merged
bonzini merged 1 commit into
mesonbuild:masterfrom
amyspark:fix-clangcl-rc
Jun 6, 2026
Merged

windows: disable the RC dependency detection script for Microsoft clang#15873
bonzini merged 1 commit into
mesonbuild:masterfrom
amyspark:fix-clangcl-rc

Conversation

@amyspark

@amyspark amyspark commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Hi all,

This PR disables the depfile generation script when using Microsoft-supplied Clang. Currently, whenever a Windows resource is compiled, the console gets spammed with e.g.:

[19/1419] Compiling Windows resource subprojects/ffmpeg/windows_compile_resources_0_avfilterres.rc
clang: error: no such file or directory: '/showIncludes'
clang: error: no such file or directory: '/EP'
clang: error: no such file or directory: '/nologo'
clang: error: no such file or directory: '/DRC_INVOKED'
clang: error: no such file or directory: '/Tcsubprojects/ffmpeg/avfilterres.rc'
clang: error: no input files

Fixes #15709

@amyspark
amyspark requested a review from jpakkane as a code owner June 2, 2026 01:38

@eli-schwartz eli-schwartz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The commit message is missing a description.

@amyspark

amyspark commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

The commit message is missing a description.

Added the explanation to the commit.

@amyspark
amyspark requested a review from eli-schwartz June 2, 2026 18:07
@bonzini

bonzini commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Do you mean "Only" use rc dependency detection for clang-cl? If you confirm and fix the commit message I can apply this.

@bonzini bonzini added this to the 1.11.2 milestone Jun 4, 2026
@bonzini bonzini added the OS:windows Windows OS specific issues label Jun 4, 2026
The rc helper script uses flags specific for MSVC, which clang does not
understand:

> [19/1419] Compiling Windows resource subprojects/ffmpeg/windows_compile_resources_0_avfilterres.rc
> clang: error: no such file or directory: '/showIncludes'
> clang: error: no such file or directory: '/EP'
> clang: error: no such file or directory: '/nologo'
> clang: error: no such file or directory: '/DRC_INVOKED'
> clang: error: no such file or directory: '/Tcsubprojects/ffmpeg/avfilterres.rc'
> clang: error: no input files
@amyspark

amyspark commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

Do you mean "Only" use rc dependency detection for clang-cl? If you confirm and fix the commit message I can apply this.

Yeah, my bad. I forgot to distinguish between clang-cl and Microsoft Clang.

@amyspark amyspark changed the title windows: Do not use dependency detection for clang-cl windows: disable the RC dependency detection script for Microsoft clang Jun 6, 2026
@bonzini
bonzini merged commit 97d7e60 into mesonbuild:master Jun 6, 2026
29 of 30 checks passed
@lhmouse

lhmouse commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

@amyspark

Do you mean "Only" use rc dependency detection for clang-cl? If you confirm and fix the commit message I can apply this.

Yeah, my bad. I forgot to distinguish between clang-cl and Microsoft Clang.

First of all, thank you for the fix!

To put it clear: clang-cl is the executable clang-cl; not only is it installed with Visual Studio, but also with official LLVM for Windows (C:\Program Files\LLVM\bin\clang-cl.exe) and on Linux (/usr/bin/clang-cl-21). The Microsoft Clang is not very special; it just has a default MSVC target.

So the issue is not just about Microsoft Clang, but also with official LLVM for Windows:

[42/45] "C:/Program Files/LLVM/bin/llvm-ar" "csrD" lib/libmcfgthread.a lib/libmcfgthread.a.p/mcfgthread_src_xglobals.c.obj lib/libmcfgthread.a.p/mcfgthread_src_clock.c.obj lib/libmcfgthread.a.p/mcfgthread_src_mutex.c.obj lib/libmcfgthread.a.p/mcfgthread_src_shared_mutex.c.obj lib/libmcfgthread.a.p/mcfgthread_src_cond.c.obj lib/libmcfgthread.a.p/mcfgthread_src_once.c.obj lib/libmcfgthread.a.p/mcfgthread_src_sem.c.obj lib/libmcfgthread.a.p/mcfgthread_src_event.c.obj lib/libmcfgthread.a.p/mcfgthread_src_thread.c.obj lib/libmcfgthread.a.p/mcfgthread_src_cxa.c.obj lib/libmcfgthread.a.p/mcfgthread_src_dtor_queue.c.obj lib/libmcfgthread.a.p/mcfgthread_src_exit.c.obj lib/libmcfgthread.a.p/mcfgthread_src_tls.c.obj lib/libmcfgthread.a.p/mcfgthread_src_gthr_aux.c.obj lib/libmcfgthread.a.p/mcfgthread_src_gthr.c.obj lib/libmcfgthread.a.p/mcfgthread_src_gthr_libobjc.c.obj lib/libmcfgthread.a.p/mcfgthread_src_c11.c.obj lib/libmcfgthread.a.p/mcfgthread_src_libcxx.c.obj
[43/45] "C:/MSYS64/ucrt64/bin/meson" "--internal" "rc" "--cl" "C:/Program Files/LLVM/bin/clang" "--rc" "C:/Program Files/LLVM/bin/llvm-rc.exe" "--target=x86_64-pc-windows-msvc" "-c65001" "-ID:/lh_mouse/GitHub/mcfgthread/." "-ID:/lh_mouse/GitHub/mcfgthread/build_llvm_windows/." "/nologo" "/fomcfgthread_src_version.rc_version.res" "../mcfgthread/src/version.rc"
clang: error: no such file or directory: '/showIncludes'
clang: error: no such file or directory: '/EP'
clang: error: no such file or directory: '/nologo'
clang: error: no such file or directory: '/DRC_INVOKED'
clang: error: no such file or directory: '/Tc../mcfgthread/src/version.rc'
clang: error: no input files
Error running preprocessor to find resource dependencies

While this PR prevents such errors from taking place, I wonder whether this can be improved further. When using Clang with an MSVC target, it's necessary to invoke llvm-rc instead of llvm-windres (this affects how to locate headers that are included by the RC file), but the compiler is clang which outputs Unix-style dep files, so depfile_type should be 'gcc' and that piece of code for rescomp_type == ResourceCompilerType.windres can be reused.

@amyspark
amyspark deleted the fix-clangcl-rc branch June 6, 2026 21:41
@amyspark

amyspark commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

but the compiler is clang which outputs Unix-style dep files, so depfile_type should be 'gcc' and that piece of code for rescomp_type == ResourceCompilerType.windres can be reused.

I'm not sure I understand this. rc and llvm-rc don't allow passing preprocessor flags, and Clang itself doesn't build resource files, so how would this work?

EDIT: I managed to make windres tell me how depfile generation works, so I'll be submitting a MR soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OS:windows Windows OS specific issues regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rc.py passes MSVC options to Clang

4 participants