Skip to content

Commit 2340840

Browse files
authored
Merge branch 'stable' into docs/additional-apple-arm64-installation-instructions
2 parents 8b26c62 + 2df7720 commit 2340840

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

doc/install_and_upgrade.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,25 +115,32 @@ If you are on macOS 10.12 (Sierra) and encounter GHC panic while building, see
115115
this [issue](https://github.com/commercialhaskell/stack/issues/2577)
116116

117117

118-
On Apple silicon chip (`aarch64`/`arm64` architectures), the installation for stack itself or some packages (e.g. `network`) requiring C source compilation might fail with
119-
`configure: error: C compiler cannot build executables.` in which case you should pass `-arch arm64` as part of
120-
the `CFLAGS` environment variable, which will be then picked up by the c compiler of your choice.
118+
On Apple silicon chip (AArch64/ARM64) architectures, the installation of Stack
119+
or some packages (e.g. `network`) requiring C source compilation might fail with
120+
`configure: error: C compiler cannot build executables`. In that case you should
121+
pass `-arch arm64` as part of the `CFLAGS` environment variable. This setting
122+
will be picked up by the C compiler of your choice.
121123

122124
```bash
123125
# Assuming BASH below
124126

125-
# passing CFLAGS in-line with the command involving the error
127+
# passing CFLAGS in-line with the command giving rise to the error
126128
CFLAGS="-arch arm64 ${CFLAGS:-}" some_command_to_install_stack
127129
CFLAGS="-arch arm64 ${CFLAGS:-}" stack [build|install]
128130

129131
# -- OR --
130132

131133
# ~/.bash_profile
132-
# NOTE: only do this if you do not have to cross-compile or remember to unset CFLAGS when needed
134+
# NOTE: only do this if you do not have to cross-compile, or remember to unset
135+
# CFLAGS when needed
133136
export CFLAGS="-arch arm64 ${CFLAGS:-}"
134137
```
135138

136-
This instructs the C compiler to compile objects for `arm64`, which would be then successfully linked with the libraries built for `arm64`, otherwise the c compiler, invoked by `cabal` running in `x86_64`, would compile x86_64 objects and attempt to link them with existing arm64 libraries and resulting in the error above.
139+
The setting instructs the C compiler to compile objects for ARM64. These can
140+
then be linked with libraries built for ARM64. Without the instruction, the C
141+
compiler, invoked by Cabal running in x86-64, would compile x86-64 objects and
142+
attempt to link them with existing ARM64 libraries, resulting in the error
143+
above.
137144

138145
## Ubuntu
139146

0 commit comments

Comments
 (0)