File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,34 @@ see the linked FAQ entries:
114
114
If you are on macOS 10.12 (Sierra) and encounter GHC panic while building, see
115
115
this [ issue] ( https://github.com/commercialhaskell/stack/issues/2577 )
116
116
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
+
117
145
## Ubuntu
118
146
119
147
Use the [ generic Linux option] ( #linux ) .
You can’t perform that action at this time.
0 commit comments