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

CMake: Windows: VS Community 2022 can't build or-tools anymore (cl.exe fatal error C1001) #3807

Closed
Mizux opened this issue Jun 2, 2023 · 6 comments
Assignees
Labels
Bug Build: CMake CMake based build issue Build: Makefile Makefile based build issue Lang: C++ Native implementation issue OS: Windows Windows OS
Milestone

Comments

@Mizux
Copy link
Collaborator

Mizux commented Jun 2, 2023

When using Visual Studio Community 2022 (17.6.2) or-tools main branch fails to build...

Here trace example:

4758 "D:\a\or-tools\or-tools\build\ALL_BUILD.vcxproj" (default target) (1) ->
4759 "D:\a\or-tools\or-tools\build\ortools\glop\ortools_glop.vcxproj" (default target) (76) ->
4760 (ClCompile target) -> 
4761 D:\a\or-tools\or-tools\build\_deps\absl-src\absl\container\internal\compressed_tuple.h(88):
    fatal  error C1001: Internal compiler error. [D:\a\or-tools\or-tools\build\ortools\glop\ortools_glop.vcxproj]
4762 cl : command line  error D8040: error creating or communicating with child process
    [D:\a\or-tools\or-tools\build\ortools\glop\ortools_glop.vcxproj]
4763
4764 13 Warning(s)
4765 2 Error(s)

ref: https://github.com/google/or-tools/actions/runs/5132839527/jobs/9234655226

TLDR: Need to bump to Visual Studio Community 17.7.0 or use the Enterprise version

@Mizux Mizux added Bug OS: Windows Windows OS Build: CMake CMake based build issue Lang: C++ Native implementation issue Build: Makefile Makefile based build issue labels Jun 2, 2023
@Mizux Mizux added this to the v9.7 milestone Jun 2, 2023
@Mizux Mizux self-assigned this Jun 2, 2023
@Mizux Mizux changed the title Windows: cl.exe can't build or-tools anymore CMake: Windows cl.exe can't build or-tools anymore Jun 2, 2023
@Mizux
Copy link
Collaborator Author

Mizux commented Jun 2, 2023

dev note: May be due to the last google3 sync, on my way to debug it...

@magneticflux-
Copy link

magneticflux- commented Jun 4, 2023

I am able to build main (85fc6ef) using Visual Studio 17.7.0 Preview 1, although I had to manually fix some function signatures that had const removed in f25897b since they caused linker errors.

@Mizux
Copy link
Collaborator Author

Mizux commented Jun 4, 2023

I am able to build main (85fc6ef) using Visual Studio 17.7.0 Preview 1, although I had to manually fix some function signatures that had const removed in f25897b since they caused linker errors.

Yup, I spotted few of them in our CI already but the above crash block me to build locally and fix them... -_-
ref:
https://github.com/google/or-tools/actions/runs/5168581137/jobs/9310266516
https://github.com/google/or-tools/actions/runs/5168581160/jobs/9310266633

Otherwise concerning const in function declaration it is an issue raise by clang-tidy on linux internally so googlers try to fix them (from gcc/clang compiler pov const is unneeded in function declaration, only in function definition it is can be useful and both methods are equivalent btw). BUT when using cl.exe microsoft is more picky in mangling and const seems to be part of the prototype somehow -> both declaration and definition must [not] use const.

see:

// ----- Forward Declarations and Profiling Support -----
extern DemonProfiler* BuildDemonProfiler(Solver* solver);
extern void DeleteDemonProfiler(DemonProfiler* monitor);
extern void InstallDemonProfiler(DemonProfiler* monitor);
extern LocalSearchProfiler* BuildLocalSearchProfiler(Solver* solver);
extern void DeleteLocalSearchProfiler(LocalSearchProfiler* monitor);
extern void InstallLocalSearchProfiler(LocalSearchProfiler* monitor);

and
void InstallDemonProfiler(DemonProfiler* const monitor) { monitor->Install(); }

DemonProfiler* BuildDemonProfiler(Solver* const solver) {

void DeleteDemonProfiler(DemonProfiler* const monitor) { delete monitor; }

...

On my way to fix them if I manage to update VisualStudio 17 to prevent cl.exe to crash ;)

@Mizux
Copy link
Collaborator Author

Mizux commented Jun 5, 2023

UPDATE:

dev note:

  • Check installed version:
"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest
"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -prerelease
  • Need to remove Community version for CMake to auto detect and choose the preview version

@Mizux Mizux closed this as completed in 2a7f872 Jun 5, 2023
@Mizux Mizux changed the title CMake: Windows cl.exe can't build or-tools anymore CMake: Windows Community 2022 cl.exe can't build or-tools anymore Jun 15, 2023
@Mizux Mizux changed the title CMake: Windows Community 2022 cl.exe can't build or-tools anymore CMake: Windows: VS Community 2022 cl.exe can't build or-tools anymore Jun 15, 2023
@Mizux Mizux changed the title CMake: Windows: VS Community 2022 cl.exe can't build or-tools anymore CMake: Windows: VS Community 2022 can't build or-tools anymore (cl.exe fatal error C1001) Jun 15, 2023
@Mizux
Copy link
Collaborator Author

Mizux commented Jul 3, 2023

seems github windows runner is playing with the VS Enterprise Version

2 weeks ago:
VS Enterprise 2022 19.36.32532.0: Build Fail
Since Yesterday:
VS Enterprise 2022 19.35.32217: Build Pass

Seems related to:

@Mizux
Copy link
Collaborator Author

Mizux commented Sep 6, 2023

Failing again since runner reuse 14.36 version...

2023-09-04T14:57:30.7025838Z -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.36.32532/bin/HostX64/x64/cl.exe - skipped

ref: https://github.com/google/or-tools/actions/runs/6075019490/job/16480348923

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Build: CMake CMake based build issue Build: Makefile Makefile based build issue Lang: C++ Native implementation issue OS: Windows Windows OS
Projects
Archived in project
Development

No branches or pull requests

2 participants