Re: Haskell Stack Ports on Apple Silicon

2021-08-16 Thread Steven Smith
Please see https://github.com/macports/macports-ports/pull/11897 for a working approach on both x86_64 and arm64. > On Aug 15, 2021, at 8:16 AM, Steven Smith wrote: > > I confirm that this approach does not work on an M1 Mac. > > Trying

Re: Haskell Stack Ports on Apple Silicon

2021-08-15 Thread Ken Cunningham
> On Aug 15, 2021, at 5:16 AM, Steven Smith wrote: > >> Cannot install shellcheck for the arch 'arm64’ because IF shellcheck had supported_archs x86_64 in the Portfile, it should never try to install the arm64 arch in the first place. So I’m guessing probably that was missing. It seems

Re: Haskell Stack Ports on Apple Silicon

2021-08-15 Thread Steven Smith
I confirm that this approach does not work on an M1 Mac. Trying to install a stack portion an M1—whether or not `supported_archs x86_64` is set—throws this architecture mismatch error when trying to install on the M1: > Cannot install shellcheck for the arch 'arm64' because > It’s dependency sta

Re: Haskell Stack Ports on Apple Silicon

2021-08-15 Thread Steven Smith
Wouldn’t the best solution be to combine Ken’s two good ideas from this thread and add `supported_archs x86_64` to the haskell_stack portgroup, which would handle all ports built using stack? > IF pandoc set it’s supported_archs to x86_64 (which then matches stack) — > would that now install pr

Re: Haskell Stack Ports on Apple Silicon

2021-08-14 Thread Joshua Root
On 2021-8-15 14:11 , Ken Cunningham wrote: IF pandoc set it’s supported_archs to x86_64 (which then matches stack) — would that now install properly on an M1 Mac, using the fallback archs? Yes.

Re: Haskell Stack Ports on Apple Silicon

2021-08-14 Thread Ken Cunningham
> On Aug 14, 2021, at 7:13 PM, Joshua Root wrote: > > On 2021-8-15 11:52 , Steven Smith wrote: >> stack (and ghc, cabal) can only build x86_64, so it’s an x86_64 binary that >> runs on the M1 (whether built on x86_64 or arm64). >> The problem is that with the current supported_archs setting i

Re: Haskell Stack Ports on Apple Silicon

2021-08-14 Thread Joshua Root
On 2021-8-15 11:52 , Steven Smith wrote: stack (and ghc, cabal) can only build x86_64, so it’s an x86_64 binary that runs on the M1 (whether built on x86_64 or arm64). The problem is that with the current supported_archs setting in stack, you hit this architecture mismatch error when trying to

Re: Haskell Stack Ports on Apple Silicon

2021-08-14 Thread Steven Smith
stack (and ghc, cabal) can only build x86_64, so it’s an x86_64 binary that runs on the M1 (whether built on x86_64 or arm64). The problem is that with the current supported_archs setting in stack, you hit this architecture mismatch error when trying to install pandoc on the M1: > Cannot instal

Re: Haskell Stack Ports on Apple Silicon

2021-08-14 Thread Joshua Root
On 2021-8-15 05:43 , Ken Cunningham wrote: You could override it, in pandoc or in the PortGroup: depends_skip_archcheck-append stack What architecture is the pandoc binary you end up with though? It seems unlikely that an x86_64 stack would generate an arm64 binary, and if it generates an x8

Re: Haskell Stack Ports on Apple Silicon

2021-08-14 Thread Ken Cunningham
You could override it, in pandoc or in the PortGroup: depends_skip_archcheck-append stack

Re: Haskell Stack Ports on Apple Silicon

2021-08-14 Thread Steven Smith
> MacPorts base already knows this and allows the port to be installed on Apple > Silicon even when it says supported_archs x86_64. Then I believe there is a bug in the MacPorts download logic per the original post. When I try to install, e.g., pandoc, on an arm64 box, I hit this architecture m

Re: Haskell Stack Ports on Apple Silicon

2021-08-13 Thread Ryan Schmidt
On Aug 13, 2021, at 10:58, Steven Smith wrote: > > If the Macports-compiled stack runs on arm64, then the prebuilt download will > too. > > The issue as far as I can tell from the internet is that stack will generate > x86_64 binaries, even if running on an M1. > https://www.haskell.org/ghc/bl

Re: Haskell Stack Ports on Apple Silicon

2021-08-13 Thread Ken Cunningham
I don't think it's overly simple to guess what might actually happen, or work. You have to try it various ways, and as Ryan says, I guess also try it when pandoc is pulled in as a dependency rather than directly installed, and see. The automatic fallback to other supported arches (eg arm64 -> x86

Re: Haskell Stack Ports on Apple Silicon

2021-08-13 Thread Steven Smith
If the Macports-compiled stack runs on arm64, then the prebuilt download will too. The issue as far as I can tell from the internet is that stack will generate x86_64 binaries, even if running on an M1. https://www.haskell.org/ghc/blog/20200515-ghc-on-arm.html These x86_64 binaries should run

Re: Haskell Stack Ports on Apple Silicon

2021-08-13 Thread Ryan Schmidt
The stack port's +prebuilt variant installs a prebuilt binary of a particular architecture or architectures. In that variant, the port must declare using supported_archs what the architectures of that prebuilt binary are. > On Aug 13, 2021, at 07:59, Christopher Jones wrote: > > > That line

Re: Haskell Stack Ports on Apple Silicon

2021-08-13 Thread Christopher Jones
That line is indeed limiting support to intel machines. If it works on arm add that to the list, or probably better just remove it and rely on the defaults. Chris > On 13 Aug 2021, at 1:55 pm, Steven Smith wrote: > > Is this line in the stack Portfile the issue? Ports (like pandoc) that are

Re: Haskell Stack Ports on Apple Silicon

2021-08-13 Thread Steven Smith
Is this line in the stack Portfile the issue? Ports (like pandoc) that are built using stack depend on the stack port, and port stack says that x86_64 is supported, but not arm64. However, stack installs and runs just fine on an M1 box. > supported_archs x86_64 https://github.com/macports

Re: Haskell Stack Ports on Apple Silicon

2021-08-13 Thread Ryan Schmidt
On Aug 12, 2021, at 15:28, Ken Cunningham wrote: > It was reverted / replaced though. I was told that MacPorts did this > automatically now (MacPorts would fall back and install the Intel binary on > arm64) so it was not needed to do this any longer. As far as I could tell, this applies to indi

Re: Haskell Stack Ports on Apple Silicon

2021-08-12 Thread Ken Cunningham
> I’d like to start hacking a Portfile update that will either compile pandoc > on the M1 with stack, or install the x86_64 binary and hope it runs, like the > x86_64 stack binary does. You won't be surprised to find out I did that exact thing about a year ago: https://github.com/macports/macp

Haskell Stack Ports on Apple Silicon

2021-08-12 Thread Steven Smith
I have an M1 box on which I’d like to install some haskell ports. The good news: `sudo port install stack` works and the binary runs on an M1. But when I try to install, e.g., pandoc, I hit this architecture mismatch error: > Cannot install pandoc for the arch 'arm64' because > It’s dependency s