This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [ci] Add CI configurations for MinGW
ClosedPublic

Authored by mstorsjo on Oct 21 2021, 3:53 AM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Commits
rGf5ca3ac748af: [libcxx] [ci] Add CI configurations for MinGW
Summary

Mention support for MinGW in the docs. Rename the existing windows
CI jobs to Clang-cl, as both Clang-cl and MinGW are equally much
"Windows", just different toolchain environments.

Diff Detail

Event Timeline

mstorsjo created this revision.Oct 21 2021, 3:53 AM
mstorsjo requested review of this revision.Oct 21 2021, 3:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 21 2021, 3:53 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
mstorsjo updated this revision to Diff 385161.Nov 5 2021, 12:45 PM

Rebase on latest main, where there hopefully shouldn't be any more failures.

ldionne requested changes to this revision.Nov 8 2021, 1:52 PM
ldionne added inline comments.
libcxx/utils/ci/buildkite-pipeline.yml
509–510

I would prefer Clang-cl or something like that. For me, MSVC refers to the real MSVC compiler, not the Clang emulation.

libcxx/utils/ci/run-buildbot
630

We don't run the libc++abi tests?

647

It seems to me that the tests should have a dependency on libunwind if we are linking them against the just-built libunwind, no? Ideally we'd fix that in a separate patch before landing this.

This revision now requires changes to proceed.Nov 8 2021, 1:52 PM
mstorsjo added inline comments.Nov 8 2021, 2:10 PM
libcxx/utils/ci/buildkite-pipeline.yml
509–510

Ok, fair enough.

libcxx/utils/ci/run-buildbot
630

No, those don't work on Windows/MinGW yet, afaik.

647

I guess that could be handled with a cmake rule like this:

if (LIBCXXABI_USE_LLVM_UNWINDER)
  list(APPEND LIBCXX_TEST_DEPS unwind)
endif()
mstorsjo added inline comments.Nov 8 2021, 2:46 PM
libcxx/utils/ci/buildkite-pipeline.yml
509–510

Btw, one reason why I first chose to avoid naming it clang-cl, is that when running tests, we actually don’t run the clang-cl compiler fronted, but call the gcc style driver with -target *-windows-msvc. But I guess clang-cl still is close enough, and more concise than “clang in msvc mode”.

mstorsjo updated this revision to Diff 385719.Nov 9 2021, 12:24 AM

Removed the explicit step of building libunwind, relying on D113467 instead. Renamed the old targets from "MSVC" to "Clang-cl".

mstorsjo edited the summary of this revision. (Show Details)Nov 9 2021, 12:25 AM

@ldionne Any further comments on this one, now that the manual build step for libunwind was removed?

ldionne accepted this revision.Nov 16 2021, 8:10 AM
This revision is now accepted and ready to land.Nov 16 2021, 8:10 AM
mstorsjo updated this revision to Diff 387649.Nov 16 2021, 8:12 AM
mstorsjo edited the summary of this revision. (Show Details)

Rerun CI on top of current main.

Sigh, one new test that has been added since this was run in CI last time breaks in this config, so I’ll have to figure out what’s up with that one before this can land…

ldionne accepted this revision.Nov 16 2021, 12:34 PM

FWIW I'd be fine if you XFAILed the single test so we can figure it out later, to avoid delaying this further and possibly introducing more similar issues.

mstorsjo updated this revision to Diff 387743.Nov 16 2021, 1:09 PM

Retry on top of latest main, now with an added XFAIL.

The root cause of the new issue is a combination of known issues with __exclude_from_explicit_instantiation__ in combination with dllimport, together with the fact that we run tests in C++2b mode while the library itself only was built in C++20 mode. (If the library too was built in C++2b mode, the issue wouldn't appear.)

This revision was automatically updated to reflect the committed changes.

(If the library too was built in C++2b mode, the issue wouldn't appear.)

Oh really, do you know why?

(If the library too was built in C++2b mode, the issue wouldn't appear.)

Oh really, do you know why?

As __exclude_from_explicit_instantiation__ doesn't work as intended when dllimport/export is involved, it turns out that all the methods marked with that attribute actually do end up exported by the shared library. So the library built in C++20 mode lacks the method (as the method is only visible in C++2b mode), the test code in C++2b mode sees the new method and uses it (but expects an extern definition in the libc++ DLL due to the explicit template instantiation, as it doesn't honor __exclude_from_explicit_instantiation__).

If the library had been built in C++2b mode, the method would have existed in the library and been found there (even though the intent of the attribute was to use a local instantiation).

(If the library too was built in C++2b mode, the issue wouldn't appear.)

Oh really, do you know why?

As __exclude_from_explicit_instantiation__ doesn't work as intended when dllimport/export is involved, it turns out that all the methods marked with that attribute actually do end up exported by the shared library. So the library built in C++20 mode lacks the method (as the method is only visible in C++2b mode), the test code in C++2b mode sees the new method and uses it (but expects an extern definition in the libc++ DLL due to the explicit template instantiation, as it doesn't honor __exclude_from_explicit_instantiation__).

If the library had been built in C++2b mode, the method would have existed in the library and been found there (even though the intent of the attribute was to use a local instantiation).

Got it, thanks. Yeah the real thing we need to do is fix the damn bug with __exclude_from_explicit_instantiation__.