[GHC] #12971: gcc not finding default temporary directory

#12971: gcc not finding default temporary directory -------------------------------------+------------------------------------- Reporter: erikprantare | Owner: Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- 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? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12971 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12971: Change default tmpdir -------------------------------------+------------------------------------- Reporter: erikprantare | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12971#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12971: Paths are encoded incorrectly when invoking GCC ---------------------------------+---------------------------------------- Reporter: erikprantare | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by bgamari): * priority: normal => highest * os: Unknown/Multiple => Windows * type: feature request => bug * milestone: => 8.2.1 Comment: Oh dear, it looks like we are failing to encode a filename with UTF-16 as expected by Windows. This is quite -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12971#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12971: Paths are encoded incorrectly when invoking GCC ---------------------------------+---------------------------------------- Reporter: erikprantare | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by bgamari): Indeed I can reproduce this with, {{{ $ mkdir Präntare $ export TMP=`pwd`/Präntare $ echo 'main = putStrLn "hello world!"' > Hello.hs $ ghc Hello.hs 1 of 1] Compiling Main ( Hello.hs, Hello.o ) Linking Hello.exe ... realgcc.exe: error: C:\msys64\home\ben\Präntare\ghc2596_0\ghc_4.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) $ export TMP=/tmp $ ghc Hello.hs Linking Hello.exe ... }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12971#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12971: Paths are encoded incorrectly when invoking GCC ---------------------------------+---------------------------------------- Reporter: erikprantare | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by bgamari): `ghc -v` reveals that the failing command is, {{{ Linking Hello.exe ... *** C Compiler: "C:\msys64\home\ben\ghc-8.0.1-i386\lib/../mingw/bin/gcc.exe" "-U__i686" "-march=i686" "-fno-stack-protector" "-DTABLES_NEXT_TO_CODE" "-c" "C:\msys64\home\ben\Prntare\ghc4688_0\ghc_4.c" "-o" "C:\msys64\home\ben\Prntare\ghc4688_0\ghc_5.o" "-IC:\msys64\home\ben\ghc-8.0.1-i386\lib/include" realgcc.exe: error: C:\msys64\home\ben\Präntare\ghc4688_0\ghc_4.c: No such file or directory realgcc.exe: fatal error: no input files compilation terminated. }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12971#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12971: Paths are encoded incorrectly when invoking GCC ---------------------------------+---------------------------------------- Reporter: erikprantare | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by bgamari): It seems quite likely that `DriverPipeline.mkExtraObj` is responsible for this call but it doesn't have any immediately evident issues. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12971#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12971: Paths are encoded incorrectly when invoking GCC ---------------------------------+---------------------------------------- Reporter: erikprantare | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by bgamari): Hmm, the missing `ä` above may have just been due to the terminal. Redirecting `ghc`'s output to a file and viewing the file with vim shows the following, {{{ Linking Hello.exe ... *** C Compiler: "C:\msys64\home\ben\ghc-8.0.1-i386\lib/../mingw/bin/gcc.exe" "-U__i686" \ "-march=i686" "-fno-stack-protector" "-DTABLES_NEXT_TO_CODE" "-c" \ "C:\msys64\home\ben\Pr<84>ntare\ghc4344_0\ghc_4.c" \ "-o" "C:\msys64\home\ben\Pr<84>ntare\ghc4344_0\ghc_5.o" \ "-IC:\msys64\home\ben\ghc-8.0.1-i386\lib/include" realgcc.exe: error: C:\msys64\home\ben\Präntare\ghc4344_0\ghc_4.c: No such file or directory }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12971#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12971: Paths are encoded incorrectly when invoking GCC ---------------------------------+---------------------------------------- Reporter: erikprantare | Owner: Phyx Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Changes (by bgamari): * owner: => Phyx Comment: Phyx kindly said he would take this from here. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12971#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12971: Paths are encoded incorrectly when invoking GCC
---------------------------------+----------------------------------------
Reporter: erikprantare | Owner: Phyx
Type: bug | Status: new
Priority: highest | Milestone: 8.2.1
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Windows | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
---------------------------------+----------------------------------------
Comment (by Ben Gamari

#12971: Paths are encoded incorrectly when invoking GCC ---------------------------------+---------------------------------------- Reporter: erikprantare | Owner: Phyx Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+---------------------------------------- Comment (by Phyx-): Ok, this issue is an upstream one. The problem is with how the response files are read into GCC. We write out a UTF8 file but the relevant code in `libiberty`[1] assumes 1 byte per character. It works fine if response files aren't used since the rest of the argument handling code seems to work fine with utf-16 and utf-8. Assuming we want to keep the response files, one possible work around would be to convert all paths to the dos short paths. [1] https://github.com/gcc-mirror/gcc/blob/master/libiberty/argv.c#L420 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12971#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12971: Paths are encoded incorrectly when invoking GCC ---------------------------------+---------------------------------------- Reporter: erikprantare | Owner: Phyx Type: bug | Status: patch Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2917 Wiki Page: | ---------------------------------+---------------------------------------- Changes (by Phyx-): * status: new => patch * differential: => Phab:D2917 Comment: I've made a temporary workaround in Phab:D2917. I can patch `libiberty` for `8.4`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12971#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12971: Paths are encoded incorrectly when invoking GCC -------------------------------------+------------------------------------- Reporter: erikprantare | Owner: Phyx Type: bug | Status: patch Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2917 Wiki Page: | Phab:/D2942 -------------------------------------+------------------------------------- Changes (by Phyx-): * differential: Phab:D2917 => Phab:D2917 Phab:/D2942 Comment: Added another possible fix. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12971#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12971: Paths are encoded incorrectly when invoking GCC
-------------------------------------+-------------------------------------
Reporter: erikprantare | Owner: Phyx
Type: bug | Status: patch
Priority: highest | Milestone: 8.2.1
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Windows | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D2917
Wiki Page: | Phab:/D2942
-------------------------------------+-------------------------------------
Comment (by Tamar Christina

#12971: Paths are encoded incorrectly when invoking GCC -------------------------------------+------------------------------------- Reporter: erikprantare | Owner: Phyx Type: bug | Status: upstream Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2917 Wiki Page: | Phab:/D2942 -------------------------------------+------------------------------------- Changes (by Phyx-): * priority: highest => normal * status: patch => upstream Comment: This is as fixed as it's going to get with the current toolchain. We'll have to revisit this if we ever move toolchains. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12971#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12971: Paths are encoded incorrectly when invoking GCC -------------------------------------+------------------------------------- Reporter: erikprantare | Owner: Phyx Type: bug | Status: upstream Priority: normal | Milestone: ⊥ Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Windows | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2917 Wiki Page: | Phab:/D2942 -------------------------------------+------------------------------------- Changes (by Phyx-): * milestone: 8.2.1 => ⊥ -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12971#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC