[GHC] #15837: Hadrian should build dynamically linked ghc binary

GHC ghc-devs at haskell.org
Wed Nov 28 17:50:51 UTC 2018


#15837: Hadrian should build dynamically linked ghc binary
-------------------------------------+-------------------------------------
        Reporter:  davide            |                Owner:  davide
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Build System      |              Version:  8.6.1
  (Hadrian)                          |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D5385
       Wiki Page:                    |  Phab:D5327
-------------------------------------+-------------------------------------
Changes (by davide):

 * differential:  Phab:D5385 => Phab:D5385 Phab:D5327


Old description:

> The ghc binary is dynamically linked via make in various flavors (e.g.
> quick). Hadrian builds a static linked binary in these cases (this is a
> bug). Various change are needed to fix this:
>
> 1. Add new .cabal file field extra-dynamic-library-flavours (see
> [https://github.com/haskell/cabal/pull/5606 this PR]).
> 2. Use .cabal extra-dynamic-library-flavours for the RTS (see
> [https://github.com/snowleopard/hadrian/issues/695#issue-367436377 this
> comment], depends on 1.)
> 3. Hadrian: fix management of nontrivial dynamic flavours of libHSrts
> (see  [https://github.com/snowleopard/hadrian/pull/698 this PR]).
> 4. Hadrian should build ghc with the `-fPIC -dynamic` options (see
> [https://github.com/DavidEichmann/ghc/commit/752021f69f577b678630302b567fd712c565624b
> #diff-408bbe46d4afae11991cbadb2c531b78 this comment], depends on 3.).
> 5. Use the correct relative path to the dynamically linked libraries (see
> [https://phabricator.haskell.org/D5281 patch D5281], depends on 3. and
> 4.).
> 6. Build ghc-iserv-dyn, as it is will be required required by many tests
> (see/depends on [https://phabricator.haskell.org/D5255 D5255 patch for
> ghc-iserv-prof])

New description:

 The ghc binary is dynamically linked via make in various flavors (e.g.
 quick). Hadrian builds a static linked binary in these cases (this is a
 bug). Various change are needed to fix this:

 1. Add new .cabal file field extra-dynamic-library-flavours (see
 [https://github.com/haskell/cabal/pull/5606 this PR]).
 2. Use .cabal extra-dynamic-library-flavours for the RTS (see
 [https://github.com/snowleopard/hadrian/issues/695#issue-367436377 this
 comment], depends on 1.)
 3. Hadrian: fix management of nontrivial dynamic flavours of libHSrts (see
 [https://github.com/snowleopard/hadrian/pull/698 this PR]).
 4. Hadrian should build ghc with the `-fPIC -dynamic` options (see
 [https://github.com/DavidEichmann/ghc/commit/752021f69f577b678630302b567fd712c565624b
 #diff-408bbe46d4afae11991cbadb2c531b78 this comment], depends on 3.).
 5. Use the correct relative path to the dynamically linked libraries (see
 Phab:D5281, depends on 3. and 4.).
 6. Build ghc-iserv-dyn, as it is will be required required by many tests
 (Phab:D5327)
 7. Hadrian should only use "-shared -dynload deploy" when linking shared
 libraries (definitely not when linking executables). This problem causes
 ghc-iserv-dyn to segfault because it is built as a shared library instead
 of as an executable.

--

Comment:

 Update:
 With changes 1 to 7 I'm able to build a dynamically linked ghc and this
 fixes a significant number of tests! The end is in sight! The current
 status is:
 * (1, 2, 3) Are done and merged (Thank you Alp!).
 * (6) Phab:D5327 done and merged!
 * (4, 7) Should be fixed in a small patch that I am currently preparing.
 * (5) Phab:D52816 after 4 and 7 are fixed, this needs some updating, but
 is on the right track.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15837#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list