Skip to content

Passing -threaded does not cause relinking

Summary

I was investigating a bug in hs-opentelemetry which was impeded by a recompilation checker bug that did not consider -threaded while deciding to link again, so I was getting old builds even though I changed the configuration.

Steps to reproduce

GhcBug.hs:

module GhcBug where
import Control.Concurrent

main = putStrLn . show $ rtsSupportsBoundThreads
 » ghc -main-is GhcBug GhcBug.hs && ./GhcBug
[1 of 2] Compiling GhcBug           ( GhcBug.hs, GhcBug.o ) [Flags changed]
[2 of 2] Linking GhcBug
False
 » ghc -threaded -main-is GhcBug GhcBug.hs && ./GhcBug
False
 » ghc -fforce-recomp -threaded -main-is GhcBug GhcBug.hs && ./GhcBug
[1 of 2] Compiling GhcBug           ( GhcBug.hs, GhcBug.o )
[2 of 2] Linking GhcBug [Objects changed]
True

Expected behavior

I expect that the -threaded flag should tickle the recompilation checker and force the program to be relinked to the correct runtime.

Environment

  • GHC version used: 9.4.3 from Nixpkgs

Optional:

  • Operating System: macOS
  • System Architecture: aarch64
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information