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 errors when building on macOS-latest with ghc-{8.10,9.0}. #77

Open
jonathanknowles opened this issue Apr 29, 2024 · 11 comments
Open

Comments

@jonathanknowles
Copy link

jonathanknowles commented Apr 29, 2024

Hi there!

I'm not sure whether this is an issue with haskell-actions per se, but I thought it worth recording in case others are also running into the same issue.

Affected OS, GHC, and cabal version combinations

macOS-latest windows-latest ubuntu-latest
ghc-8.10 🔴 affected 🟢 unaffected 🟢 unaffected
ghc-9.0 🔴 affected 🟢 unaffected 🟢 unaffected
ghc-9.2 🟢 unaffected 🟢 unaffected 🟢 unaffected
ghc-9.4 🟢 unaffected 🟢 unaffected 🟢 unaffected
ghc-9.6 🟢 unaffected 🟢 unaffected 🟢 unaffected
ghc-9.8 🟢 unaffected 🟢 unaffected 🟢 unaffected

Building with cabal-3.10.3.0.

Known workarounds

  • Use macOS-13 instead of macOS-latest.

Issue

On affected OS platform and GHC versions, there are LLVM-related build failures similar to the following:

> cabal build all --builddir=b --only-dependencies
Building     StateVar-1.2.2 (lib)
Configuring library for StateVar-1.2.2..
Preprocessing library for StateVar-1.2.2..
Building library for StateVar-1.2.2..

<no location info>: error:
    Warning: Couldn't figure out LLVM version!
             Make sure you have installed LLVM between [9 and 13)
[1 of 1] Compiling Data.StateVar    ( src/Data/StateVar.hs, dist/build/Data/StateVar.o, dist/build/Data/StateVar.dyn_o )

<no location info>: error:
    Warning: Couldn't figure out LLVM version!
             Make sure you have installed LLVM between [9 and 13)
ghc: could not execute: opt 

Note that the LLVM error appears for whatever dependency cabal is attempting to build first. (It's not specific to StateVar.)

Example action failures

@jonathanknowles jonathanknowles changed the title LLVM version errors when building on macOS with ghc-{8.10,9.0}. LLVM errors when building on macOS-latest with ghc-{8.10,9.0}. Apr 30, 2024
@andreasabel
Copy link
Member

andreasabel commented Apr 30, 2024

E.g. I looked at monoidmap but could not see anything LLVM specific. Are you using the LLVM backend (actively) or are these just vanilla builds failing?

Last successful run: macos-12 20240418.1 https://github.com/jonathanknowles/monoidmap/actions/runs/8837441351/job/24266315402#step:1:9
First failing run: macos-14-arm64 20240422.3 https://github.com/jonathanknowles/monoidmap/actions/runs/8852545287/job/24311465110#step:1:9

Maybe it is the switch from amd64 to arm64 that breaks things. You could fix the runner to macos-12 to circumvent this problem. But yes, many others will get the problem as well...

@jonathanknowles Have you tried patching your workflows with an explicit LLVM installation step? I would be curious if that fixed the problem.

@ulysses4ever
Copy link
Contributor

In the case of Cabal, we did see some failures due to missing LLVM on the new MacOS runners and that was one of several reasons we rolled back to macos-13. Here's an example run if that's of any help: https://github.com/haskell/cabal/actions/runs/8864213938/job/24339171647

@jonathanknowles
Copy link
Author

jonathanknowles commented May 1, 2024

Many thanks for commenting so quickly @andreasabel!

E.g. I looked at monoidmap but could not see anything LLVM specific. Are you using the LLVM backend (actively) or are these just vanilla builds failing?

My apologies -- here's a more direct link to the actual failure: https://github.com/jonathanknowles/monoidmap/actions/runs/8861721580/job/24341958036#step:7:277

(I've also updated all the links in the "example action failures" section to link to the precise parts that failed.)

@jonathanknowles
Copy link
Author

jonathanknowles commented May 1, 2024

@andreasabel wrote:

Maybe it is the switch from amd64 to arm64 that breaks things. You could fix the runner to macos-12 to circumvent this problem. But yes, many others will get the problem as well...

@ulysses4ever wrote:

In the case of Cabal, we did see some failures due to missing LLVM on the new MacOS runners and that was one of several reasons we rolled back to macos-13.

Thanks!

I can confirm that rolling back to macOS-13 also solves the problem for me:


According to the table below (source) macOS-13 seems to be the most-recent "non-large" Intel macOS image:

Image YAML Label Included Software Rollout Status of Latest Image Release
macOS 14 macos-latest-large or macos-14-large macOS-14 Endpoint Badge
macOS 14 Arm64 macos-latest, macos-14, macos-latest-xlarge or macos-14-xlarge macOS-14-arm64 Endpoint Badge
macOS 13 macos-13 or macos-13-large macOS-13 Endpoint Badge
macOS 13 Arm64 macos-13-xlarge macOS-13-arm64 Endpoint Badge
macOS 12 macos-12 or macos-12-large macOS-12 Endpoint Badge

(I did try to build with macOS-latest-large but that apparently requires a paid plan, which I don't have.)

@jonathanknowles
Copy link
Author

@andreasabel wrote:

Have you tried patching your workflows with an explicit LLVM installation step? I would be curious if that fixed the problem.

I did very briefly experiment with this, but didn't succeed yet. (https://github.com/jonathanknowles/haskell-example/actions/runs/8905557298/job/24456432075?pr=40)

@andreasabel
Copy link
Member

@jonathanknowles : I noticed in your experiment some non-idiomatic ways to handle the environment, see my comments at jonathanknowles/haskell-example@ce66f88.
(Maybe this is why it did not succeed?)

@andreasabel
Copy link
Member

I am reproducing the failure now on the local CI here: https://github.com/haskell-actions/setup/actions/runs/8941784591/job/24562918002

@andreasabel
Copy link
Member

Installing LLVM 12 on macos-14 did not help, or I did not do it correctly: https://github.com/andreasabel/gha-test/actions/runs/8942210516/job/24564290977

jonathanknowles added a commit to jonathanknowles/haskell-example that referenced this issue May 5, 2024
jonathanknowles added a commit to jonathanknowles/haskell-example that referenced this issue May 5, 2024
jonathanknowles added a commit to jonathanknowles/monoidmap that referenced this issue May 5, 2024
jonathanknowles added a commit to jonathanknowles/multisets that referenced this issue May 5, 2024
jonathanknowles added a commit to jonathanknowles/quickcheck-groups that referenced this issue May 5, 2024
jonathanknowles added a commit to jonathanknowles/quickcheck-monoid-subclasses that referenced this issue May 5, 2024
jonathanknowles added a commit to jonathanknowles/quickcheck-quid that referenced this issue May 5, 2024
jonathanknowles added a commit to jonathanknowles/roc-id that referenced this issue May 5, 2024
gbrsales added a commit to gbrsales/jsonrpc-conduit that referenced this issue May 5, 2024
gbrsales added a commit to gbrsales/jsonrpc-conduit that referenced this issue May 5, 2024
@jorisdral
Copy link

Installing LLVM 12 on macos-14 did not help, or I did not do it correctly: https://github.com/andreasabel/gha-test/actions/runs/8942210516/job/24564290977

For what it's worth, I've tried similar approaches and it didn't work either

martijnbastiaan added a commit to clash-lang/clash-compiler that referenced this issue May 7, 2024
Rufflewind added a commit to Rufflewind/directory that referenced this issue May 20, 2024
This has been failing since 2024-05-03:
https://github.com/haskell/directory/actions/runs/9152501865/job/25160038949

    Error: [S-9443]
           No setup information found for ghc-8.4.4 on your platform. This probably means a GHC binary
           distribution has not yet been added for OS key macosx-aarch64. Supported versions:
           ghc-8.10.5, ghc-8.10.6, ghc-8.10.7, ghc-9.0.2, ghc-9.2.1, ghc-9.2.2, ghc-9.2.3, ghc-9.2.4,
           ...

haskell-actions/setup#77
mihaimaruseac added a commit to mihaimaruseac/slsa-lvl3-generic-provenance-in-haskell-example that referenced this issue Jun 22, 2024
mihaimaruseac added a commit to mihaimaruseac/book-of-marks that referenced this issue Jun 22, 2024
mihaimaruseac added a commit to mihaimaruseac/io-manager that referenced this issue Jun 22, 2024
mihaimaruseac added a commit to mihaimaruseac/slsa-lvl3-generic-provenance-in-haskell-example that referenced this issue Jun 22, 2024
mihaimaruseac added a commit to mihaimaruseac/io-manager that referenced this issue Jun 23, 2024
mihaimaruseac added a commit to mihaimaruseac/book-of-marks that referenced this issue Jun 23, 2024
@BebeSparkelSparkel
Copy link

BebeSparkelSparkel commented Jul 8, 2024

I have gotten this to work on the mono-traversable repo snoyberg/mono-traversable#226

@minoki
Copy link

minoki commented Oct 21, 2024

Here is my attempt to run actions with GHC 8.10.7 and 9.0.2 on macos-14: minoki/haskell-floating-point@8566b63

      - name: Install LLVM
        run: |
          brew install llvm@12
          echo "OPT=$(brew --prefix llvm@12)/bin/opt" >> "${GITHUB_ENV}"
          echo "LLC=$(brew --prefix llvm@12)/bin/llc" >> "${GITHUB_ENV}"
        if: ${{ matrix.os == 'macos-14' && (matrix.ghc == '8.10.7' || matrix.ghc == '9.0.2') }}

      - name: Workaround for a problem with GHC 9.0.2 on Arm Mac
        run: echo "C_INCLUDE_PATH=`xcrun --show-sdk-path`/usr/include/ffi" >> "${GITHUB_ENV}"
        if: ${{ matrix.os == 'macos-14' && matrix.ghc == '9.0.2' }}

      - uses: haskell-actions/setup@v2
        ...

The points are:

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

No branches or pull requests

6 participants