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 lld flang 19.1.1 #192505

Merged
merged 6 commits into from
Oct 3, 2024
Merged

llvm lld flang 19.1.1 #192505

merged 6 commits into from
Oct 3, 2024

Conversation

carlocab
Copy link
Member

@carlocab carlocab commented Oct 1, 2024

  • 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 HOMEBREW_NO_INSTALL_FROM_API=1 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 HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

  • llvm 19.1.1
  • lld 19.1.1
  • flang 19.1.1

@carlocab carlocab added long build Set a long timeout for formula testing CI-no-fail-fast-deps Continue dependent tests despite failing GitHub Actions matrix tests. labels Oct 1, 2024
@cho-m
Copy link
Member

cho-m commented Oct 1, 2024

Based on https://github.com/orgs/Homebrew/discussions/5631, we probably should disable EH since we now ship Flang.

-DLLVM_ENABLE_EH=ON

This is how other repositories that ship flang build llvm. We are doing a bit of a hack by setting -D LLVM_ENABLE_EH=OFF which gets overridden when running find_package(LLVM ...) which allows us to bypass the error while still linking with exception symbols.

Other References:

  1. https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/flang/CMakeLists.txt#L17-L23
  2. flang build not enforcing style guidelines llvm/llvm-project#59353
  3. https://discourse.llvm.org/t/compiling-with-flang-new/66808
  4. https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/llvm/package.py#L846-L854

EDIT: If we want to keep it on, may need to add at minimum some caveats or perhaps some workarounds as our build is non-standard.

@carlocab
Copy link
Member Author

carlocab commented Oct 2, 2024

I'd just follow what Fedora are doing. LLVM's lead maintainer and one (out of two) of the LLVM release managers maintain the Fedora packages.

But if we want to turn off EH and/or RTTI (though IIRC RTTI requires EH -- but maybe it was the other way around), I would suggest saving it for LLVM 20 because changing those settings will require recompiling everything that links to libLLVM.

@cho-m
Copy link
Member

cho-m commented Oct 2, 2024

Actually my comment was wrong and Fedora does disable. I confirmed by downloading RPM12 and checking LLVMConfig.cmake

set(LLVM_ENABLE_ASSERTIONS OFF)

set(LLVM_ENABLE_EH OFF)

set(LLVM_ENABLE_FFI TRUE)
if(LLVM_ENABLE_FFI)
  find_package(FFI)
endif()

set(LLVM_ENABLE_RTTI ON)

Footnotes

  1. https://koji.fedoraproject.org/koji/buildinfo?buildID=2549315

  2. https://kojipkgs.fedoraproject.org//packages/llvm/19.1.0/1.fc42/aarch64/llvm-devel-19.1.0-1.fc42.aarch64.rpm

@carlocab
Copy link
Member Author

carlocab commented Oct 2, 2024

@cho-m
Copy link
Member

cho-m commented Oct 2, 2024

That's weird, since their spec files show LLVM_ENABLE_EH=ON:

Looks like it may be arch-specific. x86_64 rpm does have it enabled:

set(LLVM_ENABLE_ASSERTIONS OFF)

set(LLVM_ENABLE_EH ON)

set(LLVM_ENABLE_FFI TRUE)
if(LLVM_ENABLE_FFI)
  find_package(FFI)
endif()

set(LLVM_ENABLE_RTTI ON)

Anyway, I think the upstream CMake check (llvm/llvm-project@f7e58c9) wasn't tested on Standalone mode which is why it currently works.

There should probably be a caveat as CMake LLVMFlang can't handle our flang which is usually a bad sign.

@carlocab
Copy link
Member Author

carlocab commented Oct 2, 2024

We could just create a wrapper script that always adds -l[std]c++ 🤷 Or perhaps a config file next to it (when installed in libexec) that isn't linked to bin.

Setting LLVM_ENABLE_EH could be a big change. Probably worth opening an issue/discussion for feedback, plus a note in caveats linking to the issue/discussion. Then if no one complains we can set it to OFF for LLVM 20.

CC @Bo98 for thoughts.

@Bo98
Copy link
Member

Bo98 commented Oct 2, 2024

Setting LLVM_ENABLE_EH could be a big change.

It can affect ABI at least. Though I also agree we should try disable it & RTTI.

LLVM 20 is definitely a good time to make changes. Somewhat relatedly: perhaps worth considering if libcxx probably should be split to a separate formula. We've had regular bug reports about it since the LLVM C++ headers got prioritised again.

@carlocab
Copy link
Member Author

carlocab commented Oct 2, 2024

Or perhaps a config file next to it (when installed in libexec) that isn't linked to bin.

Testing creating a libexec/"bin/flang.cfg" that contains only -lc++. Seems to work. Will add it in a follow-up, plus some caveats. #192611

carlocab added a commit that referenced this pull request Oct 2, 2024
This addresses issues users have had at Homebrew/discussions#5631.

See also discussion at #192505.

We could probably rebuild LLVM with `LLVM_ENABLE_EH=OFF`, but that
breaks the ABI so we should save it for LLVM 20 at the earliest.
@carlocab carlocab added the CI-no-fail-fast Continue CI tests despite failing GitHub Actions matrix builds. label Oct 2, 2024
Also:
- remove the `zstd` and `zlib` dependencies since there's no actual
  linkage
- reduce the scope of the `llvm` method to a variable in `install`
carlocab added a commit that referenced this pull request Oct 2, 2024
This addresses issues users have had at Homebrew/discussions#5631.

See also discussion at #192505.

We could probably rebuild LLVM with `LLVM_ENABLE_EH=OFF`, but that
breaks the ABI so we should save it for LLVM 20 at the earliest.
carlocab added a commit that referenced this pull request Oct 3, 2024
Adding a system config file will allow us to stop baking in the
`DEFAULT_SYSROOT` and allow users on Xcode-only installations to use the
bottles. It will also make it easier to update this value when users
upgrade the major version of their macOS. Before this change, this
required a full reinstall. After, users will simply have to
`brew postinstall llvm`.

The config file change requires an upstream patch. We'll probably have
to wait a little bit for it to merge, and then wait another few days to
make sure it doesn't get reverted.

Following discussion at #192505, let's also update the caveats to notify
users of potential changes regarding `LLVM_ENABLE_EH` in LLVM 20.
carlocab added a commit that referenced this pull request Oct 3, 2024
Adding a system config file will allow us to stop baking in the
`DEFAULT_SYSROOT` and allow users on Xcode-only installations to use the
bottles. It will also make it easier to update this value when users
upgrade the major version of their macOS. Before this change, this
required a full reinstall. After, users will simply have to
`brew postinstall llvm`.

The config file change requires an upstream patch. We'll probably have
to wait a little bit for it to merge, and then wait another few days to
make sure it doesn't get reverted.

Following discussion at #192505, let's also update the caveats to notify
users of potential changes regarding `LLVM_ENABLE_EH` in LLVM 20.
@carlocab
Copy link
Member Author

carlocab commented Oct 3, 2024

afl++ bakes in Cellar paths. Will have a fix separately.

Copy link
Contributor

github-actions bot commented Oct 3, 2024

carlocab added a commit that referenced this pull request Oct 3, 2024
Seen while testing dependents at #192505.
@github-actions github-actions bot added the CI-published-bottle-commits The commits for the built bottles have been pushed to the PR branch. label Oct 3, 2024
@BrewTestBot BrewTestBot added this pull request to the merge queue Oct 3, 2024
Merged via the queue into master with commit c2c2cbc Oct 3, 2024
15 checks passed
@BrewTestBot BrewTestBot deleted the llvm-lld-flang-19.1.1 branch October 3, 2024 14:37
carlocab added a commit that referenced this pull request Oct 3, 2024
Seen while testing dependents at #192505.
carlocab added a commit that referenced this pull request Oct 3, 2024
This addresses issues users have had at Homebrew/discussions#5631.

See also discussion at #192505.

We could probably rebuild LLVM with `LLVM_ENABLE_EH=OFF`, but that
breaks the ABI so we should save it for LLVM 20 at the earliest.
carlocab added a commit that referenced this pull request Oct 3, 2024
Seen while testing dependents at #192505.
carlocab added a commit that referenced this pull request Oct 3, 2024
This addresses issues users have had at Homebrew/discussions#5631.

See also discussion at #192505.

We could probably rebuild LLVM with `LLVM_ENABLE_EH=OFF`, but that
breaks the ABI so we should save it for LLVM 20 at the earliest.
carlocab added a commit that referenced this pull request Oct 3, 2024
This addresses issues users have had at Homebrew/discussions#5631.

See also discussion at #192505.

We could probably rebuild LLVM with `LLVM_ENABLE_EH=OFF`, but that
breaks the ABI so we should save it for LLVM 20 at the earliest.
carlocab added a commit that referenced this pull request Oct 4, 2024
Adding a system config file will allow us to stop baking in the
`DEFAULT_SYSROOT` and allow users on Xcode-only installations to use the
bottles. It will also make it easier to update this value when users
upgrade the major version of their macOS. Before this change, this
required a full reinstall. After, users will simply have to
`brew postinstall llvm`.

The config file change requires an upstream patch. We'll probably have
to wait a little bit for it to merge, and then wait another few days to
make sure it doesn't get reverted.

Following discussion at #192505, let's also update the caveats to notify
users of potential changes regarding `LLVM_ENABLE_EH` in LLVM 20.
carlocab added a commit that referenced this pull request Oct 4, 2024
Adding a system config file will allow us to stop baking in the
`DEFAULT_SYSROOT` and allow users on Xcode-only installations to use the
bottles. It will also make it easier to update this value when users
upgrade the major version of their macOS. Before this change, this
required a full reinstall. After, users will simply have to
`brew postinstall llvm`.

The config file change requires an upstream patch. We'll probably have
to wait a little bit for it to merge, and then wait another few days to
make sure it doesn't get reverted.

Following discussion at #192505, let's also update the caveats to notify
users of potential changes regarding `LLVM_ENABLE_EH` in LLVM 20.
carlocab added a commit that referenced this pull request Oct 4, 2024
Adding a system config file will allow us to stop baking in the
`DEFAULT_SYSROOT` and allow users on Xcode-only installations to use the
bottles. It will also make it easier to update this value when users
upgrade the major version of their macOS. Before this change, this
required a full reinstall. After, users will simply have to
`brew postinstall llvm`.

The config file change requires an upstream patch. We'll probably have
to wait a little bit for it to merge, and then wait another few days to
make sure it doesn't get reverted.

Following discussion at #192505, let's also update the caveats to notify
users of potential changes regarding `LLVM_ENABLE_EH` in LLVM 20.
carlocab added a commit that referenced this pull request Oct 5, 2024
Adding a system config file will allow us to stop baking in the
`DEFAULT_SYSROOT` and allow users on Xcode-only installations to use the
bottles. It will also make it easier to update this value when users
upgrade the major version of their macOS. Before this change, this
required a full reinstall. After, users will simply have to
`brew postinstall llvm`.

The config file change requires an upstream patch. We'll probably have
to wait a little bit for it to merge, and then wait another few days to
make sure it doesn't get reverted.

Following discussion at #192505, let's also update the caveats to notify
users of potential changes regarding `LLVM_ENABLE_EH` in LLVM 20.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI-no-fail-fast Continue CI tests despite failing GitHub Actions matrix builds. CI-no-fail-fast-deps Continue dependent tests despite failing GitHub Actions matrix tests. CI-published-bottle-commits The commits for the built bottles have been pushed to the PR branch. long build Set a long timeout for formula testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants