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

Use Ninja in Windows CI and explicitly set the VS toolset version. #4759

Merged
merged 10 commits into from Feb 26, 2024

Conversation

teo-tsirpanis
Copy link
Member

@teo-tsirpanis teo-tsirpanis commented Feb 22, 2024

x-refs for future reference

Original PR Description

[SC-41556]

Since the GHA windows-2022 runners updated their version of Visual Studio yesterday, we have been seeing errors of the form error LNK2019: unresolved external symbol _Thrd_sleep_for. After some investigation, the cause of the errors was found to be that the vcpkg dependencies were built with the new MSVC toolset (14.39), while the main CMake project was built with the old one (14.38)1.

After efforts to make the main project build with the 14.39 toolset (by passing -T v143,version=14.39 or -DCMAKE_VS_PLATFORM_TOOLSET_VERSION=14.39) were unsuccessful, this PR switches to using the Ninja generator instead of Visual Studio. With Ninja the toolset version is specified by a GitHub action that sets the necessary environment variables.


TYPE: BUILD
DESC: Fix linker errors when building with MSVC

Footnotes

  1. If the opposite were to happen, it would be supported. Objects built with varying versions of MSVC toolsets are binary-compatible with each other, but the final linking must be done with the newest version.

Copy link

This pull request has been linked to Shortcut Story #41556: Fix windows 2022 runners..

@teo-tsirpanis teo-tsirpanis force-pushed the teo/vcpkg-pin-vs-toolset branch 3 times, most recently from 0f39834 to 2629a1a Compare February 23, 2024 12:41
@teo-tsirpanis teo-tsirpanis changed the title Temporarily pin the MSVC toolset used by vcpkg to 14.38. Switch Windows CI to use Ninja. Feb 23, 2024
@teo-tsirpanis teo-tsirpanis changed the title Switch Windows CI to use Ninja. Use Ninja in Windows CI and explicitly set the VS toolset version. Feb 23, 2024
@teo-tsirpanis teo-tsirpanis marked this pull request as ready for review February 23, 2024 16:38
Copy link
Member

@ihnorton ihnorton left a comment

Choose a reason for hiding this comment

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

LGTM, but please make sure we have

  1. recurring story to clean this up and return to standard image/toolchain use
  2. story to announce removal of the VS2019 support in a future version (maybe 2.22)

.github/workflows/build-windows.yml Show resolved Hide resolved
@ihnorton
Copy link
Member

(I'm ok w/ using Ninja for some builds, but we should make sure we continue to test and support normal solution builds, because that is how most windows devs will build by default)

@teo-tsirpanis
Copy link
Member Author

(I'm ok w/ using Ninja for some builds, but we should make sure we continue to test and support normal solution builds, because that is how most windows devs will build by default)

Assuming CMake does its job correctly there should not be any difference. And vcpkg will build with Ninja on all platforms either way.

Copy link
Member

@ihnorton ihnorton left a comment

Choose a reason for hiding this comment

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

Assuming CMake does its job correctly there should not be any difference.

With cmake (and in general) "trust, but verify". I'm ok with this since we'll still have the VS solution path for 2019, but when we remove that we should have some job that doesn't use Ninja directly for the main TileDB build.

@ihnorton ihnorton merged commit f31fa3b into dev Feb 26, 2024
56 checks passed
@ihnorton ihnorton deleted the teo/vcpkg-pin-vs-toolset branch February 26, 2024 20:21
KiterLuc pushed a commit that referenced this pull request Feb 27, 2024
…e VS toolset version. (#4759) (#4765)

Backport f31fa3b from #4759.

---
TYPE: BUILD
DESC: Fix linker errors when building with MSVC
KiterLuc pushed a commit that referenced this pull request Feb 28, 2024
…e VS toolset version. (#4759) (#4766)

Backport f31fa3b from #4759.

---
TYPE: BUILD
DESC: Fix linker errors when building with MSVC
Shelnutt2 pushed a commit that referenced this pull request Apr 21, 2024
…e VS toolset version. (#4759) (#4765)

Backport f31fa3b from #4759.

---
TYPE: BUILD
DESC: Fix linker errors when building with MSVC
Shelnutt2 pushed a commit that referenced this pull request Apr 21, 2024
…e VS toolset version. (#4759) (#4765)

Backport f31fa3b from #4759.

---
TYPE: BUILD
DESC: Fix linker errors when building with MSVC
Shelnutt2 pushed a commit that referenced this pull request Apr 21, 2024
…e VS toolset version. (#4759) (#4765)

Backport f31fa3b from #4759.

---
TYPE: BUILD
DESC: Fix linker errors when building with MSVC
Shelnutt2 pushed a commit that referenced this pull request Apr 21, 2024
…e VS toolset version. (#4759) (#4765)

Backport f31fa3b from #4759.

---
TYPE: BUILD
DESC: Fix linker errors when building with MSVC
Shelnutt2 added a commit that referenced this pull request Apr 21, 2024
…e VS toolset version. (#4759) (#4895)

Backport f31fa3b from #4759.

---
TYPE: BUILD
DESC: Fix linker errors when building with MSVC

Co-authored-by: Theodore Tsirpanis <theodore.tsirpanis@tiledb.com>
KiterLuc pushed a commit that referenced this pull request Apr 22, 2024
[SC-44745](https://app.shortcut.com/tiledb-inc/story/44745/remove-ninja-workaround-for-windows-builds)

In #4759, I switched the VS2022 builds to use Ninja due to errors caused
by MSVC toolset version mismatch but could not make the VS2019 builds
use Ninja as well and resorted to some conditional logic to support both
Ninja and MSBuild.

I subsequently found out what the problem with VS2019 was (the action to
install Ninja was running before the checkout action, and the latter
deleted the downloaded Ninja), and this PR enables Ninja on all Visual
Studio versions and deletes the conditional logic, simplifying the
workflow.

Ninja is preferred to MSBuild because of the superior parallelization
capabilities. For coverage, MSBuild is still being used on nightly
builds.

---
TYPE: NO_HISTORY
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.

None yet

4 participants