6.12.1 HC bootstrap failes due to suspicious static library ordering
I found ghc-stage2 doesn't link because of the order of static libraries passed to gcc. The problem occurs on FreeBSD but I believe it's platform-independent.
The build system puts rts/dist/build/libHSrts.a followed by rts/dist/build/libHSrtsmain.a. The latter has an undefined symbol to "hs_main" which is defined in libHSrts.a, so the linker complains about the absence of hs_main.
The following patch to rts/ghc.mk solves the problem:
--- ghc.mk.orig 2009-12-11 03:11:33.000000000 +0900
+++ ghc.mk
@@ -19,8 +19,9 @@ rts_dist_HC = $(GHC_STAGE1)
# merge GhcLibWays and GhcRTSWays but strip out duplicates
rts_WAYS = $(GhcLibWays) $(filter-out $(GhcLibWays),$(GhcRTSWays))
-ALL_RTS_LIBS = $(foreach way,$(rts_WAYS),rts/dist/build/libHSrts$($(way)_libsuf)) \
- rts/dist/build/libHSrtsmain.a
+ALL_RTS_LIBS = rts/dist/build/libHSrtsmain.a \
+ $(foreach way,$(rts_WAYS),rts/dist/build/libHSrts$($(way)_libsuf))
+
all_rts : $(ALL_RTS_LIBS)
# -----------------------------------------------------------------------------
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.12.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Build System |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |