Skip to content

Commit 2bfde4d

Browse files
committed
Re #6647 Improve online docs on space in path to GHC executable
1 parent 6a3948e commit 2bfde4d

File tree

4 files changed

+69
-22
lines changed

4 files changed

+69
-22
lines changed

doc/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,19 @@ Stack can be installed directly or by using the GHCup tool.
150150
Systems with antivirus software may need to add Stack to the
151151
list of 'trusted' applications.
152152

153+
??? warning "I have a Windows username with a space in it"
154+
155+
GHC 9.4.1 and later have a bug which means they do not work if
156+
the path to the `ghc` executable has a space character in it.
157+
The default location for Stack's 'programs' directory will have
158+
a space in the path if the value of the `USERNAME` environment
159+
variable includes a space.
160+
161+
A solution is to configure Stack to use a different location for
162+
its 'programs' directory. For further information, see the
163+
[`local-programs-path`](configure/yaml/non-project.md#local-programs-path)
164+
non-project specific configuration option documentation.
165+
153166
=== "Windows on Arm"
154167

155168
The GHC project does not yet provide a version of GHC that runs on

doc/configure/yaml/non-project.md

+37-10
Original file line numberDiff line numberDiff line change
@@ -932,18 +932,45 @@ Stack's defaults differ between Unix-like operating systems and Windows.
932932

933933
The MSYS2 tool is also installed in the Stack 'programs' directory.
934934

935-
!!! warning
935+
!!! warning "Space character in the path to Stack's 'programs' directory"
936936

937937
If there is a space character in the path to Stack's 'programs'
938-
directory this may cause problems with building packages that make use
939-
of the GNU project's `autoconf` package and `configure` shell script
940-
files. That may be the case particularly if there is no corresponding
941-
short name ('8 dot 3' name) for the directory in the path with the space
942-
(which may be the case if '8 dot 3' names have been stripped or their
943-
creation not enabled by default). If there are problems building, it
944-
will be necessary to specify an alternative path that does not contain
945-
space characters. Examples of packages on Hackage that make use of
946-
`configure` are `network` and `process`.
938+
directory this may cause problems:
939+
940+
* with building packages that make use of the GNU project's `autoconf`
941+
package and `configure` shell script files. That may be the case
942+
particularly if there is no corresponding short name ('8 dot 3'
943+
name) for the directory in the path with the space (which may be the
944+
case if '8 dot 3' names have been stripped or their creation not
945+
enabled by default). Examples of packages on Hackage that make use
946+
of `configure` are `network` and `process`; and
947+
948+
* building with GHC 9.4.1 and later. These versions of GHC have a bug
949+
which means they do not work if the path to the `ghc` executable has
950+
a space in it.
951+
952+
The default location for Stack's 'programs' directory will have a space
953+
in the path if the value of the `USERNAME` environment variable includes
954+
a space.
955+
956+
If there are problems building, it will be necessary to specify an
957+
alternative path that does not contain spaces. For example, the
958+
`programs` directory in the [Stack root](../../topics/stack_root.md)
959+
(assuming that path is space-free). For example, if the relevant
960+
directory is `C:\sr\programs`, add:
961+
~~~yaml
962+
local-program-paths: C:\sr\programs
963+
~~~
964+
965+
to Stack's [global configuration](https://docs.haskellstack.org/en/stable/configure/yaml/#location-of-global-configuration)
966+
file (`config.yaml`).
967+
968+
If that global configuration file does not yet exist, command:
969+
~~~text
970+
stack --no-install-ghc setup
971+
~~~
972+
973+
to cause Stack to create it (without also installing GHC).
947974

948975
=== "Windows (Command Prompt)"
949976

doc/faq.md

+5-11
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,11 @@
581581
Stack. See issue [#399](https://github.com/commercialhaskell/stack/issues/399)
582582
for the ongoing effort and information on workarounds.
583583

584+
??? question "I have a Windows username with a space in it and problems building"
585+
586+
See the [`local-programs-path`](configure/yaml/non-project.md#local-programs-path)
587+
non-project specific configuration option documentation for advice.
588+
584589
??? question "How to get a working executable on Windows?"
585590

586591
When executing a binary after building with `stack build` (e.g. for target
@@ -604,14 +609,3 @@
604609
https://msdn.microsoft.com/de-de/library/7d83bc18.aspx).
605610

606611
See issue [#425](https://github.com/commercialhaskell/stack/issues/425).
607-
608-
Another issue that may arise with building on Windows is as follows. The default
609-
location of Stack's programs folder is `%LOCALAPPDATA\Programs\stack`. If there
610-
is a space character in the `%LOCALAPPDATA%` path this may, in some
611-
circumstances, cause problems with building packages that make use of the GNU
612-
project's `autoconf` package and `configure` shell script files. It may be
613-
necessary to override the default location of Stack's programs folder. See the
614-
[local-programs-path](configure/yaml/non-project.md#local-programs-path) option
615-
for more information.
616-
617-
See issue [#4726](https://github.com/commercialhaskell/stack/issues/4726).

doc/install_and_upgrade.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,20 @@ Stack can be installed directly or by using the GHCup tool.
646646
installer. If so, click on **More info**, and then click on the
647647
**Run anyway** button that appears.
648648

649-
!!! warning "Long user PATH environment variable"
649+
??? warning "I have a Windows username with a space in it"
650+
651+
GHC 9.4.1 and later have a bug which means they do not work if
652+
the path to the `ghc` executable has a space character in it.
653+
The default location for Stack's 'programs' directory will have
654+
a space in the path if the value of the `USERNAME` environment
655+
variable includes a space.
656+
657+
A solution is to configure Stack to use a different location for
658+
its 'programs' directory. For further information, see the
659+
[`local-programs-path`](configure/yaml/non-project.md#local-programs-path)
660+
non-project specific configuration option documentation.
661+
662+
??? warning "Stack 2.9.1, 2.9.3 and 2.11.1: Long user PATH environment variable"
650663

651664
The Windows installer for Stack 2.9.1, 2.9.3 and 2.11.1 (only)
652665
will replace the user `PATH` environment variable (rather than

0 commit comments

Comments
 (0)