Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'stack install ghc-mod' fails with latest LTS/Nightly snapshot on 64-bit Windows #2124

Closed
TerrorJack opened this issue May 11, 2016 · 7 comments
Milestone

Comments

@TerrorJack
Copy link

TerrorJack commented May 11, 2016

The error message is as follows:

--  While building package ghc-mod-5.5.0.0 using:
  C:\msys64\tmp\stack2428\ghc-mod-5.5.0.0\.stack-work\dist\2672c1f3\setup\setup --builddir=.stack-work\dist\2672c1f3 build --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: C:\Users\astro\AppData\Roaming\stack\global-project\.stack-work\logs\ghc-mod-5.5.0.0.log

[1 of 5] Compiling NotCPP.Utils     ( NotCPP\Utils.hs, C:\msys64\tmp\stack2428\ghc-mod-5.5.0.0\.stack-work\dist\2672c1f3\setup\NotCPP\Utils.o )
[2 of 5] Compiling NotCPP.LookupValueName ( NotCPP\LookupValueName.hs, C:\msys64\tmp\stack2428\ghc-mod-5.5.0.0\.stack-work\dist\2672c1f3\setup\NotCPP\LookupValueName.o )
[3 of 5] Compiling NotCPP.Declarations ( NotCPP\Declarations.hs, C:\msys64\tmp\stack2428\ghc-mod-5.5.0.0\.stack-work\dist\2672c1f3\setup\NotCPP\Declarations.o )
[4 of 5] Compiling SetupCompat      ( SetupCompat.hs, C:\msys64\tmp\stack2428\ghc-mod-5.5.0.0\.stack-work\dist\2672c1f3\setup\SetupCompat.o )
[5 of 5] Compiling Main             ( C:\msys64\tmp\stack2428\ghc-mod-5.5.0.0\Setup.hs, C:\msys64\tmp\stack2428\ghc-mod-5.5.0.0\.stack-work\dist\2672c1f3\setup\Main.o )
Linking C:\msys64\tmp\stack2428\ghc-mod-5.5.0.0\.stack-work\dist\2672c1f3\setup\setup.exe ...
Configuring ghc-mod-5.5.0.0...
Warning: This package indirectly depends on multiple versions of the same
package. This is highly likely to cause a compile failure.
package time-1.5.0.1 requires Win32-2.3.1.0
package process-1.2.3.0 requires Win32-2.3.1.0
package ghc-7.10.3 requires Win32-2.3.1.0
package directory-1.2.2.0 requires Win32-2.3.1.0
package time-1.5.0.1 requires Win32-2.3.1.1
package process-1.2.3.0 requires Win32-2.3.1.1
package directory-1.2.2.0 requires Win32-2.3.1.1
package ansi-terminal-0.6.2.3 requires Win32-2.3.1.1
package process-1.2.3.0 requires directory-1.2.2.0
package hpc-0.6.0.2 requires directory-1.2.2.0
package ghc-7.10.3 requires directory-1.2.2.0
package bin-package-db-0.0.0.0 requires directory-1.2.2.0
package temporary-1.2.0.4 requires directory-1.2.2.0
package process-1.2.3.0 requires directory-1.2.2.0
package hlint-1.9.32 requires directory-1.2.2.0
package ghc-mod-5.5.0.0 requires directory-1.2.2.0
package extra-1.4.5 requires directory-1.2.2.0
package cpphs-1.20.1 requires directory-1.2.2.0
package cabal-helper-0.6.3.1 requires directory-1.2.2.0
package Cabal-1.22.8.0 requires directory-1.2.2.0
package optparse-applicative-0.12.1.0 requires process-1.2.3.0
package hlint-1.9.32 requires process-1.2.3.0
package ghc-mod-5.5.0.0 requires process-1.2.3.0
package extra-1.4.5 requires process-1.2.3.0
package cmdargs-0.10.14 requires process-1.2.3.0
package cabal-helper-0.6.3.1 requires process-1.2.3.0
package Cabal-1.22.8.0 requires process-1.2.3.0
package ghc-7.10.3 requires process-1.2.3.0
package random-1.1 requires time-1.5.0.1
package ghc-mod-5.5.0.0 requires time-1.5.0.1
package extra-1.4.5 requires time-1.5.0.1
package directory-1.2.2.0 requires time-1.5.0.1
package Cabal-1.22.8.0 requires time-1.5.0.1
package hpc-0.6.0.2 requires time-1.5.0.1
package ghc-7.10.3 requires time-1.5.0.1
package directory-1.2.2.0 requires time-1.5.0.1
Building ghc-mod-5.5.0.0...
Preprocessing library ghc-mod-5.5.0.0...
[ 1 of 55] Compiling Data.Binary.Generic ( Data\Binary\Generic.hs, .stack-work\dist\2672c1f3\build\Data\Binary\Generic.o )
[ 2 of 55] Compiling Language.Haskell.GhcMod.Read ( Language\Haskell\GhcMod\Read.hs, .stack-work\dist\2672c1f3\build\Language\Haskell\GhcMod\Read.o )
[ 3 of 55] Compiling System.Directory.ModTime ( System\Directory\ModTime.hs, .stack-work\dist\2672c1f3\build\System\Directory\ModTime.o )
[ 4 of 55] Compiling Paths_ghc_mod    ( .stack-work\dist\2672c1f3\build\autogen\Paths_ghc_mod.hs, .stack-work\dist\2672c1f3\build\Paths_ghc_mod.o )
[ 5 of 55] Compiling Utils            ( Utils.hs, .stack-work\dist\2672c1f3\build\Utils.o )
[ 6 of 55] Compiling Language.Haskell.GhcMod.Caching.Types ( Language\Haskell\GhcMod\Caching\Types.hs, .stack-work\dist\2672c1f3\build\Language\Haskell\GhcMod\Caching\Types.o )
[ 7 of 55] Compiling Language.Haskell.GhcMod.Types ( Language\Haskell\GhcMod\Types.hs, .stack-work\dist\2672c1f3\build\Language\Haskell\GhcMod\Types.o )
GHC runtime linker: fatal error: I found a duplicate definition for symbol
   rgb
whilst processing object file
   C:\Users\astro\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.3\lib\Win32_ELFLzTRksT8Dql3wobiWvb\HSWin32-2.3.1.0-ELFLzTRksT8Dql3wobiWvb.o
This could be caused by:
   * Loading two different object files which export the same symbol
   * Specifying the same object file twice on the GHCi command line
   * An incorrect `package.conf' entry, causing some object to be
     loaded twice.
ghc.exe: panic! (the 'impossible' happened)
  (GHC version 7.10.3 for x86_64-unknown-mingw32):
    loadObj "C:\\Users\\astro\\AppData\\Local\\Programs\\stack\\x86_64-windows\\ghc-7.10.3\\lib\\Win32_ELFLzTRksT8Dql3wobiWvb\\HSWin32-2.3.1.0-ELFLzTRksT8Dql3wobiWvb.o": failed

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

I am building it in a mingw-w64 win64 shell (uname -a outputs MINGW64_NT-10.0 DESKTOP-RUPL5NM 2.5.0(0.297/5/3) 2016-04-12 13:08 x86_64 Msys).The ghc compiler I'm using is installed by stack setup, there is no global ghc. The build command is stack install ghc-mod, and it is not run in a project directory, so it is using implicit global config. Global project resolver is set to nightly-2016-05-08/lts-5.16, both fails. I also tried removing the whole %appdata%\stack directory (equivalent to ~/.stack in Linux), but that doesn't help either.

The issue is previously reported here, but "multiple versions of the same package" issue should be impossible given how stack works (and there is no extra-deps in my global stack.yaml)! So I think something may be wrong with stack.

@mgsloan mgsloan added this to the Support milestone May 11, 2016
@mgsloan
Copy link
Contributor

mgsloan commented May 11, 2016

I think that can happen when you are using a system installed ghc, or using a ghc version different than what the snapshot expects. This is very likely, because those are all ghc boot packages. Usually it doesn't matter if stack installs different versions of these packages, but when there is also a dependency on ghc, errors like this will occur.

Looks like your ghc is built against Win32-2.3.1.0, but your snapshot has Win32-2.3.1.0. There are a few things you can do:

  • Try adding Win32-2.3.1.0 to your extra-deps
  • Install the exact version of ghc that your stack.yaml config requires. Use stack setup --no-system-ghc for this. You may also need to pass --no-system-ghc to build if your system ghc versions match what's needed.

@TerrorJack
Copy link
Author

@mgsloan The ghc I'm using is installed by stack setup (no system-wide ghc installation). And I tried adding Win32-2.3.1.0 to my extra-deps, run stack clean --full and rebuild, now it's showing a different error:

--  While building package ghc-mod-5.5.0.0 using:
  C:\msys64\tmp\stack5724\ghc-mod-5.5.0.0\.stack-work\dist\2672c1f3\setup\setup --builddir=.stack-work\dist\2672c1f3 build --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: C:\Users\astro\AppData\Roaming\stack\global-project\.stack-work\logs\ghc-mod-5.5.0.0.log

[1 of 5] Compiling NotCPP.Utils     ( NotCPP\Utils.hs, C:\msys64\tmp\stack5724\ghc-mod-5.5.0.0\.stack-work\dist\2672c1f3\setup\NotCPP\Utils.o )
[2 of 5] Compiling NotCPP.LookupValueName ( NotCPP\LookupValueName.hs, C:\msys64\tmp\stack5724\ghc-mod-5.5.0.0\.stack-work\dist\2672c1f3\setup\NotCPP\LookupValueName.o )
[3 of 5] Compiling NotCPP.Declarations ( NotCPP\Declarations.hs, C:\msys64\tmp\stack5724\ghc-mod-5.5.0.0\.stack-work\dist\2672c1f3\setup\NotCPP\Declarations.o )
[4 of 5] Compiling SetupCompat      ( SetupCompat.hs, C:\msys64\tmp\stack5724\ghc-mod-5.5.0.0\.stack-work\dist\2672c1f3\setup\SetupCompat.o )
[5 of 5] Compiling Main             ( C:\msys64\tmp\stack5724\ghc-mod-5.5.0.0\Setup.hs, C:\msys64\tmp\stack5724\ghc-mod-5.5.0.0\.stack-work\dist\2672c1f3\setup\Main.o )
Linking C:\msys64\tmp\stack5724\ghc-mod-5.5.0.0\.stack-work\dist\2672c1f3\setup\setup.exe ...
Configuring ghc-mod-5.5.0.0...
Warning: This package indirectly depends on multiple versions of the same
package. This is highly likely to cause a compile failure.
package time-1.5.0.1 requires Win32-2.3.1.0
package process-1.2.3.0 requires Win32-2.3.1.0
package ghc-7.10.3 requires Win32-2.3.1.0
package directory-1.2.2.0 requires Win32-2.3.1.0
package time-1.5.0.1 requires Win32-2.3.1.0
package process-1.2.3.0 requires Win32-2.3.1.0
package directory-1.2.2.0 requires Win32-2.3.1.0
package ansi-terminal-0.6.2.3 requires Win32-2.3.1.0
package process-1.2.3.0 requires directory-1.2.2.0
package hpc-0.6.0.2 requires directory-1.2.2.0
package ghc-7.10.3 requires directory-1.2.2.0
package bin-package-db-0.0.0.0 requires directory-1.2.2.0
package temporary-1.2.0.4 requires directory-1.2.2.0
package process-1.2.3.0 requires directory-1.2.2.0
package hlint-1.9.32 requires directory-1.2.2.0
package ghc-mod-5.5.0.0 requires directory-1.2.2.0
package extra-1.4.6 requires directory-1.2.2.0
package cpphs-1.20.1 requires directory-1.2.2.0
package cabal-helper-0.6.3.1 requires directory-1.2.2.0
package Cabal-1.22.8.0 requires directory-1.2.2.0
package optparse-applicative-0.12.1.0 requires process-1.2.3.0
package hlint-1.9.32 requires process-1.2.3.0
package ghc-mod-5.5.0.0 requires process-1.2.3.0
package extra-1.4.6 requires process-1.2.3.0
package cmdargs-0.10.14 requires process-1.2.3.0
package cabal-helper-0.6.3.1 requires process-1.2.3.0
package Cabal-1.22.8.0 requires process-1.2.3.0
package ghc-7.10.3 requires process-1.2.3.0
package random-1.1 requires time-1.5.0.1
package ghc-mod-5.5.0.0 requires time-1.5.0.1
package extra-1.4.6 requires time-1.5.0.1
package directory-1.2.2.0 requires time-1.5.0.1
package Cabal-1.22.8.0 requires time-1.5.0.1
package hpc-0.6.0.2 requires time-1.5.0.1
package ghc-7.10.3 requires time-1.5.0.1
package directory-1.2.2.0 requires time-1.5.0.1
Building ghc-mod-5.5.0.0...
Preprocessing library ghc-mod-5.5.0.0...
<command line>: cannot satisfy -package-id cabal-helper-0.6.3.1-ed45f627c412920d2e00e7573412632e:
    cabal-helper-0.6.3.1-ed45f627c412920d2e00e7573412632e is unusable due to missing or recursive dependencies:
      Cabal-1.22.8.0-12da84426e3ed28d6c83c211370e2da8 directory-1.2.2.0-b1ddd3623a47218ee3dc5de785ca654c process-1.2.3.0-208a5ab474179033c71dcea71e1012b9
    (use -v for more information)

Seems extra-deps is not helping with the conflict between ghc's dependencies versus snapshot packages.

@TerrorJack
Copy link
Author

I think this is related to #1530 . Building ghc-mod with lts-5.15 goes fine, however breaks in lts-5.16 due to the bumping of Win32 version from 2.3.1.0 to 2.3.1.1. And even worse, specifying Win32-2.3.1.0 in extra-deps won't help, since stack still rebuilds Win32, directory, process, time and the rebuilt ones conflict with the ghc ones, causing packages that depends on ghc fails to build. Is there any work-arounds currently? @mgsloan

@mgsloan
Copy link
Contributor

mgsloan commented May 13, 2016

Seems likely that it's related to #1530.

I think that stackage bumping the Win32 version may be a stackage issue. It's quite possible that stackage does not realize that Win32 is a boot library, since the builds are usually done on linux AFAIK. I have opened commercialhaskell/stackage#1440 about this.

So, the workaround is "don't update to an lts version that overrides ghc boot packages on windows".

@TerrorJack
Copy link
Author

stack rebuilds Win32 even in the presence of extra-deps, I think it is appropriate to conclude it's also a stack issue. But thank you anyway for your response!

@mgsloan
Copy link
Contributor

mgsloan commented May 13, 2016

This is not a stack issue. We do want to support re-building different versions of ghc boot packages. This is a quite valid usecase, and omitting it would be a bug. This does cause issues in the rare case that you also have a dependency on ghc itself, such as is the case with ghc-mod. However, it only causes issues when versions are specified that are different than those included with ghc.

It looks like stackage will not be setting the Win32 version to something other than the version shipped with ghc in the future. That will resolve this issue, and adequate workarounds have been described, so closing.

@mgsloan mgsloan closed this as completed May 13, 2016
@mgsloan
Copy link
Contributor

mgsloan commented May 13, 2016

On further thought, I see what you mean. It could be considered a bug that specifying an extra-dep for a ghc version of a package causes it to be built (it should be used, so that ghc can also be used). I'm pretty sure this will be resolved as a side effect of #1265, which is slated to be implemented for the next large release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants