-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
ci: Fix llvm static linking on macOS CI #10879
Conversation
Codecov Report
@@ Coverage Diff @@
## master #10879 +/- ##
==========================================
- Coverage 68.09% 61.19% -6.91%
==========================================
Files 404 203 -201
Lines 86713 42417 -44296
Branches 19209 8753 -10456
==========================================
- Hits 59048 25955 -33093
+ Misses 23190 14436 -8754
+ Partials 4475 2026 -2449
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
LLVM is detected and used just fine -- the problem is that the static archive contains contents which are effectively invalid (the toolchain errors out claiming that it has the wrong "producer"). This occurs only for static linkage -- it's a bug in homebrew's most recent LLVM update, I figured out the problem when I stumbled across a cmake project that had the same error. A Homebrew developer (@carlocab) stated that it's intentional, because making the static libraries be bitcode-only produces speedups for the shared use case due to the intricacies of the LLVM build system. Or something. But there's a thought about post-processing that to make non-bitcode archives which can be generically linked against. |
f80e153
to
2c11b52
Compare
@eli-schwartz yes, I figured that once I saw the test failure again. According to Homebrew/discussions#3666 (comment), we should use |
2c11b52
to
6776820
Compare
With that fixed, it hangs while linking (statically to llvm). Very weird behaviour... I think I will add a separate job that only tests Opening a separate PR for the linker detection: #10880 |
6776820
to
87abcdc
Compare
87abcdc
to
cfa4c9c
Compare
Downgrade to LLVM-14 from LLVM-15 which is somewhat broken when using static linking at present: Homebrew/discussions#3666 (comment) We can't use LLVM's lld instead of ld on macOS because we don't detect it as an Apple linker and pass --as-needed etc to it. Even when that is fixed and we set -lto_library etc correctly, the linker just hangs. LLVM@14 is keg-only, so we need to add CPPFLAGS / LDFLAGS to the keg subdir inside /usr/local The LLVM@15 test is shared-only now and moved to the qt4 macOS job.
cfa4c9c
to
5a166f9
Compare
Yep, working on a fix, but I'll need a little more time. Sorry for the pain. In the meantime, using |
It's fine, comes with the territory. If you want to test with meson, you'll probably want #10880. |
This is blocking the 0.63.3 stable release, so I am merging this now to unblock myself. |
Well, this is officially LGTM anyway. ;) |
Fix in Homebrew/homebrew-core#112154. |
In Homebrew#106925, I enabled LTO for our LLVM build. This creates static archives that contain LLVM bitcode instead of object code. This makes the static archives more difficult to use, requiring workarounds such as https://github.com/Homebrew/homebrew-core/blob/c01f1794fc3decce04b71cae03966213fc7af34d/Formula/enzyme.rb#L30 and has caused problems for multiple downstream projects. We can fix this by converting the bitcode into object code, which is what Fedora does with their LLVM build. They also build their toolchain with LTO. Alternatively, we can disable LTO, but that foregoes significant speedups we get from enabling it. While we're here, let's add some test coverage for features that were recently enabled that we don't test. Fixes: ziglang/zig#12923 halide/Halide#7055 mesonbuild/meson#10879 Homebrew/discussions#3666
In #106925, I enabled LTO for our LLVM build. This creates static archives that contain LLVM bitcode instead of object code. This makes the static archives more difficult to use, requiring workarounds such as https://github.com/Homebrew/homebrew-core/blob/c01f1794fc3decce04b71cae03966213fc7af34d/Formula/enzyme.rb#L30 and has caused problems for multiple downstream projects. We can fix this by converting the bitcode into object code, which is what Fedora does with their LLVM build. They also build their toolchain with LTO. Alternatively, we can disable LTO, but that foregoes significant speedups we get from enabling it. While we're here, let's add some test coverage for features that were recently enabled that we don't test. Fixes: ziglang/zig#12923 halide/Halide#7055 mesonbuild/meson#10879 Homebrew/discussions#3666 Closes #112154. Signed-off-by: Sean Molenaar <1484494+SMillerDev@users.noreply.github.com> Signed-off-by: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>
Downgrade to LLVM-14 from LLVM-15 which is somewhat broken when using
static linking at present:
Homebrew/discussions#3666 (comment)
We can't use LLVM's lld instead of ld on macOS because we don't detect
it as an Apple linker and pass --as-needed etc to it. Even when that
is fixed and we set -lto_library etc correctly, the linker just hangs.
The LLVM@15 test is shared-only now and moved to the qt4 macOS job.