Opened 4 years ago

Closed 4 years ago

Last modified 2 years 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 Rev(s):
Wiki Page:


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
compiler\stage2\build\Bitmap.dyn_o:fake:(.text+0x5734): undefined reference to `ghczm7zi7zi20130319_PlatformConstants_Pl
compiler\stage2\build\Bitmap.dyn_o:fake:(.text+0xd3e5): undefined reference to `ghczm7zi7zi20130319_PlatformConstants_Pl
compiler\stage2\build\Bitmap.dyn_o:fake:(.text+0xfb8c): undefined reference to `ghczm7zi7zi20130319_PlatformConstants_Pl

Attachments (4)

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

Download all attachments as: .zip

Change History (12)

Changed 4 years ago by rassilon

Include PlatformConstants in DLL0 MODULES

comment:1 Changed 4 years ago by rassilon

Status: newpatch

comment:2 Changed 4 years ago by igloo

difficulty: Unknown
Owner: set to igloo

Changed 4 years ago by igloo

Attachment: mkGraph.hs added

Changed 4 years ago by igloo

Attachment: graph.png added

Changed 4 years ago by igloo

Attachment: graph.pdf added

comment:3 Changed 4 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:


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 4 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 4 years ago by igloo@…

commit ba7952bdae641b52fd08b38ae6bb75446f42e6a1

Author: Ian Lynagh <>
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/ |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

comment:6 Changed 4 years ago by ian@…

commit 444119fbb78aef88450bc51b54429942f8ef3cbf

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

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

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

comment:7 Changed 4 years ago by igloo

Resolution: fixed
Status: patchclosed

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 2 years ago by Sergei Trofimovich <slyfox@…>

In 2a8ea4745d6ff79d6ce17961a64d9013243fc3c6/ghc: 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/
    # for #9552
    GhcWithInterpreter = NO

It gives:

    Reachable modules from DynFlags out of date
    Please fix compiler/, 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 <>
Note: See TracTickets for help on using tickets.