Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

Windows: clang-based GHC (9.4.1 to 9.10.1) fails, if spaces in path to GHC executable
## Summary On Windows 11, clang-based GHC (GHC 9.4.1 to 9.10.1) fails if there are spaces in the path to the GHC executable. The motivation is an issue raised at the Stack repository: https://github.com/commercialhaskell/stack/issues/6647. EDIT: I am not sure to what extent this duplicates https://gitlab.haskell.org/ghc/ghc/-/issues/24265, said to have been (1) fixed by https://gitlab.haskell.org/ghc/ghc/-/merge_requests/11938 (2) backported to GHC 9.6.5 but (3) not backported to GHC 9.8. Commit 31bf85ee does not appear to be present in any release branch. Commit d74ffbbb is present in the `ghc-9.6` branch. So, it may duplicate for GHC 9.4.1 to 9.6.4, 9.8.1, 9.8.2 and 9.10.1. However, it may be a distinct problem for GHC 9.6.5 and 9.6.6. ## Steps to reproduce `main.c` contains a C comment. Starting with GHC 9.6.6, if I command: ~~~text &"D:\sr\programs\x86_64-windows\ghc-9.6.6\bin\ghc.exe" -c main.c -v ~~~ all is well and `main.o` is created. The output is as follows: ~~~text Glasgow Haskell Compiler, Version 9.6.6, stage 2 booted by GHC version 9.4.3 *** systool:cc: *** C Compiler: "D:\\sr\\programs\\x86_64-windows\\ghc-9.6.6\\lib\\../mingw/bin/clang.exe" "-x" "c" "-c" "main.c" "-o" "main.o.tmp" "-Wa,-mbig-obj" "-Wimplicit" "-include" "D:\sr\programs\x86_64-windows\ghc-9.6.6\lib\x86_64-windows-ghc-9.6.6\rts-1.0.2\include\ghcversion.h" "-ID:\sr\programs\x86_64-windows\ghc-9.6.6\lib\x86_64-windows-ghc-9.6.6\base-4.18.2.1\include" "-ID:\sr\programs\x86_64-windows\ghc-9.6.6\lib\x86_64-windows-ghc-9.6.6\ghc-bignum-1.3\include" "-ID:\sr\programs\x86_64-windows\ghc-9.6.6\lib\x86_64-windows-ghc-9.6.6\rts-1.0.2\include" "-ID:\sr\programs\x86_64-windows\ghc-9.6.6\lib\../mingw/include" "-D_UCRT" "--rtlib=compiler-rt" Created temporary directory: C:\Users\mike\AppData\Local\Temp\ghc41684_0 !!! systool:cc: finished in 0.00 milliseconds, allocated 0.446 megabytes *** Deleting temp files: Deleting: C:\Users\mike\AppData\Local\Temp\ghc41684_0\ghc_1.rsp *** Deleting temp subdirs: Deleting: *** Deleting temp dirs: Deleting: C:\Users\mike\AppData\Local\Temp\ghc41684_0 ~~~ However, if I command (with spaces in the path to the GHC executable): ~~~text &"D:\test with spaces\programs\x86_64-windows\ghc-9.6.6\bin\ghc.exe" -c main.c -v ~~~ the corresponding output is as follows (and GHC 9.6.5 is similar), ending with failure and no `main.o` (but no real explanation): ~~~text Glasgow Haskell Compiler, Version 9.6.6, stage 2 booted by GHC version 9.4.3 *** systool:cc: *** C Compiler: "D:\\test\ with\ spaces\\programs\\x86_64-windows\\ghc-9.6.6\\lib\\../mingw/bin/clang.exe" "-x" "c" "-c" "main.c" "-o" "main.o.tmp" "-Wa,-mbig-obj" "-Wimplicit" "-include" "D:\test with spaces\programs\x86_64-windows\ghc-9.6.6\lib\x86_64-windows-ghc-9.6.6\rts-1.0.2\include\ghcversion.h" "-ID:\test with spaces\programs\x86_64-windows\ghc-9.6.6\lib\x86_64-windows-ghc-9.6.6\base-4.18.2.1\include" "-ID:\test with spaces\programs\x86_64-windows\ghc-9.6.6\lib\x86_64-windows-ghc-9.6.6\ghc-bignum-1.3\include" "-ID:\test with spaces\programs\x86_64-windows\ghc-9.6.6\lib\x86_64-windows-ghc-9.6.6\rts-1.0.2\include" "-ID:\test with spaces\programs\x86_64-windows\ghc-9.6.6\lib\../mingw/include" "-D_UCRT" "--rtlib=compiler-rt" Created temporary directory: C:\Users\mike\AppData\Local\Temp\ghc43120_0 *** Deleting temp files: Deleting: C:\Users\mike\AppData\Local\Temp\ghc43120_0\ghc_1.rsp *** Deleting temp subdirs: Deleting: *** Deleting temp dirs: Deleting: C:\Users\mike\AppData\Local\Temp\ghc43120_0 ghc-9.6.6.exe: could not execute: D:\\test\ with\ spaces\\programs\\x86_64-windows\\ghc-9.6.6\\lib\\../mingw/bin/clang.exe ~~~ In the case of GHC 9.4.8 (and GHC 9.6.4, GHC 9.8.2 and GHC 9.10.1 are similar), the equivalent is (but the message is different): ~~~text &"D:\test with spaces\programs\x86_64-windows\ghc-9.4.8\bin\ghc.exe" -c main.c -v Glasgow Haskell Compiler, Version 9.4.8, stage 2 booted by GHC version 9.2.2 Created temporary directory: C:\Users\mike\AppData\Local\Temp\ghc31604_0 *** systool:cc: *** C Compiler: "D:\test with spaces\programs\x86_64-windows\ghc-9.4.8\lib\../mingw/bin/clang.exe" "-x" "c" "main.c" "-o" "C:\Users\mike\AppData\Local\Temp\ghc31604_0\ghc_1.s" "-Wimplicit" "-S" "-include" "D:\test with spaces\programs\x86_64-windows\ghc-9.4.8\lib\x86_64-windows-ghc-9.4.8\rts-1.0.2\include\ghcversion.h" "-ID:\test with spaces\programs\x86_64-windows\ghc-9.4.8\lib\x86_64-windows-ghc-9.4.8\base-4.17.2.1\include" "-ID:\test with spaces\programs\x86_64-windows\ghc-9.4.8\lib\x86_64-windows-ghc-9.4.8\ghc-bignum-1.3\include" "-ID:\test with spaces\programs\x86_64-windows\ghc-9.4.8\lib\x86_64-windows-ghc-9.4.8\rts-1.0.2\include" "spaces\programs\x86_64-windows\ghc-9.4.8\lib\../mingw/include" "with" "-ID:\test" "-D_UCRT" "--rtlib=compiler-rt" clang: error: no such file or directory: 'spaces\programs\x86_64-windows\ghc-9.4.8\lib\../mingw/include' clang: error: no such file or directory: 'with' *** Deleting temp files: Deleting: C:\Users\mike\AppData\Local\Temp\ghc31604_0\ghc_1.s C:\Users\mike\AppData\Local\Temp\ghc31604_0\ghc_2.rsp Warning: deleting non-existent C:\Users\mike\AppData\Local\Temp\ghc31604_0\ghc_1.s *** Deleting temp dirs: Deleting: C:\Users\mike\AppData\Local\Temp\ghc31604_0 `clang.exe' failed in phase `C Compiler'. (Exit code: 1) ~~~ However, GHC 9.2.8 (which uses `gcc.exe`, not `clang.exe`) is good. The output is: ~~~text &"D:\test with spaces\programs\x86_64-windows\ghc-9.2.8\bin\ghc.exe" -c main.c -v Glasgow Haskell Compiler, Version 9.2.8, stage 2 booted by GHC version 8.10.4 *** initializing unit database: Using binary package database: D:\test with spaces\programs\x86_64-windows\ghc-9.2.8\lib\package.conf.d\package.cache package flags [] loading package database D:\test with spaces\programs\x86_64-windows\ghc-9.2.8\lib\package.conf.d wired-in package ghc-prim mapped to ghc-prim-0.8.0 wired-in package ghc-bignum mapped to ghc-bignum-1.2 wired-in package base mapped to base-4.16.4.0 wired-in package rts mapped to rts-1.0.2 wired-in package template-haskell mapped to template-haskell-2.18.0.0 wired-in package ghc mapped to ghc-9.2.8 !!! initializing unit database: finished in 0.00 milliseconds, allocated 5.965 megabytes Created temporary directory: C:\Users\mike\AppData\Local\Temp\ghc36788_0 *** systool:cc: *** C Compiler: "D:\test with spaces\programs\x86_64-windows\ghc-9.2.8\lib\../mingw/bin/gcc.exe" "-x" "c" "main.c" "-o" "C:\Users\mike\AppData\Local\Temp\ghc36788_0\ghc_1.s" "-Wimplicit" "-S" "-include" "D:\test with spaces\programs\x86_64-windows\ghc-9.2.8\lib\x86_64-windows-ghc-9.2.8\rts-1.0.2\include\ghcversion.h" "-ID:\test with spaces\programs\x86_64-windows\ghc-9.2.8\lib\x86_64-windows-ghc-9.2.8\base-4.16.4.0\include" "-ID:\test with spaces\programs\x86_64-windows\ghc-9.2.8\lib\x86_64-windows-ghc-9.2.8\ghc-bignum-1.2\include" "-ID:\test with spaces\programs\x86_64-windows\ghc-9.2.8\lib\x86_64-windows-ghc-9.2.8\rts-1.0.2\include" !!! systool:cc: finished in 0.00 milliseconds, allocated 0.325 megabytes *** systool:as: *** Assembler: "D:\test with spaces\programs\x86_64-windows\ghc-9.2.8\lib\../mingw/bin/gcc.exe" "-Wa,-mbig-obj" "-x" "assembler" "-c" "C:\Users\mike\AppData\Local\Temp\ghc36788_0\ghc_1.s" "-o" "main.o.tmp" !!! systool:as: finished in 0.00 milliseconds, allocated 0.139 megabytes *** Deleting temp files: Deleting: C:\Users\mike\AppData\Local\Temp\ghc36788_0\ghc_1.s C:\Users\mike\AppData\Local\Temp\ghc36788_0\ghc_2.rsp *** Deleting temp dirs: Deleting: C:\Users\mike\AppData\Local\Temp\ghc36788_0 ~~~ ## Expected behavior On Windows, GHC tolerates spaces on the path to the GHC executable. ## Environment * GHC version used: 9.4.1 to 9.10.1 Optional: * Operating System: Windows 11 * System Architecture: x86_64
issue