Skip to content

Paths are encoded incorrectly when invoking GCC

Hello, I've been trying to get the ghc to compile a .hs file to binary. I get an error that seems to be caused during the C compilation phase from the special character ä in my user directory. When compiling I get this:

C:\Users\Erik Präntare>ghc C:\code\Haskell\test.hs
Linking C:\code\Haskell\test.exe ...
realgcc.exe: error: C:\Users\Erik Präntare\AppData\Local\Temp\ghc28912_0\ghc_1.
c: No such file or directory
realgcc.exe: fatal error: no input files
compilation terminated.
`gcc.exe' failed in phase `C Compiler'. (Exit code: 1)

Notice how it says Pr├ñntare instead of Präntare. The UTF-8 encoding for ä is 0xC3 0xA4 which, surprise surprise, corresponds to ├ñ in ASCII. Now, I managed to get around this by changing the tmpdir to my actual temporary directory, but as a new user of ghc it was very troublesome to find a solution. Maybe consider changing the default tmpdir, at least if special characters are encountered?

Trac metadata
Trac field Value
Version 8.0.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown/Multiple
Architecture
Edited by Ben Gamari
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information