Linking stage 2 compiler with non-threaded RTS using Make?

PHO pho at cielonegro.org
Wed Jan 15 12:05:51 UTC 2020


I'm a maintainer of a GHC package in pkgsrc - a package collection
mainly used by NetBSD. Our package has the following patch to ghc/ghc.mk
to work around the problem. The issue is that, while
ghc/ghc-bin.cabal.in has a flag to link against non-threaded RTS, the
build system doesn't propagate GhcThreaded to it:

> --- ghc/ghc.mk.orig	2019-08-25 12:03:36.000000000 +0000
> +++ ghc/ghc.mk
> @@ -61,7 +61,13 @@ ifeq "$(GhcThreaded)" "YES"
>  # Use threaded RTS with GHCi, so threads don't get blocked at the prompt.
>  ghc_stage2_MORE_HC_OPTS += -threaded
>  ghc_stage3_MORE_HC_OPTS += -threaded
> +else
> +# Opt out from threaded GHC. See ghc-bin.cabal.in
> +ghc_stage2_CONFIGURE_OPTS += -f-threaded
> +ghc_stage3_CONFIGURE_OPTS += -f-threaded
>  endif
> +# Stage-0 compiler isn't guaranteed to have a threaded RTS.
> +ghc_stage1_CONFIGURE_OPTS += -f-threaded
>  
>  ifeq "$(GhcProfiled)" "YES"
>  ghc_stage2_PROGRAM_WAY = p


On 2020-01-15 20:16, Ömer Sinan Ağacan wrote:
> I just realized that the wiki page for ticky profiling [1] suggests using
> `GhcThreaded = NO` becuase ticky profiling is not compatible with threaded
> runtime.
> 
> I think this suggests that `GhcThreaded = NO` used to work. It doesn't work
> anymore.
> 
> Ömer
> 
> [1]: https://gitlab.haskell.org/ghc/ghc/wikis/debugging/ticky-ticky
> 
> Ömer Sinan Ağacan <omeragacan at gmail.com>, 15 Oca 2020 Çar, 14:11
> tarihinde şunu yazdı:
>>
>> Btw I just realized that this also makes ticky-ticky profiling harder becuase as
>> far as I know ticky profiling not compatible with threaded runtime. I need to
>> try ticky profiling for !1747 and I'm currently painfully manually linking the
>> stage 2 executable using the method I described in my original email.
>>
>> Ömer
>>
>> Brandon Allbery <allbery.b at gmail.com>, 9 Oca 2020 Per, 18:10 tarihinde
>> şunu yazdı:
>>>
>>> There are some hidden dependencies, in particular ghci requires GhcThreaded last I checked (and ghci == ghc --interactive, not a separate program that could be linked threaded). You may also have to disable the entire bytecode backend, which would take TH and runghc with it as well as ghci.
>>>
>>> On Thu, Jan 9, 2020 at 8:02 AM Ömer Sinan Ağacan <omeragacan at gmail.com> wrote:
>>>>
>>>> Anyone know how to link stage 2 with non-threaded RTS using Make build system?
>>>> There's a variable GhcThreaded, but setting it "NO" makes no difference, stage 2
>>>> compiler is still threaded.
>>>>
>>>> So far the only way I could find is to redirect build system output to a file,
>>>> find the step that linked ghc-stage2, repeat that command but without -threaded.
>>>> It's really painful as I have to repeat this step after every rebuild.
>>>>
>>>> Any tips?
>>>>
>>>> Thanks,
>>>>
>>>> Ömer
>>>> _______________________________________________
>>>> ghc-devs mailing list
>>>> ghc-devs at haskell.org
>>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>>>
>>>
>>>
>>> --
>>> brandon s allbery kf8nh
>>> allbery.b at gmail.com
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
> 


More information about the ghc-devs mailing list