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

haskell-stack: Fix building from source, add Apple Silicon support #95032

Merged
merged 1 commit into from Feb 18, 2022

Conversation

simnalamburt
Copy link
Contributor

@simnalamburt simnalamburt commented Feb 12, 2022

  1. Fixed building from source.

    Due to recent update of aeson-2.0.0.0, stack can no longer be built with cabal-install. So I patched stack to freeze cabal dependencies using stackage 17.15 LTS.

  2. Add Apple Silicon support.

    HEAD version of stack has already been patched to support Apple Silicon. However, the next release containing that patch hasn't release yet. So I manually patched stack v2.7.3 to support Apple Silicon.

  3. Add llvm@12 as a dependency only on ARM

    All ghc versions before 9.2.1 requires LLVM Code Generator as a backend on ARM.

Fixes #94796

References:
Checklists:
  • 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?
  • brew install --build-from-source --formula ./haskell-stack.rb
  • brew test ./haskell-stack.rb
  • brew audit --strict haskell-stack
  • brew install --build-from-source --HEAD --formula ./haskell-stack.rb

@BrewTestBot BrewTestBot added the haskell Haskell use is a significant feature of the PR or issue label Feb 12, 2022
@simnalamburt simnalamburt force-pushed the haskell-stack branch 3 times, most recently from 99f5a2f to 333a180 Compare February 12, 2022 22:44
@simnalamburt simnalamburt marked this pull request as ready for review February 12, 2022 22:45
simnalamburt added a commit to simnalamburt/homebrew-x that referenced this pull request Feb 12, 2022
simnalamburt added a commit to simnalamburt/homebrew-x that referenced this pull request Feb 12, 2022
@simnalamburt
Copy link
Contributor Author

For those who want to use this patch right now:

brew install simnalamburt/x/haskell-stack
Reference

Formula/haskell-stack.rb Outdated Show resolved Hide resolved
Formula/haskell-stack.rb Outdated Show resolved Hide resolved
@xtendo-org
Copy link

xtendo-org commented Feb 17, 2022

@carlocab I'd really, really appreciate if you could merge this PR.

At this point, brew install haskell-stack on Apple Silicon machines is just ... broken. brew install seemingly does "something", but afterwards, the GHC tool chain doesn't work, leaving users puzzled. In fact, for users of M1* machines, at this point, there is no hassle-free way to use the Haskell Stack at all.

Well, as the PR author mentioned, there is brew install simnalamburt/x/haskell-stack, but this is obviously not what we want to recommend to all newcomers, and users will probably try brew install haskell-stack anyway, so leaving it broken will simply confuse and deter them. I think this is bad for both for brew and Haskell.

Stack provides their own installation method (distribution of binary executables) but they haven't released the version 2.7.4 that supports the Apple Silicon arch. Users will have to wait indefinitely. Besides, regardless of Stack's own release policy, brew install should work, right?

As you pointed out, the patch size (in terms of bytes) is pretty big, but what it does is actually small and simple: Freeze the versions of dependency packages in the build process. Hopefully Stack will solve the "dependency version problem when building with cabal" issue, at which point we can probably ditch this patch. Furthermore, since this is in the patch do ~ end form, we should be able to remove it easily in the future.

I think this serves as a really nice stopgap for Apple Silicon users right now. Please merge this. I beg you.

@SMillerDev
Copy link
Member

Besides, regardless of Stack's own release policy, brew install should work, right?

Generally brew just ships what upstream ships and almost everywhere in our documentation we tell people not to patch things in brew (but to fix it upstream). If upstream doesn't feel comfortable releasing this patch yet I'm not sure if we should.

- Fixed building from source.

  Due to recent update of aeson-2.0.0.0, stack can no longer be built
  with cabal-install. So I patched stack to freeze cabal dependencies
  using stackage 17.15 LTS.

- Add Apple Silicon support.

  HEAD version of stack has already been patched to support Apple
  Silicon. However, the next release containing that patch hasn't
  release yet. So I manually patched stack v2.7.3 to support Apple
  Silicon.

- Add llvm@12 as a dependency only on ARM

  All ghc versions before 9.2.1 requires LLVM Code Generator as a
  backend on ARM.

Fixes Homebrew#94796

Reference:
  commercialhaskell/stack#5562
  commercialhaskell/stack#5677
Copy link
Member

@carlocab carlocab left a comment

Choose a reason for hiding this comment

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

Thanks!

@carlocab carlocab merged commit e3910ed into Homebrew:master Feb 18, 2022
@BrewTestBot
Copy link
Member

@carlocab bottle request for cedille failed.

@BrewTestBot
Copy link
Member

@carlocab bottle request for psc-package failed.

@simnalamburt
Copy link
Contributor Author

@carlocab Since I wrote this PR, I’m willing to help you if this PR caused any issue with bottling haskell-stack or others.

@carlocab
Copy link
Member

carlocab commented Feb 18, 2022

haskell-stack bottled fine. The messages you're seeing are for (recursive) dependents. At least one of them looks to have been broken by aeson. I don't think any of these failures are due to this PR. (Indeed, we wouldn't even have been able to attempt to bottle them without this.)

@simnalamburt
Copy link
Contributor Author

I just checked 87ec35b. Thanks!

Can you rebuild the “arm64_big_sur” image too? The existing arm64_big_sur binary does not work properly without this PR. It will enable other haskell-stack dependents’ arm64_big_sur builds too!

@carlocab
Copy link
Member

Can you explain the problem with the arm64_big_sur bottle, and give a minimal reproduction? We haven't had any issues using the existing haskell-stack build to build other formulae on Big Sur (and there have been a few of those recently).

@simnalamburt
Copy link
Contributor Author

WIth existing binary:

brew install haskell-stack
cd any-stack-project # navigate into any stack project
stack setup

Will fail with I don't know how to install GHC for (OSX,AArch64), please install manually..

This issue was fixed by commercialhaskell/stack#5562. This is the reason why I patched haskell-stack with e3910ed#diff-7262ae90068953c6fc17eb4ec7deac3a69c7edf2ed4e32edc4ce2e4dc00d73dfR22-R31.

@simnalamburt
Copy link
Contributor Author

Actually this is what @xtendo-org meant by "brew install seemingly does "something", but afterwards, the GHC tool chain doesn't work, leaving users puzzled.". On ARM Big Sur, brew install haskell-stack does install you some binaries but all stack commands like stack setup, stack ghci, stack build, etc won't work.

@carlocab
Copy link
Member

We should've bumped the revision, then. Feel free to open a new PR that does so.

@simnalamburt
Copy link
Contributor Author

Got it!

@simnalamburt simnalamburt deleted the haskell-stack branch February 22, 2022 20:02
simnalamburt added a commit to simnalamburt/homebrew-core that referenced this pull request Feb 22, 2022
With existing arm64_big_sur bottle,

    brew install haskell-stack
    cd any-stack-project # navigate into any stack project
    stack setup

Will fail with following error message:

    I don't know how to install GHC for (OSX,AArch64), please install manually..

This issue was fixed by Homebrew#95032 but the revision
was not bumped. I hereby bump the revision to rebuild arm64_big_sur
bottle.

Reference:
  Homebrew#95032 (comment)
@simnalamburt simnalamburt mentioned this pull request Feb 22, 2022
6 tasks
BrewTestBot pushed a commit that referenced this pull request Feb 22, 2022
With existing arm64_big_sur bottle,

    brew install haskell-stack
    cd any-stack-project # navigate into any stack project
    stack setup

Will fail with following error message:

    I don't know how to install GHC for (OSX,AArch64), please install manually..

This issue was fixed by #95032 but the revision
was not bumped. I hereby bump the revision to rebuild arm64_big_sur
bottle.

Reference:
  #95032 (comment)

Closes #95668.

Signed-off-by: Carlo Cabrera <30379873+carlocab@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 Mar 25, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
haskell Haskell use is a significant feature of the PR or issue outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot install haskell "stack" HEAD macOS Monterey 12.2
5 participants