[GHC] #9955: ghc-stage1 compiles with bootstrapping ghc package, not the built one

#9955: ghc-stage1 compiles with bootstrapping ghc package, not the built one -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.10.1 Component: Build | Version: 7.11 System | Operating System: Unknown/Multiple Keywords: | Type of failure: Incorrect result Architecture: | at runtime Unknown/Multiple | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Steps to reproduce: Build GHC using 7.10 as the bootstrapping compiler. Now check which GHC package stage 1 Main.hi was linked against, e.g. using `--show-iface`: {{{ [ezyang@hs01 ghc-validate2]$ ../ghc-7.10/inplace/bin/ghc-stage2 --show- iface ghc/stage1/build/Main.hi ... package dependencies: array-0.5.0.1 base-4.8.0.0 binary-0.7.2.3 bin-package-db-0.0.0.0 bytestring-0.10.6.0 containers-0.5.6.2 deepseq-1.4.0.0 directory-1.2.1.1 filepath-1.3.1.0 ghc-7.10.0.20141223 ghc-prim-0.3.1.0 hoopl-3.10.0.2 hpc-0.6.0.2 integer-gmp-1.0.0.0 process-1.2.1.0 time-1.5.0.1 transformers-0.4.2.0 unix-2.7.1.0 }}} Bad news! I think I introduced bug when I made GHC a wired in package: consequently when we ask GHC to link against a specific version of the GHC package, this flag is ignored. I don't actually know what the right way to fix this is, but we'll have to figure something out here. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9955 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9955: ghc-stage1 compiles with bootstrapping ghc package, not the built one -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.10.1 Component: Build System | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by ezyang): Strangely, though, the ghc-stage1 executable does seem to be running the most recently built code... (Hypothesis: we are type-checking against the bootstrapping copy, but linking against the correct copy.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9955#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9955: ghc-stage1 compiles with bootstrapping ghc package, not the built one -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: new Priority: high | Milestone: 7.10.1 Component: Build System | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by ezyang): * priority: highest => high Comment: Falsified previous hypothesis. In fact, building GHC HEAD 7.10 works just fine; it's just the other way around that is a problem. Here's what's going on: When there are multiple wired in packages, we seem to ignore the hide-all- packages directive, and instead simply take all instances of the wired in package and *select the newest version*. Thus, when we compile GHC HEAD with GHC 7.10, the ghc package from GHC HEAD has a newer version than the system ghc package from 7.10, and we use that when compiling. However, when we build 7.10 with GHC HEAD, we always select the system GHC HEAD library, which works about as well as you'd expect. What is going on with the `--show-iface`? The key is that package dependency description is done by a lookup in the package database. The package key for 'ghc' is always ghc, no matter what the version is (since it's wired in), but I notably have NOT told ghc about the inplace package database in my show-iface command. So we lookup the package keyed 'ghc' in the default database, which is 7.10's, voila. This behavior sort of makes sense. In particular, it does make sense for GHC to try to output something besides a package key when referring to packages in debug output, because in general you don't necessarily care about the key in question, and the output is a lot more readable if you just get package name-version. The downside is it's easy to mess up wired in packages. It's possible #9652 is caused by the same underlying mechanism. My proposed fix for the wired in problem is to properly teach GHC to respect `-hide-all-packages -package wired-in-0.1.2`: we really SHOULD pick 0.1.2, even if there is a newer version. Of course, if we don't mention the wired in package, it probably makes sense to default back to the newest version. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9955#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9955: ghc-stage1 compiles with bootstrapping ghc package, not the built one -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: patch Priority: high | Milestone: 7.10.1 Component: Build System | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D603 -------------------------------------+------------------------------------- Changes (by ezyang): * status: new => patch * differential: => Phab:D603 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9955#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9955: ghc-stage1 compiles with bootstrapping ghc package, not the built one
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner:
Type: bug | Status: patch
Priority: high | Milestone: 7.10.1
Component: Build System | Version: 7.11
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect result | Unknown/Multiple
at runtime | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Revisions: Phab:D603
-------------------------------------+-------------------------------------
Comment (by Edward Z. Yang

#9955: ghc-stage1 compiles with bootstrapping ghc package, not the built one -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: merge Priority: high | Milestone: 7.10.1 Component: Build System | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D603 -------------------------------------+------------------------------------- Changes (by ezyang): * status: patch => merge -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9955#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9955: ghc-stage1 compiles with bootstrapping ghc package, not the built one -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: closed Priority: high | Milestone: 7.10.1 Component: Build System | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: Phab:D603 -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-7.10` (via 57df7b312c408338401140474f5afc6951d49cf9). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9955#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC