Bundled clang does not handle long file paths on Windows
Summary
The clang.exe
bundled with GHC 9.4.1-alpha3 does not handle long file paths on Windows.
This is a problem when working with type-checker plugins.
I discoved this while adding 9.4.1 support for one of our type-checker plugins: https://github.com/clash-lang/ghc-typelits-natnormalise/pull/64
Running cabal test
results in:
clang -cc1as: error: unable to open output file 'C:\\Users\\chris\\devel\\ghc-typelits-natnormalise\\dist-newstyle\\build\\x86_64-windows\\ghc-9.4.0.20220623\\ghc-typelits-natnormalise-0.7.7\\t\\test-ghc-typelits-natnormalise\\build\\test-ghc-typelits-natnormalise\\test-ghc-typelits-natnormalise-tmp\ErrorTests.o.tmp': 'No such file or directory'
<no location info>: error:
`clang.exe' failed in phase `Assembler'. (Exit code: 1)
Steps to reproduce
mkdir -p C:/1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
echo "int main(){}" > main.c
C:\ghcup\ghc\9.4.1-alpha3\mingw\bin\clang.exe main.c -S -o C:/1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/main.s
gives
error: unable to open output file
'C:/1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678
'No such file or directory'
Enabling long paths as described in https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later does not solve the issue.
Expected behavior
Output the assembly of main.c
to main.s
.
Environment
- GHC version used: 9.4.1-alpha3
Optional:
- Operating System: Windows 10 Pro 21H2 (build 19044.1826)
- System Architecture: x86_64