Skip to content

Commit b3492a8

Browse files
authored
Merge pull request #5832 from commercialhaskell/stable
Stable
2 parents fc32c57 + 5eca24e commit b3492a8

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

doc/install_and_upgrade.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,34 @@ see the linked FAQ entries:
114114
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

117+
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.
123+
124+
```bash
125+
# Assuming BASH below
126+
127+
# passing CFLAGS in-line with the command giving rise to the error
128+
CFLAGS="-arch arm64 ${CFLAGS:-}" some_command_to_install_stack
129+
CFLAGS="-arch arm64 ${CFLAGS:-}" stack [build|install]
130+
131+
# -- OR --
132+
133+
# ~/.bash_profile
134+
# NOTE: only do this if you do not have to cross-compile, or remember to unset
135+
# CFLAGS when needed
136+
export CFLAGS="-arch arm64 ${CFLAGS:-}"
137+
```
138+
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.
144+
117145
## Ubuntu
118146

119147
Use the [generic Linux option](#linux).

0 commit comments

Comments
 (0)