Skip to content

compilers(MSVC): use /Fe for .dll too - #16107

Merged
bonzini merged 1 commit into
mesonbuild:masterfrom
lucascolley:Fe
Aug 28, 2026
Merged

compilers(MSVC): use /Fe for .dll too#16107
bonzini merged 1 commit into
mesonbuild:masterfrom
lucascolley:Fe

Conversation

@lucascolley

Copy link
Copy Markdown
Contributor

This avoids erroneously generating e.g.

clang-cl.exe ... /Fosanity_check_for_cython.dll sanity_check_for_cython.c ... /link ... /DLL

as happens in Meson 1.12.0 — see scipy/scipy#25904 for an issue that might have been avoided without this bug.

Ref. https://learn.microsoft.com/en-us/cpp/build/reference/fo-object-file-name?view=msvc-170 vs. https://learn.microsoft.com/en-us/cpp/build/reference/fe-name-exe-file?view=msvc-170.


Issue diagnosed and patch generated by Claude Opus 5; patch reviewed and edited by me.

Comment thread mesonbuild/compilers/compilers.py Outdated
cargs = list(self.environment.coredata.get_external_args(self.for_machine, self.language))
largs = list(self.environment.coredata.get_external_link_args(self.for_machine, self.language))
return self.exelist_no_ccache + self.get_always_args() + self.get_output_args(binname) + [sourcename] + cargs, largs
return self.exelist_no_ccache + self.get_always_args() + self.get_image_output_args(binname) + [sourcename] + cargs, largs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is subtly wrong, because the subclass CLikeCompiler._sanity_check_compile_args can choose to make the sanity check compilation only. I'm trying to understand what's the right API for this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think this is subtly wrong, because the subclass CLikeCompiler._sanity_check_compile_args can choose to make the sanity check compilation only. I'm trying to understand what's the right API for this.

any further thoughts @bonzini ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nope, sorry. I spent some time when I answered but it's pretty complicated.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no worries. There has been no response on the LLVM side, so we are still blocked on upgrading to Meson 1.12.0 for now

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To clarify, is this a regression?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To clarify, is this a regression?

Yeah, from #15092

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The simplest fix here is to also add dll to the check actually. It's perpetuating the hack, but for the sake of fixing a regression it works well. :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, I figured that was too hacky, but no problem if that's the way you want to go

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

At least for 1.12.1 it is undoubtedly the safest, so go for it.

@lucascolley
lucascolley requested a review from bonzini August 28, 2026 08:56
@lucascolley lucascolley changed the title compilers: improve /Fe vs /Fo args for MSVC compilers(MSVC): use /Fe for .dll too Aug 28, 2026
@bonzini

bonzini commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Merging as a stopgap fix. Something like get_output_for_mode would be better, but when it's merged the .exe/.dll criterion would go away altogether so this doesn't make the change any harder.

@bonzini
bonzini merged commit f3b78ee into mesonbuild:master Aug 28, 2026
26 of 30 checks passed
@lucascolley

Copy link
Copy Markdown
Contributor Author

thanks Paolo!

BTW I had a chat with David, he is planning to prioritise taking a look at the meson-python stuff for pyo3 🎉

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.

2 participants