ndmitchell / ghcid

Very low feature GHCi based IDE
Other
1.13k stars 114 forks source link

stderr not displaying on Apple Silicon #359

Closed habibalamin closed 2 years ago

habibalamin commented 2 years ago

I have tried this on 8.10.7 and 9.2.2, and on 9.2.2, I have tried native Apple Silicon codegen build and LLVM build. The same exact project works with ghcid on an older Intel machine I have (with an older OS and GHC 8.8.4 and 8.10.7).

This fails even on a very simple project, like this:

-- minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin.cabal
cabal-version:         3.0
name:                  minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin

version:               0.1.0.0

library libminimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin
  default-language: Haskell2010

  hs-source-dirs:      src/lib
  exposed-modules:     Minimal.Reproduction
  build-depends:       base ^>= 4.14.3.0
-- src/lib/Minimal/Reproduction.hs
module Minimal.Reproduction where

minimallyReproduce :: IO ()
minimallyReproduce = pure ()

I notice that the title changes from “All good” to “1 error” or “1 warning” (neither will print, warnings or errors). ghcid doesn't seem to refresh the display, until I fix the error or warning and save again.

ndmitchell commented 2 years ago

Is this perhaps a bug in the underlying ghci that ghcid is using? The easiest way to tell would be to run with --verbose which prints a fairly complete trace which should show what is happening.

habibalamin commented 2 years ago

Apologies, I should have included this information in the OP, but I've been so busy preparing to fly to Istanbul, and I forgot to mention, I have tried by just loading and reloading in GHCi directly, and it works fine.

I do have some verbose output which I pasted into TextEdit (and so couldn't paste with colour). That project does some extra stuff with ghcid(/GHCi), so I redid it with the minimal repro. I kinda just added some extra newlines before I reloaded the file, and I wanted to format it and split it before pasting it here, but whatever, I'll just paste what I have now, with ANSI escape codes and all:

%OS: darwin
%ARCH: aarch64
%VERSION: 0.8.7
%ARGUMENTS: ["-v"]
Loading cabal repl --repl-options=-fno-code --repl-options=-fno-break-on-exception --repl-options=-fno-break-on-error --repl-options=-v1 --repl-options=-ferror-spans --repl-options=-j ...
%STDOUT: Build profile: -w ghc-8.10.7 -O1
%STDOUT2: Build profile: -w ghc-8.10.7 -O1
Build profile: -w ghc-8.10.7 -O1
%STDOUT: In order, the following will be built (use -v for more details):
%STDOUT2: In order, the following will be built (use -v for more details):
In order, the following will be built (use -v for more details):
%STDOUT:  - minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin-0.1.0.0 (lib:libminimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin) (first run)
%STDOUT2:  - minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin-0.1.0.0 (lib:libminimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin) (first run)
 - minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin-0.1.0.0 (lib:libminimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin) (first run)
%STDOUT: Preprocessing library 'libminimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin' for minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin-0.1.0.0..
%STDOUT2: Preprocessing library 'libminimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin' for minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin-0.1.0.0..
Preprocessing library 'libminimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin' for minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin-0.1.0.0..
%STDOUT: GHCi, version 8.10.7: https://www.haskell.org/ghc/  :? for help
%STDOUT2: GHCi, version 8.10.7: https://www.haskell.org/ghc/  :? for help
%STDIN: import qualified System.IO as INTERNAL_GHCID
%STDIN: :unset +t +s
%STDIN: :set prompt #~GHCID-START~#
%STDIN: :set prompt-cont #~GHCID-START~#
%STDIN: :set -fno-break-on-exception
%STDIN: :set -fno-break-on-error
%STDIN: :set -v1
%STDIN: :set -fno-hide-source-paths
%STDIN: 
INTERNAL_GHCID.putStrLn ['#','~','G','H','C','I','D','-','F','I','N','I','S','H','-','1','~','#']
INTERNAL_GHCID.hPutStrLn INTERNAL_GHCID.stderr ['#','~','G','H','C','I','D','-','F','I','N','I','S','H','-','1','~','#']
GHCi, version 8.10.7: https://www.haskell.org/ghc/  :? for help
%STDOUT: Loaded GHCi configuration from /Users/habib/dotfiles/ghci
%STDOUT2: Loaded GHCi configuration from /Users/habib/dotfiles/ghci
Loaded GHCi configuration from /Users/habib/dotfiles/ghci
%STDOUT: [1 of 1] Compiling Minimal.Reproduction ( src/lib/Minimal/Reproduction.hs, nothing )
%STDOUT2: [1 of 1] Compiling Minimal.Reproduction ( src/lib/Minimal/Reproduction.hs, nothing )
[1 of 1] Compiling Minimal.Reproduction ( src/lib/Minimal/Reproduction.hs, nothing )
%STDOUT: Ok, one module loaded.
%STDOUT2: Ok, one module loaded.
Ok, one module loaded.
%STDOUT: λ λ λ λ #~GHCID-START~##~GHCID-START~##~GHCID-START~##~GHCID-START~##~GHCID-START~##~GHCID-START~##~GHCID-START~##~GHCID-FINISH-1~#
%STDERR: #~GHCID-FINISH-1~#
%STDIN: 
%STDIN: 
INTERNAL_GHCID.putStrLn ['#','~','G','H','C','I','D','-','F','I','N','I','S','H','-','2','~','#']
INTERNAL_GHCID.hPutStrLn INTERNAL_GHCID.stderr ['#','~','G','H','C','I','D','-','F','I','N','I','S','H','-','2','~','#']
%STDOUT: #~GHCID-START~##~GHCID-START~##~GHCID-START~##~GHCID-START~##~GHCID-FINISH-2~#
%STDERR: #~GHCID-FINISH-2~#
%STDIN: :set -ferror-spans
:set -j
:set -fdiagnostics-color=always

%STDIN: 
INTERNAL_GHCID.putStrLn ['#','~','G','H','C','I','D','-','F','I','N','I','S','H','-','3','~','#']
INTERNAL_GHCID.hPutStrLn INTERNAL_GHCID.stderr ['#','~','G','H','C','I','D','-','F','I','N','I','S','H','-','3','~','#']
%STDOUT: #~GHCID-START~##~GHCID-START~##~GHCID-START~##~GHCID-START~##~GHCID-START~##~GHCID-START~##~GHCID-START~##~GHCID-FINISH-3~#
%STDERR: #~GHCID-FINISH-3~#
%STDIN: :show paths
%STDIN: 
INTERNAL_GHCID.putStrLn ['#','~','G','H','C','I','D','-','F','I','N','I','S','H','-','4','~','#']
INTERNAL_GHCID.hPutStrLn INTERNAL_GHCID.stderr ['#','~','G','H','C','I','D','-','F','I','N','I','S','H','-','4','~','#']
%STDOUT: #~GHCID-START~##~GHCID-START~#current working directory: 
%STDOUT:   /Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin
%STDOUT: module import search paths:
%STDOUT:   /Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/dist-newstyle/build/aarch64-osx/ghc-8.10.7/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin-0.1.0.0/l/libminimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/build/libminimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin
%STDOUT:   src/lib
%STDOUT:   /Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/dist-newstyle/build/aarch64-osx/ghc-8.10.7/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin-0.1.0.0/l/libminimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/build/libminimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/autogen
%STDOUT:   /Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/dist-newstyle/build/aarch64-osx/ghc-8.10.7/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin-0.1.0.0/l/libminimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/build/global-autogen
%STDOUT: #~GHCID-START~##~GHCID-START~##~GHCID-FINISH-4~#
%STDERR: #~GHCID-FINISH-4~#
%MESSAGES: [LoadConfig {loadFile = "/Users/habib/dotfiles/ghci"},Loading {loadModule = "Minimal.Reproduction", loadFile = "/Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/src/lib/Minimal/Reproduction.hs"}]
%LOADED: ["/Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/src/lib/Minimal/Reproduction.hs"]
]0;All good, at 16:39:38 - minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin
All good (1 module, at 16:39:38)

%WAITING: /Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/.ghcid /Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin.cabal /Users/habib/dotfiles/ghci /Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/src/lib/Minimal/Reproduction.hs
%WAITING: /Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin /Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/src/lib/Minimal /Users/habib/dotfiles
%NOTIFY: Removed "/Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/src/lib/Minimal/4913" 2022-03-20 16:39:43.024789 UTC False
%NOTIFY: Removed "/Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/src/lib/Minimal/Reproduction.hs" 2022-03-20 16:39:43.024842 UTC False
%NOTIFY: Added "/Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/src/lib/Minimal/Reproduction.hs~" 2022-03-20 16:39:43.024853 UTC False
%WAITING: Notify signaled
%WAITING: Waiting max of 1s due to file removal, /Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/src/lib/Minimal/Reproduction.hs
%NOTIFY: Modified "/Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/src/lib/Minimal/Reproduction.hs" 2022-03-20 16:39:43.046731 UTC False
%NOTIFY: Modified "/Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/src/lib/Minimal/Reproduction.hs" 2022-03-20 16:39:43.067713 UTC False
%NOTIFY: Removed "/Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/src/lib/Minimal/Reproduction.hs~" 2022-03-20 16:39:43.067745 UTC False
%NOTIFY: Modified "/Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/tags.lock" 2022-03-20 16:39:43.067869 UTC False
%NOTIFY: Added "/Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/tags.temp" 2022-03-20 16:39:43.067878 UTC False

Reloading...
  /Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-std
err-on-apple-silicon-darwin/src/lib/Minimal/Reproduction.hs

%STDIN: :reload
%STDIN: 
INTERNAL_GHCID.putStrLn ['#','~','G','H','C','I','D','-','F','I','N','I','S','H','-','5','~','#']
INTERNAL_GHCID.hPutStrLn INTERNAL_GHCID.stderr ['#','~','G','H','C','I','D','-','F','I','N','I','S','H','-','5','~','#']
%STDOUT: #~GHCID-START~##~GHCID-START~#[1 of 1] Compiling Minimal.Reproduction ( src/lib/Minimal/Reproduction.hs, nothing )
%STDERR: 
%STDERR: src/lib/Minimal/Reproduction.hs:4:22-23: error:
%STDERR:     • Couldn't match expected type ‘IO ()’ with actual type ‘()’
%STDERR:     • In the expression: ()
%STDERR:       In an equation for ‘minimallyReproduce’: minimallyReproduce = ()
%STDERR:   |
%STDERR: 4 | minimallyReproduce = ()
%STDERR:   |                      ^^
%STDOUT: Failed, no modules loaded.
%NOTIFY: Removed "/Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/tags.temp" 2022-03-20 16:39:43.078754 UTC False
%NOTIFY: Added "/Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/tags" 2022-03-20 16:39:43.078786 UTC False
%NOTIFY: Added "/Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/tags" 2022-03-20 16:39:43.078796 UTC False
%NOTIFY: Removed "/Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/tags.lock" 2022-03-20 16:39:43.078803 UTC False
%STDOUT: #~GHCID-START~##~GHCID-START~##~GHCID-FINISH-5~#
%STDERR: #~GHCID-FINISH-5~#
%STDIN: :show modules
%STDIN: 
INTERNAL_GHCID.putStrLn ['#','~','G','H','C','I','D','-','F','I','N','I','S','H','-','6','~','#']
INTERNAL_GHCID.hPutStrLn INTERNAL_GHCID.stderr ['#','~','G','H','C','I','D','-','F','I','N','I','S','H','-','6','~','#']
%STDOUT: #~GHCID-START~##~GHCID-START~##~GHCID-START~##~GHCID-START~##~GHCID-FINISH-6~#
%STDERR: #~GHCID-FINISH-6~#
%MESSAGES: [Loading {loadModule = "Minimal.Reproduction", loadFile = "/Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/src/lib/Minimal/Reproduction.hs"},Message {loadSeverity = Error, loadFile = "/Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/src/lib/Minimal/Reproduction.hs", loadFilePos = (4,22), loadFilePosEnd = (4,23), loadMessage = ["\ESC[;1msrc/lib/Minimal/Reproduction.hs:4:22-23: \ESC[;1m\ESC[31merror:\ESC[0m\ESC[0m\ESC[;1m\ESC[0m\ESC[0m\ESC[;1m","    \8226 Couldn't match expected type \8216IO ()\8217 with actual type \8216()\8217","    \8226 In the expression: ()","      In an equation for \8216minimallyReproduce\8217: minimallyReproduce = ()\ESC[0m\ESC[0m","\ESC[;1m\ESC[34m  |\ESC[0m\ESC[0m","\ESC[;1m\ESC[34m4 |\ESC[0m\ESC[0m minimallyReproduce = \ESC[;1m\ESC[31m()\ESC[0m\ESC[0m","\ESC[;1m\ESC[34m  |\ESC[0m\ESC[0m\ESC[;1m\ESC[31m                      ^^\ESC[0m\ESC[0m"]}]
%LOADED: ["/Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/src/lib/Minimal/Reproduction.hs"]
]0;1 error - minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin
src/lib/Minimal/Reproduction.hs:4:22-23: error:
    • Couldn't match expected type ‘IO ()’ with actual type ‘()’
    • In the expression: ()
      In an equation for ‘minimallyReproduce’: minimallyReproduce = ()
  |
4 | minimallyReproduce = ()
  |                      ^^
%WAITING: /Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/.ghcid /Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin.cabal /Users/habib/dotfiles/ghci /Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/src/lib/Minimal/Reproduction.hs
%WAITING: /Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin /Users/habib/Documents/Development/minimal-reproduction-ghcid-not-showing-stderr-on-apple-silicon-darwin/src/lib/Minimal /Users/habib/dotfiles
matthewbauer commented 2 years ago

you need:

https://github.com/biegunka/terminal-size/pull/16

for it to work on arm64

habibalamin commented 2 years ago

Fixed. terminal-size-0.3.3, which fixes this issue, was literally released hours after I filed it.