https://bugs.winehq.org/show_bug.cgi?id=56956
Bug ID: 56956 Summary: MSVC cl.exe 19.* fails to flush intermediate file Product: Wine Version: 9.11 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: msvcrt Assignee: wine-bugs@winehq.org Reporter: loothelion@nvidia.com Distribution: ---
Created attachment 76772 --> https://bugs.winehq.org/attachment.cgi?id=76772 a trivial C program to reproduce the issue
When using any MSVC 19.* version (I've tested several) compilation of an object now fails with the following message:
c1: fatal error C1088: Cannot flush compiler intermediate file: 'C:\users\lmiddlebrook\Temp_CL_c8f4abecex': Bad file descriptor
I used git-bisect and found that the regression commit is:
commit 1163e399376ab74eb38a6068daba69497b6b14be (HEAD) Author: Shengdun Wang uwgghhbcad@gmail.com Date: Wed Jun 12 13:01:31 2024 +0200
ucrtbase: Fix FILE _flag values.
dlls/msvcrt/msvcrt.h | 8 ++++++++ dlls/ucrtbase/tests/file.c | 2 +- include/msvcrt/stdio.h | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-)
I've attached my example C program (a basic hello world). I use the following command-line to repro:
cl.exe -c z:/tmp/test.c
https://bugs.winehq.org/show_bug.cgi?id=56956
Liam Middlebrook loothelion@nvidia.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Regression SHA1| |1163e399376ab74eb38a6068dab | |a69497b6b14be
https://bugs.winehq.org/show_bug.cgi?id=56956
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dark.shadow4@web.de Keywords| |regression
--- Comment #1 from Fabian Maurer dark.shadow4@web.de --- How do you get the cl.exe for testing?
https://bugs.winehq.org/show_bug.cgi?id=56956
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |euloanty@live.com
--- Comment #2 from Fabian Maurer dark.shadow4@web.de --- CCing author, can you please take a look?
https://bugs.winehq.org/show_bug.cgi?id=56956
--- Comment #3 from cqwrteur euloanty@live.com --- Hi. I haven't checked what's causing regression for msvc.
Can you first use this with clang for cross compilation? My windows-msvc-sysroot project provides msvc libraries for clang to compile your code instead of msvc on linux.
https://github.com/trcrsired/windows-msvc-sysroot/tree/main
Also, please support me in this LLVM PR. https://github.com/llvm/llvm-project/pull/96417
https://bugs.winehq.org/show_bug.cgi?id=56956
--- Comment #4 from Liam Middlebrook loothelion@nvidia.com --- (In reply to Fabian Maurer from comment #1)
How do you get the cl.exe for testing?
It comes with Microsoft Visual Studio. I'm not sure if it's available as a separate command-line distribution. It looks like the following link may be for that but I'm not familiar with that, sorry: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-...
(In reply to cqwrteur from comment #3)
Hi. I haven't checked what's causing regression for msvc.
Can you first use this with clang for cross compilation? My windows-msvc-sysroot project provides msvc libraries for clang to compile your code instead of msvc on linux.
No. I am not going to change my build toolchain due to a regression in Wine. I've locally reverted the regressing commit in my build so that my work is not blocked.
https://bugs.winehq.org/show_bug.cgi?id=56956
--- Comment #5 from cqwrteur euloanty@live.com --- (In reply to Fabian Maurer from comment #2)
CCing author, can you please take a look?
I wasn't the actual author. I wrote my patch, and then the wine developers rewrote the code. I have trouble tracing the changes
https://bugs.winehq.org/show_bug.cgi?id=56956
--- Comment #6 from cqwrteur euloanty@live.com --- (In reply to Liam Middlebrook from comment #4)
(In reply to Fabian Maurer from comment #1)
How do you get the cl.exe for testing?
It comes with Microsoft Visual Studio. I'm not sure if it's available as a separate command-line distribution. It looks like the following link may be for that but I'm not familiar with that, sorry: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio- 2022
(In reply to cqwrteur from comment #3)
Hi. I haven't checked what's causing regression for msvc.
Can you first use this with clang for cross compilation? My windows-msvc-sysroot project provides msvc libraries for clang to compile your code instead of msvc on linux.
No. I am not going to change my build toolchain due to a regression in Wine. I've locally reverted the regressing commit in my build so that my work is not blocked.
The abi before the commit was just broken. UCRT abi in the microsoft's toolchain and windows is different from the ABI in UCRT. If you pass a FILE* from the static linked program into DLL, it would just crash.
https://bugs.winehq.org/show_bug.cgi?id=56956
--- Comment #7 from cqwrteur euloanty@live.com --- (In reply to Liam Middlebrook from comment #4)
(In reply to Fabian Maurer from comment #1)
How do you get the cl.exe for testing?
It comes with Microsoft Visual Studio. I'm not sure if it's available as a separate command-line distribution. It looks like the following link may be for that but I'm not familiar with that, sorry: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio- 2022
(In reply to cqwrteur from comment #3)
Hi. I haven't checked what's causing regression for msvc.
Can you first use this with clang for cross compilation? My windows-msvc-sysroot project provides msvc libraries for clang to compile your code instead of msvc on linux.
No. I am not going to change my build toolchain due to a regression in Wine. I've locally reverted the regressing commit in my build so that my work is not blocked.
I am trying to trace what breaks. However, I suggest you not to use msvc any more. In fact, I would argue Microsoft should just give Visual C++ like they gave up EdgeHtml. https://github.com/cppfastio/fast_io/issues/770
clang is perfectly fine and better than msvc in every possible way and it works for cross compiling.
https://bugs.winehq.org/show_bug.cgi?id=56956
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |piotr@codeweavers.com
--- Comment #8 from Fabian Maurer dark.shadow4@web.de ---
The abi before the commit was just broken. UCRT abi in the microsoft's toolchain and windows is different from the ABI in UCRT. If you pass a FILE* from the static linked program into DLL, it would just crash.
Well now it seems broken in a different way.
I suggest you not to use msvc any more.
That is not an option, msvc has keep working.
I wasn't the actual author. I wrote my patch, and then the wine developers rewrote the code. I have trouble tracing the changes
CCing reviewer then. Piotr, mind taking a look here?
https://bugs.winehq.org/show_bug.cgi?id=56956
Piotr Caban piotr.caban@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |piotr.caban@gmail.com
--- Comment #9 from Piotr Caban piotr.caban@gmail.com --- (In reply to Fabian Maurer from comment #8)
CCing reviewer then. Piotr, mind taking a look here?
Sure, I will try to reproduce the bug on Monday.
https://bugs.winehq.org/show_bug.cgi?id=56956
--- Comment #10 from Piotr Caban piotr.caban@gmail.com --- I've created MR that addresses the bug: https://gitlab.winehq.org/wine/wine/-/merge_requests/6077
https://bugs.winehq.org/show_bug.cgi?id=56956
Liam Middlebrook loothelion@nvidia.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Fixed by SHA1| |40a4809c1c6bda1c6dd5b64a4dd | |52393d5ac965f Resolution|--- |FIXED
--- Comment #11 from Liam Middlebrook loothelion@nvidia.com --- Confirming that MSVC is working again as of 40a4809c1c6bda1c6dd5b64a4dd52393d5ac965f (Piotr's commit merged into master).
Tested on Release 9.13 as well as the fix commit (and verified broken on its parent).
Thanks for the quick investigation on this!
https://bugs.winehq.org/show_bug.cgi?id=56956
--- Comment #12 from cqwrteur euloanty@live.com --- (In reply to Liam Middlebrook from comment #11)
Confirming that MSVC is working again as of 40a4809c1c6bda1c6dd5b64a4dd52393d5ac965f (Piotr's commit merged into master).
Tested on Release 9.13 as well as the fix commit (and verified broken on its parent).
Thanks for the quick investigation on this!
Thanks everyone for helping fix it.
BTW pitor can you check any other flags may be broken? UCRT changes all the flags value and i changed it but you did not want to break headers. I guess that is the reason for this bug? Can you check whether any other flags are broken? Thanks
https://bugs.winehq.org/show_bug.cgi?id=56956
--- Comment #13 from cqwrteur euloanty@live.com --- (In reply to Piotr Caban from comment #9)
(In reply to Fabian Maurer from comment #8)
CCing reviewer then. Piotr, mind taking a look here?
Sure, I will try to reproduce the bug on Monday.
_IOMYBUF is the IO_USERBUF? If I remember correctly?
https://bugs.winehq.org/show_bug.cgi?id=56956
--- Comment #14 from cqwrteur euloanty@live.com --- (In reply to cqwrteur from comment #13)
(In reply to Piotr Caban from comment #9)
(In reply to Fabian Maurer from comment #8)
CCing reviewer then. Piotr, mind taking a look here?
Sure, I will try to reproduce the bug on Monday.
_IOMYBUF is the IO_USERBUF? If I remember correctly?
ok it is CRTBUF
https://bugs.winehq.org/attachment.cgi?id=73552
Here was the old patch i put for the meaning of these flags value
https://bugs.winehq.org/show_bug.cgi?id=56956
--- Comment #15 from Piotr Caban piotr.caban@gmail.com --- (In reply to cqwrteur from comment #12)
BTW pitor can you check any other flags may be broken? UCRT changes all the flags value and i changed it but you did not want to break headers. I guess that is the reason for this bug? Can you check whether any other flags are broken?
I have changed all the flags that are used in wine, adding more internal constants want change anything unless you also fix the code to use them.
Note that this regression was also present in your version of the patch.
https://bugs.winehq.org/show_bug.cgi?id=56956
--- Comment #16 from cqwrteur euloanty@live.com --- (In reply to Piotr Caban from comment #15)
(In reply to cqwrteur from comment #12)
BTW pitor can you check any other flags may be broken? UCRT changes all the flags value and i changed it but you did not want to break headers. I guess that is the reason for this bug? Can you check whether any other flags are broken?
I have changed all the flags that are used in wine, adding more internal constants want change anything unless you also fix the code to use them.
Note that this regression was also present in your version of the patch.
yeah i think so since NOBUF wasn't part of code.
Thank you.
https://bugs.winehq.org/show_bug.cgi?id=56956
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #17 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 9.14.