Hadrian: bump Cabal submodule, install extra dynamic flavours of libHSrts
ClosedPublic

Authored by alpmestan on Nov 27 2018, 4:43 AM.

Details

Summary

Previously, Hadrian was building all the appropriate dynamic ways for libHSrts
but they were not picked up and installed in the package database when
we register the rts library. Since we use Cabal for registering packages and
the .cabal files of packages as sources of truth for configuring and installing,
we ended up patching Cabal to add a new field, 'extra-dynamic-library-flavours',
to specify those extra flavours to install in .cabal files:

https://github.com/haskell/cabal/pull/5606

We now make use of this in rts.cabal.in to expose dynamic flavours behind a
Cabal flag, which Hadrian will use whenever we are building a GHC flavour that
requires dynamic libraries.

This is all part of a larger plan to build a dynamic stage 2 GHC by default,
like with make, which in turn will fix a lot of test failures. See Trac #15837.

Test Plan

hadrian/build.sh _build/stage1/lib/package.conf.d/rts-1.0.conf
_build/stage1/lib/x86_64-.../ should contain many libHSrts-*.so

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
alpmestan created this revision.Nov 27 2018, 4:43 AM
DavidEichmann accepted this revision.Nov 27 2018, 6:27 AM
This revision is now accepted and ready to land.Nov 27 2018, 6:27 AM
snowleopard accepted this revision.Nov 27 2018, 7:36 AM

Looks good to me!

My only concern is some duplication of the logic in rts.cabal.in:

if flag(profiling)
  extra-library-flavours: _p _thr_p
  if flag(debug)
    extra-library-flavours: _debug_p _thr_debug_p
if flag(debug)
  extra-library-flavours: _debug _thr_debug
  if flag(dynamic)
    extra-dynamic-library-flavours: _debug _thr_debug
if flag(logging)
  extra-library-flavours: _l _thr_l
  if flag(dynamic)
    extra-dynamic-library-flavours: _l _thr_l
if flag(dynamic)
  extra-dynamic-library-flavours: _thr

And in https://github.com/ghc/ghc/blob/master/hadrian/src/Settings/Default.hs#L155-L168:

-- | Default build ways for the RTS.
defaultRtsWays :: Ways
defaultRtsWays = mconcat
  [ pure [vanilla, threaded]
  , notStage0 ? pure
      [ profiling, threadedProfiling, debugProfiling, threadedDebugProfiling
      , logging, threadedLogging
      , debug, threadedDebug
      ]
  , notStage0 ? platformSupportsSharedLibs ? pure
      [ dynamic, threadedDynamic, debugDynamic, loggingDynamic
      , threadedDebugDynamic, threadedLoggingDynamic
      ]
  ]

Is there a way we could get rid of this duplication?

I don't see a way, currently.

The .cabal file's bit is necessary because we use Cabal to register the RTS library. The other is necessary because otherwise hadrian doesn't know what Cabal flags (dynamic, logging, etc) it should configure and build with (for any flavour that uses defaultRtsWays). Indeed, we use the flavour's rtsWays to make such decisions in a few places, so it better be accurate too. And I don't think we currently have a way to deduce one thing from the other.

Thanks @alpmestan, I agree with your thoughts.

alpmestan retitled this revision from Hadrian: install extra dynamic flavours of libHSrts to Hadrian: bump Cabal submodule, install extra dynamic flavours of libHSrts.Nov 29 2018, 10:14 AM
This revision was automatically updated to reflect the committed changes.