Stack-Based Ports No Longer Building on ARM

Steven Smith steve.t.smith at
Wed Aug 24 11:20:16 UTC 2022

I’ve observed on my M1 box that stack-based ports no longer build because of compiler issues with mixed architecture libraries, as more ports become native ARM. I’ve done enough troubleshooting (reinstalling CLT, Xcode, use_code=yes and so forth) to believe that this is a general problem—error messages are below.

Before addressing the obvious possible fix of migrating to the recently supported ARM-based cabal+ghc-based toolchain for Haskell ports, I’d like to ask the community two questions:

Do others see this issue and are unable to build stack-based ports on ARM?
Is anyone aware of a fix for compiler issue below? (Not holding my breath because the libunwind link dependency is now native ARM.)

stack has been a decent solution until now because it’s quite robust, provides a ready-made approach to Haskell world bootstrapping, and at least used to be able to produce x86_64 binaries on arm64. But even if stack provides a native arm binary (see, stack will still want to download older x86_64 ghc compilers specified by the LTS in stack.yaml, so I’m not sure how viable stack is for MacPorts on ARM with this fundamental compiler issue.

If there’s not an obvious path forward with stack, then we’ll have to rework a different Haskell bootstrap approach within Macports. Fortunately, we will soon have native ghc and cabal ports (see <>,, and will simply need to bootstrap a small number of Haskell tools necessary to bootstrap these binaries.

MacPorts main.log:
> :info:configure Configuring GHC ...
> :info:configure configure: error: in `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_alex/alex/work/.home/.stack/programs/x86_64-osx/ghc-9.0.2.temp/ghc-9.0.2-x86_64-apple-darwin':
> :info:configure configure: error: C compiler cannot create executables
> :info:configure See `config.log' for more details

stack config.log:
> configure:4368: checking whether the C compiler works
> configure:4390: /usr/bin/clang -pipe -Os -isysroot/Applications/ -arch x86_64 -I/opt/local/include -isysroot/Applications/ -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Applications/ -arch x86_64 conftest.c  >&5
> ld: in '/opt/local/lib/libunwind.dylib', building for macOS-x86_64 but attempting to link with file built for macOS-arm64
> clang: error: linker command failed with exit code 1 (use -v to see invocation)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3898 bytes
Desc: not available
URL: <>

More information about the macports-dev mailing list