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

llvm: build pure llvm toolchain + zig: enable mingw64 & ucrt64 #21485

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

raedrizqie
Copy link
Contributor

@raedrizqie raedrizqie commented Jul 24, 2024

  • builds a pure llvm toolchain on top of MinGW
  • builds libc++ and libunwind with builtin compiler-rt on all systems
  • emulated TLS is disabled when building with Clang
  • remove dependency of libgcc_s and libpthread on non Clang systems
  • fix building of libc++abi shared library

Notes:
We previously build with -DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON which actually leads to libc++ not depends on libunwind, with both libc++ and libunwind exporting the same unwind functions.

If we set -DLIBCXXABI_ENABLE_STATIC_UNWINDER=OFF, then libc++ will correctly depends on libunwind.

@ognevny
Copy link
Collaborator

ognevny commented Jul 25, 2024

without target triple zig compiler segfaulted for me. why did you remove it?

@raedrizqie
Copy link
Contributor Author

raedrizqie commented Jul 25, 2024

im so confused right now.. on clang, it will always fails at build() step.. mingw works fine though

2024-07-25T04:42:45.6816477Z ==> Starting build()...
2024-07-25T04:42:45.7760069Z ==> ERROR: A failure occurred in build().

@raedrizqie raedrizqie force-pushed the llvm-pure branch 2 times, most recently from d0da9f9 to bf0445d Compare July 25, 2024 12:25
@ArchGuyWu
Copy link
Contributor

im so confused right now.. on clang, it will always fails at build() step.. mingw works fine though

2024-07-25T04:42:45.6816477Z ==> Starting build()...
2024-07-25T04:42:45.7760069Z ==> ERROR: A failure occurred in build().

I downloaded your PKGBUILD file for mingw-w64-clang-x86_64-zig, and built it locally.

your PKGBUILD file:
PKGBUILD.txt

the built package:
mingw-w64-clang-x86_64-zig-0.13.0-2-any.pkg.tar.zst.zip

the build script (powershell):
makepkg.txt

@raedrizqie
Copy link
Contributor Author

raedrizqie commented Aug 2, 2024

yes, zig will build fine under current libc++ on this repo, but clang from this PR will fail to load with the new libc++ from this PR.

edit: its not clang, but cmake that failed to load with the new libc++.

@raedrizqie raedrizqie marked this pull request as ready for review August 4, 2024 06:00
@raedrizqie raedrizqie force-pushed the llvm-pure branch 2 times, most recently from 1e86213 to 99720b8 Compare August 4, 2024 11:45
@raedrizqie raedrizqie closed this Aug 4, 2024
@raedrizqie raedrizqie reopened this Aug 4, 2024
@raedrizqie
Copy link
Contributor Author

@lazka please review

fi

# Targeting Win 7 will just lead to libc++ looking
# up new APIs at runtime, so there is no downside really
local _win32_winnt
if [[ ${MSYSTEM} == CLANGARM64 ]]; then
if [[ ${MSYSTEM} == CLANG* ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

@raedrizqie raedrizqie Aug 7, 2024

Choose a reason for hiding this comment

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

i hit linker errors from undefined stdlib implementations (_free, _memcpy, etc) when compiling ruby v3.3.4 on clang32 system.. just want to experiment something here..

Copy link
Collaborator

@ognevny ognevny Aug 7, 2024

Choose a reason for hiding this comment

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

it also makes sense as UCRT is available only in Windows 10 or later (I forgot it at the moment)

@lazka
Copy link
Member

lazka commented Aug 9, 2024

@lazka please review

I'm afraid I don't know enough about llvm to know what this is trying to change any why, so I can't. And llvm is too much of a core package to just press merge and see.

@raedrizqie
Copy link
Contributor Author

raedrizqie commented Aug 10, 2024

this change is needed to make zig build on mingw64 and ucrt64, because zig needs llvm with builtin compiler-rt

- builds a pure llvm toolchain on top of MinGW
- builds libc++ and libunwind with builtin compiler-rt on all systems
- emulated TLS is disabled when building with Clang
- remove dependency of libgcc_s and libpthread on non Clang systems
- fix building of libc++abi shared library
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.

4 participants