-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add libunwind
to the toolchain
#3
base: master
Are you sure you want to change the base?
Conversation
* add rules_foreign_cc 0.9.0 * add cmake(...) rule to BUILD.llvm-raw that builds libunwind * include libunwind.a in the disk
@ParkMyCar hi! Thanks for giving this a shot. I haven't had great luck in the past with rules_cmake, we saw In terms of getting this building, I'm not sure about your local error, I suspect it wasn't the same as the RBE one. Can you include it? For the one you hit on Buildbuddy, it has to do with the cross-compilation toolchains not being setup correctly. Note from the error, RBE is invoking the darwin x86_64 compiler, but the executor is Linux ;) When building from Mac, I suggest to run build_docker.sh. That way the host will be detected as linux, and the toolchain selection should work better. |
Ahhh yeah we've run into similar issues with rules_cmake :) It seems to be working for now though, and definitely more than happy to put it only in non-minimal! Sweet thanks for the tips! I'll try running locally with Also I realized we could probably build libcxx and libcxxabi in the same way, any thoughts on including those in non-minimal as well? That should fix #1 entirely then? |
I think I'm ok with them going in non-minimal if we can prevent the segfaults and if they build correctly in RBE. |
MacOS 15 I just ran full tilt into this issue of missing libunwind. My MODULE.bazel:
Then a local build throws this error:
The regular LLVM distro compiles the repo just fine so it would be great to get libunwind to this toolchain. |
I wrote some BUILD files for libunwind here: 5fcd53b#diff-250cf229a385f1287e3e2f86607f15328ab80302918e91bade694aca33d0b004R21 @marvin-hansen could you possibly make me a small repro that I can play with? I want to make sure I include the libs in the right place in the archive (and also that they actually work for linking the end binary) |
@dzbarsky , here you go: https://github.com/marvin-hansen/bazel_rust_cross_llvm There are three branches:
The main branch builds as expected with the other two currently both failing with the missing libunwind error. The Readme contains a few more notes, but in a nutshell, the repro is based on a cross compiling example I made recently so it comes with a bunch of common dependencies and tests that all build on Mac and Linux. The tests check binaries build for Linux on Arm and Intel.
Should get you covered on each branch. Hope that helps. |
so what is missing? |
Just as quick follow up,
In the end, I've compiled clang specifically for my CI provider using their
new default CI image mainly to get around some libc incompatibility. Be
warned, on the default GH action runner this may take between 2 to 4 hours.
https://github.com/marvin-hansen/buildbuddy-clang
I've forked the GitHub action and Dockerfile from @parker who did a
fantastic job setting this up. If you don't have a libc picky CI image, you
can easily use his excellent clang builds.
…On Thu, Feb 6, 2025 at 16:38 Kreijstal ***@***.***> wrote:
so what is missing?
—
Reply to this email directly, view it onGitHub
<#3 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFYR7XBOQTJOEWPDJGMPCXD2OMNQ5AVCNFSM6AAAAABK3YQRM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMZZGE3DEOBSGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
ah so it isn't static? |
Well, no because for me reduced download and unzip time was more important to cut my CI time. Although if you modify the build container, you might be able to compile clang fully statically. |
Progress towards #1
This PR adds
libunwind
to the toolchain by building it withcmake
viarules_foreign_cc
.libunwind
is an important runtime library for the clang toolchain (docs) and AFAIK is not natively included with macOS. Compiled it is <100Kb so I don't believe it will increase the size of the bundle.Using my local machine's C toolchain I verified the
libunwind
build succeeds, but I can't get the bundledzig-cc
toolchain to work. I also tried creating a free Buildbuddy account but that failed with the following error:@dzbarsky if you can provide guidance for these errors I would be more than happy to get this building locally!