Closed filipsajdak closed 5 months ago
Thanks for opening this issue... I have not had a chance to look at this.
@JohelEGP -- do you have any idea why this is happening? It used to work, then became intermittent, and now is consistently failing.
I suppose it's the pure2
tests that are failing because they're trying to use C++ modules.
I can't find platform-specific flags in the CMake sources, so perhaps it's missing one of the advertised ones at https://github.com/hsutter/cppfront#how-do-i-build-cppfront.
so perhaps it's missing one of the advertised ones
No, unfortunately it's not so simple. Here's one of the command lines from the tests:
C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1434~1.319\bin\HostX64\x64\cl.exe /nologo /TP -external:ID:\a\cppfront\cppfront\_local\include -external:W0 /DWIN32 /D_WINDOWS /EHsc /O2 /Ob2 /DNDEBUG -std:c++20 -MD /experimental:module /showIncludes /FoCMakeFiles\test-case.dir\_cppfront\pure2-bounds-safety-span.cpp.obj /FdCMakeFiles\test-case.dir\ /FS -c D:\a\cppfront\cppfront\build\regression-tests\pure2-bounds-safety-span\build\_cppfront\pure2-bounds-safety-span.cpp
I can clearly see both -std:c++20
and /EHsc
in there.
Then it might be -experimental:module
from https://github.com/hsutter/cppfront/blob/main/regression-tests/test-results/msvc-2022/run-tests-msvc-2022.bat.
Ugh, I wish I knew why that wasn't always needed. We can try adding that.
It seems like it's already added at https://github.com/modern-cmake/cppfront/blob/main/regression-tests/cmake/CMakeLists.txt.in#L14.
It seems like it's already added
Oh, and sure enough, it's in the command line above... maybe removing it would help, if the MSVC version is new enough?
Another difference is that https://github.com/hsutter/cppfront/blob/main/regression-tests/test-results/msvc-2022/run-tests-msvc-2022.bat
uses -std:c++latest
.
We could try this
target_compile_features(
cppfront_cpp2util
INTERFACE
$<IF:$<CXX_COMPILER_ID:MSVC>,cxx_std_23,cxx_std_20>
)
instead of this: https://github.com/modern-cmake/cppfront/blob/43340d35bbc34d8cb788e627dee2638fa3dcf218/CMakeLists.txt#L57
That should give -std:c++latest
for MSVC and will turn into -std:c++23
in future versions.
I don't think that's it. It still fails: https://compiler-explorer.com/z/aGaj5z58q.
Maybe it's just as the error message says, and there's something that needs to be installed in the environment.
Yeah, that's not going to work on GitHub Actions, though.
Maybe you can downgrade the version of MSVC to one that works: https://github.com/ilammy/msvc-dev-cmd#inputs.
This is frustrating... I cannot reproduce the error locally (with VS2022, v14.34 toolset, same as GHA). Everything "just works" here. The documentation suggests that the C++ modules are indeed installed (component Microsoft.VisualStudio.Component.VC.Modules.x86.x64
)
I've put in the time I have to look at this during the week. I'll try again on the weekend.
This is no longer the issue with MSVC. Now we have issues in the build/check
tests
Some tests are failing due to the following error: