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 15.0.0 #106925

Closed
wants to merge 40 commits into from
Closed

llvm 15.0.0 #106925

wants to merge 40 commits into from

Conversation

carlocab
Copy link
Member

  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

The last version bump took ages, so I'd like to get started early to try to get it done faster this time.

Things I'd like to fix along the way:

  1. Avoiding mixed linkage with system libc++ and the bundled libc++
  2. Broken Python bindings -- they can't find libLLVM and libclang

I have ideas for how to fix the above two, but I've written these issues down here so I don't forget. Nevertheless, suggestions on how to fix them welcome.

@BrewTestBot BrewTestBot added long build Needs CI-long-timeout python Python use is a significant feature of the PR or issue labels Jul 30, 2022
@carlocab carlocab added the prerelease-testing Pull request from upstream, testing a pre-release with homebrew dependencies label Jul 30, 2022
@BrewTestBot BrewTestBot added the automerge-skip `brew pr-automerge` will skip this pull request label Jul 30, 2022
@carlocab carlocab mentioned this pull request Aug 13, 2022
6 tasks
@cho-m cho-m added the CI-linux-self-hosted Build on Linux self-hosted runner label Aug 16, 2022
@carlocab carlocab changed the title llvm 15.0.0-rc1 llvm 15.0.0-rc2 Aug 18, 2022
Formula/llvm.rb Outdated
Comment on lines 67 to 84
# Linking with these causes you subtle problems on macOS,
# since everything loads `/usr/lib/libc++.1.dylib`.
# https://github.com/Homebrew/homebrew-core/issues/96915
runtimes += %w[libcxx libcxxabi] if OS.linux?
Copy link
Member Author

Choose a reason for hiding this comment

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

Thoughts on this, @Bo98?

On the one hand, I feel like it might be a bit of an overreaction. On the other, we already prefer linking with /usr/lib/libc++.1.dylib anyway, so it's not like we have much use for these...

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, I can move this up into the else block above. I'll do so on the next run.

Copy link
Member

@Bo98 Bo98 Aug 20, 2022

Choose a reason for hiding this comment

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

I agree that these need to go. Or if for some reason they need to ship, then they cannot live in lib anymore.

Ideally the C++ headers would stay however, since I think those are necessary for clang++ usage on < 10.15.3 SDK and shouldn't affect anything on newer SDKs.

Copy link
Member

@Bo98 Bo98 Aug 20, 2022

Choose a reason for hiding this comment

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

Alternative is to symlink the C++ header directory to the CLT header directory. Not entirely sure what would work better.

Copy link
Member Author

@carlocab carlocab Aug 20, 2022

Choose a reason for hiding this comment

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

I'm still a little sceptical that this is the right solution, though, since there's been lots of use of the bundled libc++, even in other formulae (despite our efforts to avoid it). So I don't think the issue is that you're linking with two versions of libc++ -- that's been happening for a long time.

Copy link
Member Author

Choose a reason for hiding this comment

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

Trying this.

Though, the scan-build test is failing, even after trying to point it to bin/"clang". Seems to be libc++-related, since it didn't fail when I removed libc++.

Copy link
Member

Choose a reason for hiding this comment

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

Moving libc++ might end up fixing that, we'll see.

Copy link
Member

Choose a reason for hiding this comment

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

Oh wait, didn't notice it's already failing with the change. Does LLVM 14 fail with a similar absolute clang reference?

Copy link
Member Author

Choose a reason for hiding this comment

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

Does LLVM 14 fail with a similar absolute clang reference?

It does not. It works with an unqualified clang++ or a bin/"clang++".

Copy link
Member Author

Choose a reason for hiding this comment

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

Error looks related to libc++ headers.

@carlocab carlocab added CI-long-timeout Use longer GitHub Actions CI timeout. CI-no-fail-fast Continue CI tests despite failing GitHub Actions matrix builds. labels Aug 20, 2022
Formula/llvm.rb Outdated Show resolved Hide resolved
@carlocab
Copy link
Member Author

macOS build fails with

CMake Error at /tmp/llvm-20220820-87389-nfadr9/llvm-project-15.0.0rc2.src/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake:73 (message):
  Failed to determine SDK version for "iphonesimulator" SDK
Call Stack (most recent call first):
  /tmp/llvm-20220820-87389-nfadr9/llvm-project-15.0.0rc2.src/compiler-rt/cmake/builtin-config-ix.cmake:120 (find_darwin_sdk_version)
  CMakeLists.txt:51 (include)

@carlocab
Copy link
Member Author

Linux fails at building OpenMP with:

/tmp/llvm-20220820-9038-1vp6qle/llvm-project-15.0.0rc2.src/openmp/libomptarget/plugins/amdgpu/impl/system.cpp:8:10: fatal error: 'libelf.h' file not f
ound
#include <libelf.h>
         ^~~~~~~~~~

@carlocab carlocab force-pushed the llvm-15-rc1 branch 3 times, most recently from 80a4c56 to 08f39a8 Compare August 20, 2022 13:11
Formula/llvm.rb Outdated

if OS.mac?
args << "-DLLVM_BUILD_LLVM_C_DYLIB=ON"
args << "-DLLVM_ENABLE_LIBCXX=ON"
args << "-DDEFAULT_SYSROOT=#{macos_sdk}" if macos_sdk
runtimes_cmake_args << "-DCMAKE_INSTALL_RPATH=#{rpath}"
# Disable builds for OSes not supported by the CLT SDK.
runtimes_cmake_args += %w[I WATCH TV].map { |os| "-DCOMPILER_RT_ENABLE_#{os}OS=OFF" }
Copy link
Member

Choose a reason for hiding this comment

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

I WATCH TV

😄

What's changed here though to need this?

Copy link
Member Author

Choose a reason for hiding this comment

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

This llvm/llvm-project@a680c21 seems to lead to #106925 (comment).

(Yes, I chuckled at I WATCH TV too. Though really only the I is potentially needed right now.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, I'm not sure why this is failing. find_darwin_sdk_version runs xcrun --sdk iphonesimulator --show-sdk-version and checks that it returns 0. I tried this on an ARM runner and it seems to work.

Is it because we set DEVELOPER_DIR or something?

Copy link
Member Author

Choose a reason for hiding this comment

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

I suppose we could just require Xcode to build this again...

Copy link
Member

@Bo98 Bo98 Aug 20, 2022

Choose a reason for hiding this comment

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

I think you're correct. It'll probably be an issue for CLT-only systems too.

I suppose we could just require Xcode to build this again...

I'd rather not.

Copy link
Member

@Bo98 Bo98 Aug 20, 2022

Choose a reason for hiding this comment

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

You probably won't be able to submit apps for those platforms when built with Homebrew LLVM so I don't think this is an issue. Was just mostly interested why it broke.

Homebrew is also a macOS package manager and offer no iOS support in anything else we ship.

Copy link
Member Author

Choose a reason for hiding this comment

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

You probably won't be able to submit apps for those platforms when built with Homebrew LLVM so I don't think this is an issue. Was just mostly interested why it broke.

Maybe not, but it might be nice to have access to sanitisers, etc, for debugging.

Homebrew is also a macOS package manager and offer no iOS support in anything else we ship.

Can we force this to use the Xcode SDK if it's available but fall back to the CLT and disable iOS builds if not?

Copy link
Member

Choose a reason for hiding this comment

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

We could but it's tricky to selectively apply it to just iOS etc SDKs.

Setting DARWIN_iphonesimulator_OVERRIDE_SDK_VERSION (etc) is possible however. It seems like before it might have just auto-disabled if the SDK is not available (maybe? - need to check) so this feels like a bit of a regression anyway and I don't think it should be a fatal error. Maybe worth comparing the bottle with a CLT-only build at some point.

Formula/llvm.rb Show resolved Hide resolved
@chenrui333 chenrui333 removed the CI-long-timeout Use longer GitHub Actions CI timeout. label Aug 20, 2022
@carlocab carlocab added the CI-long-timeout Use longer GitHub Actions CI timeout. label Aug 21, 2022
@carlocab
Copy link
Member Author

ARM Monterey failures:

Error: 41 failed steps!
brew linkage --test c2rust
brew test --retry --verbose c2rust
brew linkage --test castxml
brew test --retry --verbose castxml
brew linkage --test ccls
brew test --retry --verbose ccls
brew linkage --test chapel
brew test --retry --verbose chapel
brew linkage --test clazy
brew test --retry --verbose clazy
brew linkage --test coin3d
brew linkage --test crystal
brew test --retry --verbose crystal
brew linkage --test csound
brew test --retry --verbose csound
brew test --retry --verbose dpp
brew linkage --test enzyme
brew test --retry --verbose enzyme
brew linkage --test faust
brew test --retry --verbose faust
brew linkage --test halide
brew test --retry --verbose halide
brew linkage --test include-what-you-use
brew test --retry --verbose include-what-you-use
brew linkage --test ispc
brew test --retry --verbose ispc
brew linkage --test ldc
brew test --retry --verbose ldc
brew linkage --test nvc
brew linkage --test odin
brew test --retry --verbose odin
brew linkage --test pocl
brew test --retry --verbose pocl
brew linkage --test pyside
brew linkage --test pyside@2
brew linkage --test rtags
brew test --retry --verbose scry
brew linkage --test spirv-llvm-translator
brew test --retry --verbose spirv-llvm-translator
brew linkage --test standardese
brew linkage --test symengine

ARM Big Sur failures are similar.

Every linkage failure I looked at is for libc++. The test failures are due to missing symbols in libLLVM, which is typical.

@fxcoudert fxcoudert removed the CI-long-timeout Use longer GitHub Actions CI timeout. label Aug 21, 2022
@carlocab
Copy link
Member Author

macOS failures all look pretty similar, except Catalina, which failed to build.

@carlocab carlocab added the CI-long-timeout Use longer GitHub Actions CI timeout. label Aug 21, 2022
carlocab added a commit to carlocab/homebrew-core that referenced this pull request Sep 19, 2022
carlocab added a commit to carlocab/homebrew-core that referenced this pull request Sep 19, 2022
carlocab added a commit to carlocab/homebrew-core that referenced this pull request Sep 19, 2022
carlocab added a commit to carlocab/homebrew-core that referenced this pull request Sep 19, 2022
carlocab added a commit to carlocab/homebrew-core that referenced this pull request Sep 19, 2022
carlocab added a commit to carlocab/homebrew-core that referenced this pull request Sep 19, 2022
carlocab added a commit to carlocab/homebrew-core that referenced this pull request Sep 19, 2022
carlocab added a commit to carlocab/homebrew-core that referenced this pull request Sep 19, 2022
carlocab added a commit to carlocab/homebrew-core that referenced this pull request Sep 19, 2022
We don't need to carry around this build-time resource anymore. The
issue that required this has been fixed in Homebrew#106925.
carlocab added a commit that referenced this pull request Sep 19, 2022
This is no longer needed after #106925.
carlocab added a commit that referenced this pull request Sep 19, 2022
This is no longer needed after #106925.
carlocab added a commit that referenced this pull request Sep 19, 2022
This is no longer needed after #106925.
carlocab added a commit that referenced this pull request Sep 19, 2022
This is no longer needed after #106925.
carlocab added a commit that referenced this pull request Sep 19, 2022
This is no longer needed after #106925.
carlocab added a commit that referenced this pull request Sep 19, 2022
This is no longer needed after #106925.
carlocab added a commit that referenced this pull request Sep 19, 2022
This is no longer needed after #106925.
carlocab added a commit that referenced this pull request Sep 19, 2022
This is no longer needed after #106925.
carlocab added a commit that referenced this pull request Sep 19, 2022
This is no longer needed after #106925.
carlocab added a commit that referenced this pull request Sep 19, 2022
This is no longer needed after #106925.
carlocab added a commit that referenced this pull request Sep 19, 2022
This is no longer needed after #106925.
carlocab added a commit that referenced this pull request Sep 19, 2022
This is no longer needed after #106925.
carlocab added a commit that referenced this pull request Sep 19, 2022
This is no longer needed after #106925.
carlocab added a commit that referenced this pull request Sep 19, 2022
We don't need to carry around this build-time resource anymore. The
issue that required this has been fixed in #106925.
carlocab added a commit to carlocab/homebrew-core that referenced this pull request Oct 2, 2022
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
BrewTestBot pushed a commit that referenced this pull request Oct 3, 2022
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>
@github-actions github-actions bot added the outdated PR was locked due to age label Oct 20, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
automerge-skip `brew pr-automerge` will skip this pull request CI-linux-self-hosted Build on Linux self-hosted runner CI-no-fail-fast Continue CI tests despite failing GitHub Actions matrix builds. linux/drop-gcc-dependency long build Needs CI-long-timeout no long build conflict Do not allow merging other pull requests when files conflict with this one outdated PR was locked due to age python Python use is a significant feature of the PR or issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet