Opened 2 years ago

Closed 2 years ago

Last modified 6 months ago

#7780 closed bug (fixed)

GHC HEAD dll fails to build on Windows

Reported by: rassilon Owned by: igloo
Priority: normal Milestone:
Component: Build System Version:
Keywords: Cc: bill@…
Operating System: Windows Architecture: Unknown/Multiple
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

Bitmap depends on PlatformConstants. Currently, dll0 fails to link because Bitmap has undefined references to PlatformContstants constructor info table like so:

compiler\stage2\build\Bitmap.dyn_o:fake:(.text+0x2f73): undefined reference to `ghczm7zi7zi20130319_PlatformConstants_Pl
atformConstants_con_info'
compiler\stage2\build\Bitmap.dyn_o:fake:(.text+0x5734): undefined reference to `ghczm7zi7zi20130319_PlatformConstants_Pl
atformConstants_con_info'
compiler\stage2\build\Bitmap.dyn_o:fake:(.text+0xd3e5): undefined reference to `ghczm7zi7zi20130319_PlatformConstants_Pl
atformConstants_con_info'
compiler\stage2\build\Bitmap.dyn_o:fake:(.text+0xfb8c): undefined reference to `ghczm7zi7zi20130319_PlatformConstants_Pl
atformConstants_con_info'

Attachments (4)

0001-Add-PlatformConstants-to-stage2_dll0_MODULES.patch (2.2 KB) - added by rassilon 2 years ago.
Include PlatformConstants in DLL0 MODULES
mkGraph.hs (3.4 KB) - added by igloo 2 years ago.
graph.png (239.5 KB) - added by igloo 2 years ago.
graph.pdf (121.7 KB) - added by igloo 2 years ago.

Download all attachments as: .zip

Change History (12)

Changed 2 years ago by rassilon

Include PlatformConstants in DLL0 MODULES

comment:1 Changed 2 years ago by rassilon

  • Status changed from new to patch

comment:2 Changed 2 years ago by igloo

  • difficulty set to Unknown
  • Owner set to igloo

Changed 2 years ago by igloo

Changed 2 years ago by igloo

Changed 2 years ago by igloo

comment:3 Changed 2 years ago by igloo

Hmm, I suspect that this worked for me because my optimisation flags meant that the cross-module reference got inlined.

I've been looking at making an automated check for this, but discovered that all but these 14 modules:

CmmRewriteAssignments
Debugger
DriverMkDepend
DriverPipeline
GHC
GhcMake
GhcPlugins
LexCore
ParserCore
ParserCoreUtils
PprTyThing
RegAlloc.Graph.ArchBase
RegAlloc.Graph.ArchX86
RegAlloc.Graph.Coalesce

are in the module import loop in the ghc package.

I've attached the graph and the script to make it. Red blobs are boot modules, and blue blobs are normal modules which have a boot counterpart.

comment:4 Changed 2 years ago by rassilon

Hrm, I built with a perf flavor build set with:

SRC_HC_OPTS     = -O -H64m
GhcStage1HcOpts = -O -fasm
GhcStage2HcOpts = -O2 -fasm -Rghc-timing
GhcHcOpts       = -Rghc-timing
GhcLibHcOpts    = -O2 -Rghc-timing
GhcLibWays     += p

I'll try again with Stage1HcOpts/SRC_HC_OPTS with -O2 and see what happens.

comment:5 Changed 2 years ago by igloo@…

commit ba7952bdae641b52fd08b38ae6bb75446f42e6a1

Author: Ian Lynagh <[email protected]>
Date:   Sat Apr 6 16:27:30 2013 +0100

    Change the list of modules that are put into a separate DLL on Windows
    
    Fixes #7780.

 compiler/ghc.mk |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

comment:6 Changed 2 years ago by ian@…

commit 444119fbb78aef88450bc51b54429942f8ef3cbf

Author: Ian Lynagh <[email protected]>
Date:   Sat Apr 6 23:05:29 2013 +0100

    Add a check that the Windows DLL split is OK; fixes #7780

 compiler/ghc.mk                 |    1 +
 ghc.mk                          |    2 +
 rules/build-package-way.mk      |   11 +++++
 utils/dll-split/Main.hs         |   85 +++++++++++++++++++++++++++++++++++++++
 utils/dll-split/dll-split.cabal |   21 ++++++++++
 utils/dll-split/ghc.mk          |   18 ++++++++
 6 files changed, 138 insertions(+), 0 deletions(-)

comment:7 Changed 2 years ago by igloo

  • Resolution set to fixed
  • Status changed from patch to closed

OK, the package is now safely split in 2, and a check that the split is correct is done every time GHC is built.

comment:8 Changed 6 months ago by Sergei Trofimovich <slyfox@…>

In 2a8ea4745d6ff79d6ce17961a64d9013243fc3c6/ghc:

ghc.mk: fix list for dll-split on GHCi-less builds

To reproduce build failure it's enough to try
to build GHC on amd64 with the following setup:

    $ cat mk/build.mk
    # for #9552
    GhcWithInterpreter = NO

It gives:

    Reachable modules from DynFlags out of date
    Please fix compiler/ghc.mk, or building DLLs on Windows may break (#7780)
    Redundant modules: Bitmap BlockId ... <list of 42 modules>
    <make error>

dll-split among other things makes sure
all mentioned modules are used by DynFlags.
'#ifdef GHCI' keeps is from happening.

Patch moves those 42 modules under
'GhcWithInterpreter' guard.

Fixes Issue #9552

Signed-off-by: Sergei Trofimovich <[email protected]>
Note: See TracTickets for help on using tickets.