[GHC] #11495: TH_spliceE5_prof is failing with release candidate 8.0.1

#11495: TH_spliceE5_prof is failing with release candidate 8.0.1 -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc1 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: -------------------------------------+------------------------------------- `TH_spliceE5_prof` looks like this: {{{ TH_spliceE5_prof:: $(RM) TH_spliceE5_prof*.o TH_spliceE5_prof*.hi TH_spliceE5_prof*.dyn_o TH_spliceE5_prof*.dyn_hi TH_spliceE5_prof '$(TEST_HC)' $(TEST_HC_OPTS) $(HC_OPTS) $(ghcThWayFlags) --make -v0 TH_spliceE5_prof.hs -c '$(TEST_HC)' $(TEST_HC_OPTS) $(HC_OPTS) --make -v0 TH_spliceE5_prof.hs -prof -auto-all -osuf .p.o -o $@ ./$@ }}} In 4905b83a2d448c65ccced385343d4e8124548a3b, Simon added that `$(ghcThWayFlags)` to the first compilation command. With a release compiler, `ghcThWayFlags` defaults to `-dynamic`. But compiling with `-dynamic` doesn't produce `.dyn_o` files (you need `-dynamic-too` for that, which is enabled by `-XTemplateHaskell`, but **not** when compiling with `-dynamic`), so the second compilation results in: {{{ TH_spliceE5_prof.hs:8:17: fatal: cannot find object file ‘./TH_spliceE5_prof_Lib.dyn_o’ while linking an interpreted expression make[1]: *** [TH_spliceE5_prof] Error 1 *** unexpected failure for TH_spliceE5_prof(normal) }}} Not passing `-dynamic` fixes the test. But in the function `failNonStd` in `compiler/ghci/Linker.hs` Simon suggests that passing `-dynamic`: {{{ Cannot load -prof objects when GHC is built with -dynamic To fix this, either: (1) Use -fexternal-interprter, or (2) Build the program twice: once with -dynamic, and then with -prof using -osuf to set a different object file suffix. }}} Some ideas for a solution: * change that message to not mention `-dynamic` * always turn on `-dynamic-too` when `-XTemplateHaskell` is on, also when using `-dynamic` * find the place where `.dyn_o` is expected, and teach it that `.o` might also be ok. * make `-fexternal-interpreter` the default. Delete the test and a whole bunch of other stuff. It's all such a mess. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11495 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11495: TH_spliceE5_prof is failing with release candidate 8.0.1 -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc1 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: | -------------------------------------+------------------------------------- Description changed by thomie: @@ -31,1 +31,2 @@ - `compiler/ghci/Linker.hs` Simon suggests that passing `-dynamic`: + `compiler/ghci/Linker.hs` Simon suggests that passing `-dynamic` is + necessary: New description: `TH_spliceE5_prof` looks like this: {{{ TH_spliceE5_prof:: $(RM) TH_spliceE5_prof*.o TH_spliceE5_prof*.hi TH_spliceE5_prof*.dyn_o TH_spliceE5_prof*.dyn_hi TH_spliceE5_prof '$(TEST_HC)' $(TEST_HC_OPTS) $(HC_OPTS) $(ghcThWayFlags) --make -v0 TH_spliceE5_prof.hs -c '$(TEST_HC)' $(TEST_HC_OPTS) $(HC_OPTS) --make -v0 TH_spliceE5_prof.hs -prof -auto-all -osuf .p.o -o $@ ./$@ }}} In 4905b83a2d448c65ccced385343d4e8124548a3b, Simon added that `$(ghcThWayFlags)` to the first compilation command. With a release compiler, `ghcThWayFlags` defaults to `-dynamic`. But compiling with `-dynamic` doesn't produce `.dyn_o` files (you need `-dynamic-too` for that, which is enabled by `-XTemplateHaskell`, but **not** when compiling with `-dynamic`), so the second compilation results in: {{{ TH_spliceE5_prof.hs:8:17: fatal: cannot find object file ‘./TH_spliceE5_prof_Lib.dyn_o’ while linking an interpreted expression make[1]: *** [TH_spliceE5_prof] Error 1 *** unexpected failure for TH_spliceE5_prof(normal) }}} Not passing `-dynamic` fixes the test. But in the function `failNonStd` in `compiler/ghci/Linker.hs` Simon suggests that passing `-dynamic` is necessary: {{{ Cannot load -prof objects when GHC is built with -dynamic To fix this, either: (1) Use -fexternal-interprter, or (2) Build the program twice: once with -dynamic, and then with -prof using -osuf to set a different object file suffix. }}} Some ideas for a solution: * change that message to not mention `-dynamic` * always turn on `-dynamic-too` when `-XTemplateHaskell` is on, also when using `-dynamic` * find the place where `.dyn_o` is expected, and teach it that `.o` might also be ok. * make `-fexternal-interpreter` the default. Delete the test and a whole bunch of other stuff. It's all such a mess. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11495#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11495: TH_spliceE5_prof is failing with release candidate 8.0.1
-------------------------------------+-------------------------------------
Reporter: thomie | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 8.0.1
Component: Compiler | Version: 8.0.1-rc1
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: |
-------------------------------------+-------------------------------------
Comment (by Thomas Miedema

#11495: TH_spliceE5_prof is failing with release candidate 8.0.1 -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc1 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: | -------------------------------------+------------------------------------- Comment (by simonmar):
It's all such a mess.
Yup. I guess we should not put `-dynamic` in `ghcThWayFlags`, because (a) it doesn't work with `-prof` and (b) It is sort-of handled magically by GHC turning on `-dynamic-too` when we need TH. This crap is part of the reason I wanted to make `-fexternal-interpreter`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11495#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11495: TH_spliceE5_prof is failing with release candidate 8.0.1 -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc1 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: | -------------------------------------+------------------------------------- Comment (by thomie):
I guess we should not put -dynamic in ghcThWayFlags
That doesn't work in batch mode. Take this example: A.hs: {{{ {-# LANGUAGE TemplateHaskell #-} module A where import B $(dec) }}} B.hs: {{{ {-# LANGUAGE TemplateHaskell #-} module B where import Language.Haskell.TH dec = [d| x = 1 |] }}} Result: {{{ $ ghc -c B.hs $ ghc -c A.hs A.hs:1:1: cannot find normal object file ‘./B.dyn_o’ while linking an interpreted expression }}} How about this: when compiling with `-dynamic`, create `.dyn_o` and `.dyn_hi` files by default instead of `.o` and `.hi` files. Is there any drawback to this? It would be more consistent with what `-dynamic-too` does as well. `-osuf` and `-hisuf` could keep working as before. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11495#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11495: TH_spliceE5_prof is failing with release candidate 8.0.1 -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc1 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: | -------------------------------------+------------------------------------- Comment (by simonmar): Would you also make `-prof` produce `.p_o` and `.p_hi`? This is quite a big change to make, and I suspect would break quite a lot of things (though I'm not sure exactly what). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11495#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11495: TH_spliceE5_prof is failing with release candidate 8.0.1 -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1-rc1 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: | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * milestone: 8.0.1 => 8.2.1 Comment: Punting to 8.2.1 (there's clearly more to discuss here that we don't have time for in the 8.x series). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11495#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11495: TH_spliceE5_prof is failing with release candidate 8.0.1 -------------------------------------+------------------------------------- Reporter: thomie | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1-rc1 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: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: 8.6.1 => Comment: Removing milestone as there is no one actively working on this and we very much lack direction here. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11495#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC