Skip to content

TH_spliceE5_prof is failing with release candidate 8.0.1

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 4905b83a, 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.

Edited by Thomas Miedema
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information