这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@Galaxy4594
Copy link
Contributor

Fixes #4445, although it doesn't really address the sjpeg issue. Also, I'm not sure if this happens outside of Windows, so the WIN32 check might be unnecessary.

Copy link
Contributor

@eustas eustas left a comment

Choose a reason for hiding this comment

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

IMHO, it would be better to fail rather than disable. It is easy to miss warning message.
Let's mention in message what extra flags are required for build and make it FATAL.

@Galaxy4594
Copy link
Contributor Author

Galaxy4594 commented Sep 23, 2025

Learning from #4445 (comment). I added a check to determine if Clang and LTO are used, then making if FATAL if CLANG64 is not used.

@Galaxy4594 Galaxy4594 marked this pull request as ready for review September 23, 2025 02:07
@Andarwinux
Copy link

Learning from #4445 (comment). I added a check to determine if Clang and LTO are used, then making if FATAL if CLANG64 is not used.

This is not acceptable, because it would break everything outside of msys2, such as llvm-mingw.

The real issue here is that gcc/libstdc++ in msys2 uses emutls, while LLVM currently cannot correctly handle emutls during LTO code generation.

Newer versions of gcc/libstdc++ have already implemented native tls, but msys2 has not switched to native tls yet, since that would completely change the ABI.

The correct approach is to detect whether the compiler uses native tls or emutls. Of course, this may be difficult to achieve. Given the current state of the mingw ecosystem, as a fallback it would be acceptable to simply detect the C++ STL implementation, since at least for libc++ there is no problem whether emutls or native tls is used.

@Galaxy4594
Copy link
Contributor Author

Galaxy4594 commented Sep 29, 2025

TIL, well that's annoying, I didn't know the MinGW ecosystem was so fractured, with many small crucial details between toolchains/versions. Unfortunately, I don't have the time to invest in fixing this since college classes have started for me. 😔

Does msys2 plan to fully switch native tls anytime soon? I really like using msys2, I'm curious about its future.

@eustas what would be the best way to approach this problem?

@Galaxy4594 Galaxy4594 marked this pull request as draft September 29, 2025 21:02
@Andarwinux
Copy link

Does msys2 plan to fully switch native tls anytime soon? I really like using msys2, I'm curious about its future.

I'm not sure. Because this would change the ABI, and they'd need to rebuild everything for that.

I recommend using clang64 and clangarm64, as they already uses native tls.

TIL, well that's annoying, I didn't know the MinGW ecosystem was so fractured, with many small crucial details between toolchains/versions.

see https://www.msys2.org/docs/environments

I recommend to detect the STL implementation used by the compiler via _LIBCPP_VERSION (libc++) and __GLIBCXX__ (libstdc++)
For the combination of MinGW + libstdc++ + clang + LTO, issue a warning that there may be potential problem.

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.

Compiling libjxl with clang and LTO is broken in mingw

3 participants