Skip to content

Conversation

@Keno
Copy link
Member

@Keno Keno commented Jul 18, 2025

This is a prepratory commit for reflecting windows/mingw32 libc information in our binary platforms, as well as adding the basic detection for ucrt in our Makefiles (so it doesn't accidentally try to use binaries with the wrong ABI). Of course there are policy choices to be made about what we want to ship and test. This does not make any of those policy choices, it simply aims to provide the capability to represent these ABIs in case we decide to add them later.

To reflect the possibility of a libc++ difference (mingw comes in both libc++ and libstdc++ flavors these days and the same is true for linux of course, although less prominently so), this adds a new cxxlib abi tag that can be either libstdcxx or libcxx (perhaps msvc in the future, since clang does support that). There is also cxxlib_version. For compatibility the existing libstdcxx_version implies both cxxlib=libstdcxx as well as the corresponding versions. I'm not weeded to this representation, I just figured it was a reasonable first attempt.

Fixes #59009

@Keno Keno requested a review from staticfloat July 18, 2025 05:33
@Keno Keno requested a review from giordano as a code owner July 18, 2025 05:33
@Keno Keno mentioned this pull request Jul 18, 2025
10 tasks
Copy link
Member

@giordano giordano left a comment

Choose a reason for hiding this comment

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

Looks overall reasonable to me, but there are some build and tests failures to be addressed.

)
const libc_mapping = Dict(
"libc_nothing" => "",
"libc_nothing" => "-mingw32", # This is non-specific, our default above uses `msvcrt`
Copy link
Member

Choose a reason for hiding this comment

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

I think this is being applied to macOS and FreeBSD as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

and this dict has two entries with the same key

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, yeah . There's a reason this is WIP/RFC. The question currently is just on the abstract strategy ;)


# For compatibility, libstdcxx_version counts as both cxxlib=libstdcxx and
# cxxlib_version.
if tag == "libstdcxx_version"
Copy link
Member

Choose a reason for hiding this comment

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

@giordano do we have any packages that require building with g++ on macOS? I know we used to, which is why we ship libstdc++ on macOS and open it as part of CSL, but I just loaded WGLMakie and it didn't pick up any libraries that actually use it. If we can actually convince ourselves that we'll never have the situation where most things use libc++ but a few things use libstdc++, then I think we're fine to do this Keno's way. Otherwise, I think we need to have libstdcxx_version and libcxx_version so Julia can express that it is simultaneously loading two different C++ stdlibs.

Copy link
Member

Choose a reason for hiding this comment

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

Just to state it explicitly, mixing C++ implementations is a BAD idea, but one way it can come about and not be fatal is if a library uses C++ internally (and does not take in/give out C++ objects through its API). If you have two such libraries loaded at once, you need to ensure that you're selecting versions of those libraries that agree on the minimum version of libstdc++, despite the fact that 99% of your program is using libc++.

I was under the impression that we did have sub-trees of dependencies running using libstdc++ even on macOS/FreeBSD, but perhaps that is no longer the case and we don't have to fear this anymore.r

Copy link
Member

Choose a reason for hiding this comment

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

do we have any packages that require building with g++ on macOS?

Yes, there are a bunch of packages which do use g++ on macOS.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can we assemble a list. Why are they using g++ do they specifically care about libstdc++ or is there an issue with clang? If the latter, can we try rebuilding them with g++ but linking libc++? gcc should support it.

Copy link
Member

Choose a reason for hiding this comment

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

This is what I found with a quick search (CC=gcc and CMAKE_TARGET_TOOLCHAIN.*gcc):

Unclear why gcc is needed (sometimes it may be due to OpenMP runtime, but unclear just by reading the code):

Can probably be fixed by using LLVMOpenMP for OpenMP runtime:

Because of JuliaPackaging/Yggdrasil#7139 (they claim a newer SDK didn't help, without providing more information):

This is a prepratory commit for reflecting windows/mingw32 libc information
in our binary platforms, as well as adding the basic detection for ucrt in
our Makefiles (so it doesn't accidentally try to use binaries with the
wrong ABI). Of course there are policy choices to be made about what we want
to ship and test. This does not make any of those policy choices, it simply
aims to provide the capability to represent these ABIs in case we decide to
add them later.

To reflect the possibility of a libc++ difference (mingw comes in both libc++
and libstdc++ flavors these days and the same is true for linux of course,
although less prominently so), this adds a new `cxxlib` abi tag that can be
either `libstdcxx` or `libcxx` (perhaps `msvc` in the future, since clang does
support that). There is also `cxxlib_version`. For compatibility the existing
`libstdcxx_version` implies both `cxxlib=libstdcxx` as well as the corresponding
versions. I'm not weeded to this representation, I just figured it was a reasonable
first attempt.

Fixes #59009
@Keno Keno force-pushed the kf/platformupgrades branch from f6635bd to b09e1d9 Compare July 18, 2025 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ABI tags for windows libc, c++ stdlib flavor

5 participants