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 fails to install certain packages via stack ghci #1066

Closed
ndmitchell opened this issue Sep 28, 2015 · 10 comments
Closed

Stack fails to install certain packages via stack ghci #1066

ndmitchell opened this issue Sep 28, 2015 · 10 comments
Assignees
Milestone

Comments

@ndmitchell
Copy link
Contributor

I can't install unbounded-delays via stack ghci, but I can via stack install. @snoyberg, I guess you need another UTF8 fix?

C:\Neil\ghcid>stack ghci
unbounded-delays-0.1.0.9: configure
Progress: 0/3[["--with-ghc=C:\\ghc\\minghc-7.10.2-i386\\ghc-7.10.2\\bin\\ghc.exe"],[]]
unbounded-delays-0.1.0.9: build
Progre
--  While building package unbounded-delays-0.1.0.9 using:
      C:\ghc\minghc-7.10.2-i386\ghc-7.10.2\bin\runhaskell.exe -clear-package-db -global-package-db -package-db=C:\Users\ndmit_000\AppData\Roaming\stack\snapshots\i386-windows\lts-3.7\7.10.2\pkgdb\ -package-db=C:\Neil\ghcid\.stack-work\install\i386-windows\lts-3.7\7.10.2\pkgdb\ -hide-all-packages -package=Cabal-1.22.4.0 -package-id=Win32-2.3.1.0-0717dc053eabe89fdd28817a5eef792d -package-id=array-0.5.1.0-eb3ca0b82c3d51a49f55877242086b28 -package-id=base-4.8.1.0-4411f755eeebe72a83715ecebc424dd9 -package-id=bin-package-db-0.0.0.0-c87c9ebefa3add493f40b88366b91be9 -package-id=binary-0.7.5.0-21bfb535c2e89240dc3af41aa36d9b4d -package-id=bytestring-0.10.6.0-3a6a732ee0b8cb400ce04a0f0a3f15e6 -package-id=containers-0.5.6.2-d3868a26f70c1467cc87b86b1c21ae31 -package-id=deepseq-1.4.1.1-10f84b191b92d4df5a1b62ef8443e7d6 -package-id=directory-1.2.2.0-67861052f6528c2b3ae07ef68f3c2799 -package-id=filepath-1.4.0.0-ae307811bafd730695e1b4e0d36c99da -package-id=ghc-prim-0.4.0.0-85e834af445e5f9a2d8493a30508f0a2 -package-id=haskeline-0.7.2.1-d4343feaf006805df35fcf31a8826e52 -package-id=hoopl-3.10.0.2-6990d8bb63e5e7ba3c2beecba4cb86c3 -package-id=hpc-0.6.0.2-64f1e55905756b8ad7a33e8dbad2da5c -package-id=integer-gmp-1.0.0.0-bf42c470d1a99383609c2d63038c6d96 -package-id=pretty-1.1.2.0-72a7570af8c65135ebd7ac958a4a1812 -package-id=process-1.2.3.0-e80848e270871e1a525ad6051db8884a -package-id=template-haskell-2.10.0.0-20c59f6e05cad16c3065e9a0b2e7a84d -package-id=time-1.5.0.1-802c20236039b7ed50da988195abc16b -package-id=transformers-0.4.2.0-92071d0128abe0876342c7281d6628ae -package-id=xhtml-3000.2.1-da217cc339a4f9f70cb1d1cd0f71ab4c C:\Users\NDMIT_~1\AppData\Local\Temp\stack7068\unbounded-delays-0.1.0.9\Setup.hs --builddir=.stack-work\dist\49224016\ build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: C:\Neil\ghcid\.stack-work\logs\unbounded-delays-0.1.0.9.log

    Configuring unbounded-delays-0.1.0.9...
    Building unbounded-delays-0.1.0.9...
    Preprocessing library unbounded-delays-0.1.0.9...
    [1 of 2] Compiling Control.Concurrent.Thread.Delay ( Control\Concurrent\Thread\Delay.hs, .stack-work\dist\49224016\build\Control\Concurrent\Thread\Delay.o )
    [2 of 2] Compiling Control.Concurrent.Timeout ( Control\Concurrent\Timeout.hs, .stack-work\dist\49224016\build\Control\Concurrent\Timeout.o )
    .stack-work\dist\49224016\build\.\Control\Concurrent\Timeout.dump-hi: commitBuffer: invalid argument (invalid character)
ss
C:\Neil\ghcid>stack ghci
ghcid-0.5: unregistering (components added: test:ghcid_test)
unbounded-delays-0.1.0.9: configure
Progress: 0/3[["--with-ghc=C:\\ghc\\minghc-7.10.2-i386\\ghc-7.10.2\\bin\\ghc.exe"],[]]
unbounded-delays-0.1.0.9: build
Pr
--  While building package unbounded-delays-0.1.0.9 using:
      C:\ghc\minghc-7.10.2-i386\ghc-7.10.2\bin\runhaskell.exe -clear-package-db -global-package-db -package-db=C:\Users\ndmit_000\AppData\Roaming\stack\snapshots\i386-windows\lts-3.7\7.10.2\pkgdb\ -package-db=C:\Neil\ghcid\.stack-work\install\i386-windows\lts-3.7\7.10.2\pkgdb\ -hide-all-packages -package=Cabal-1.22.4.0 -package-id=Win32-2.3.1.0-0717dc053eabe89fdd28817a5eef792d -package-id=array-0.5.1.0-eb3ca0b82c3d51a49f55877242086b28 -package-id=base-4.8.1.0-4411f755eeebe72a83715ecebc424dd9 -package-id=bin-package-db-0.0.0.0-c87c9ebefa3add493f40b88366b91be9 -package-id=binary-0.7.5.0-21bfb535c2e89240dc3af41aa36d9b4d -package-id=bytestring-0.10.6.0-3a6a732ee0b8cb400ce04a0f0a3f15e6 -package-id=containers-0.5.6.2-d3868a26f70c1467cc87b86b1c21ae31 -package-id=deepseq-1.4.1.1-10f84b191b92d4df5a1b62ef8443e7d6 -package-id=directory-1.2.2.0-67861052f6528c2b3ae07ef68f3c2799 -package-id=filepath-1.4.0.0-ae307811bafd730695e1b4e0d36c99da -package-id=ghc-prim-0.4.0.0-85e834af445e5f9a2d8493a30508f0a2 -package-id=haskeline-0.7.2.1-d4343feaf006805df35fcf31a8826e52 -package-id=hoopl-3.10.0.2-6990d8bb63e5e7ba3c2beecba4cb86c3 -package-id=hpc-0.6.0.2-64f1e55905756b8ad7a33e8dbad2da5c -package-id=integer-gmp-1.0.0.0-bf42c470d1a99383609c2d63038c6d96 -package-id=pretty-1.1.2.0-72a7570af8c65135ebd7ac958a4a1812 -package-id=process-1.2.3.0-e80848e270871e1a525ad6051db8884a -package-id=template-haskell-2.10.0.0-20c59f6e05cad16c3065e9a0b2e7a84d -package-id=time-1.5.0.1-802c20236039b7ed50da988195abc16b -package-id=transformers-0.4.2.0-92071d0128abe0876342c7281d6628ae -package-id=xhtml-3000.2.1-da217cc339a4f9f70cb1d1cd0f71ab4c C:\Users\NDMIT_~1\AppData\Local\Temp\stack6116\unbounded-delays-0.1.0.9\Setup.hs --builddir=.stack-work\dist\49224016\ build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: C:\Neil\ghcid\.stack-work\logs\unbounded-delays-0.1.0.9.log

    Configuring unbounded-delays-0.1.0.9...
    Building unbounded-delays-0.1.0.9...
    Preprocessing library unbounded-delays-0.1.0.9...
    [1 of 2] Compiling Control.Concurrent.Thread.Delay ( Control\Concurrent\Thread\Delay.hs, .stack-work\dist\49224016\build\Control\Concurrent\Thread\Delay.o )
    [2 of 2] Compiling Control.Concurrent.Timeout ( Control\Concurrent\Timeout.hs, .stack-work\dist\49224016\build\Control\Concurrent\Timeout.o )
    .stack-work\dist\49224016\build\.\Control\Concurrent\Timeout.dump-hi: commitBuffer: invalid argument (invalid character)
og
C:\Neil\ghcid>stack ghci
unbounded-delays-0.1.0.9: configure
Progress: 0/3[["--with-ghc=C:\\ghc\\minghc-7.10.2-i386\\ghc-7.10.2\\bin\\ghc.exe"],[]]
unbounded-delays-0.1.0.9: build
Pr
--  While building package unbounded-delays-0.1.0.9 using:
      C:\ghc\minghc-7.10.2-i386\ghc-7.10.2\bin\runhaskell.exe -clear-package-db -global-package-db -package-db=C:\Users\ndmit_000\AppData\Roaming\stack\snapshots\i386-windows\lts-3.7\7.10.2\pkgdb\ -package-db=C:\Neil\ghcid\.stack-work\install\i386-windows\lts-3.7\7.10.2\pkgdb\ -hide-all-packages -package=Cabal-1.22.4.0 -package-id=Win32-2.3.1.0-0717dc053eabe89fdd28817a5eef792d -package-id=array-0.5.1.0-eb3ca0b82c3d51a49f55877242086b28 -package-id=base-4.8.1.0-4411f755eeebe72a83715ecebc424dd9 -package-id=bin-package-db-0.0.0.0-c87c9ebefa3add493f40b88366b91be9 -package-id=binary-0.7.5.0-21bfb535c2e89240dc3af41aa36d9b4d -package-id=bytestring-0.10.6.0-3a6a732ee0b8cb400ce04a0f0a3f15e6 -package-id=containers-0.5.6.2-d3868a26f70c1467cc87b86b1c21ae31 -package-id=deepseq-1.4.1.1-10f84b191b92d4df5a1b62ef8443e7d6 -package-id=directory-1.2.2.0-67861052f6528c2b3ae07ef68f3c2799 -package-id=filepath-1.4.0.0-ae307811bafd730695e1b4e0d36c99da -package-id=ghc-prim-0.4.0.0-85e834af445e5f9a2d8493a30508f0a2 -package-id=haskeline-0.7.2.1-d4343feaf006805df35fcf31a8826e52 -package-id=hoopl-3.10.0.2-6990d8bb63e5e7ba3c2beecba4cb86c3 -package-id=hpc-0.6.0.2-64f1e55905756b8ad7a33e8dbad2da5c -package-id=integer-gmp-1.0.0.0-bf42c470d1a99383609c2d63038c6d96 -package-id=pretty-1.1.2.0-72a7570af8c65135ebd7ac958a4a1812 -package-id=process-1.2.3.0-e80848e270871e1a525ad6051db8884a -package-id=template-haskell-2.10.0.0-20c59f6e05cad16c3065e9a0b2e7a84d -package-id=time-1.5.0.1-802c20236039b7ed50da988195abc16b -package-id=transformers-0.4.2.0-92071d0128abe0876342c7281d6628ae -package-id=xhtml-3000.2.1-da217cc339a4f9f70cb1d1cd0f71ab4c C:\Users\NDMIT_~1\AppData\Local\Temp\stack3476\unbounded-delays-0.1.0.9\Setup.hs --builddir=.stack-work\dist\49224016\ build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: C:\Neil\ghcid\.stack-work\logs\unbounded-delays-0.1.0.9.log

    Configuring unbounded-delays-0.1.0.9...
    Building unbounded-delays-0.1.0.9...
    Preprocessing library unbounded-delays-0.1.0.9...
    [1 of 2] Compiling Control.Concurrent.Thread.Delay ( Control\Concurrent\Thread\Delay.hs, .stack-work\dist\49224016\build\Control\Concurrent\Thread\Delay.o )
    [2 of 2] Compiling Control.Concurrent.Timeout ( Control\Concurrent\Timeout.hs, .stack-work\dist\49224016\build\Control\Concurrent\Timeout.o )
    .stack-work\dist\49224016\build\.\Control\Concurrent\Timeout.dump-hi: commitBuffer: invalid argument (invalid character)
og
C:\Neil\ghcid>stack install unbounded-delays
Setting codepage to UTF-8 (65001) to ensure correct output from GHC
unbounded-delays-0.1.0.9: configure
[["--with-ghc=C:\\ghc\\minghc-7.10.2-i386\\ghc-7.10.2\\bin\\ghc.exe"],[]]
unbounded-delays-0.1.0.9: build
unbounded-delays-0.1.0.9: install
@snoyberg
Copy link
Contributor

I'm unable to reproduce, and looking at the code I see the appropriate call to globalCodePageFix inside ghciCmd. What's your stack --version output?

@ndmitchell
Copy link
Contributor Author

Version 0.1.5.0, Git revision 06a4b27 I386.

I reproduced this several times in a row when it happened. Do you have any advice on how I can remove it from my stack workspace so I can try installing it again and confirm the same behaviour exists? Adding unbounded-delays-0.1.0.8 (which I expect would have the same issue) to my extra-deps either has no effect on HLint, or makes ghcid fail to configure.

@snoyberg
Copy link
Contributor

snoyberg commented Oct 4, 2015

You can try stack exec -- ghc-pkg unregister unbounded-delays --force

@ndmitchell
Copy link
Contributor Author

This most definitely reproduces:

C:\Neil\ghcid>stack init
Writing default config file to: C:\Neil\ghcid\stack.yaml
Basing on cabal files:
- C:\Neil\ghcid\ghcid.cabal

Checking against build plan lts-3.7
Selected resolver: lts-3.7
Wrote project config to: C:\Neil\ghcid\stack.yaml

C:\Neil\ghcid>stack ghci
unbounded-delays-0.1.0.9: configure
unbounded-delays-0.1.0.9: build
Pr
--  While building package unbounded-delays-0.1.0.9 using:
      C:\ghc\minghc-7.10.2-i386\ghc-7.10.2\bin\runhaskell.exe -clear-package-db -global-package-db -package-db=C:\Users\ndmit_000\AppData\Roaming\stack\snapshots\i386-windows\lts-3.7\7.10.2\pkgdb\ -package-db=C:\Neil\ghcid\.stack-work\install\i386-windows\lts-3.7\7.10.2\pkgdb\ -hide-all-packages -package=Cabal-1.22.4.0 -package-id=Win32-2.3.1.0-0717dc053eabe89fdd28817a5eef792d -package-id=array-0.5.1.0-eb3ca0b82c3d51a49f55877242086b28 -package-id=base-4.8.1.0-4411f755eeebe72a83715ecebc424dd9 -package-id=bin-package-db-0.0.0.0-c87c9ebefa3add493f40b88366b91be9 -package-id=binary-0.7.5.0-21bfb535c2e89240dc3af41aa36d9b4d -package-id=bytestring-0.10.6.0-3a6a732ee0b8cb400ce04a0f0a3f15e6 -package-id=containers-0.5.6.2-d3868a26f70c1467cc87b86b1c21ae31 -package-id=deepseq-1.4.1.1-10f84b191b92d4df5a1b62ef8443e7d6 -package-id=directory-1.2.2.0-67861052f6528c2b3ae07ef68f3c2799 -package-id=filepath-1.4.0.0-ae307811bafd730695e1b4e0d36c99da -package-id=ghc-prim-0.4.0.0-85e834af445e5f9a2d8493a30508f0a2 -package-id=haskeline-0.7.2.1-d4343feaf006805df35fcf31a8826e52 -package-id=hoopl-3.10.0.2-6990d8bb63e5e7ba3c2beecba4cb86c3 -package-id=hpc-0.6.0.2-64f1e55905756b8ad7a33e8dbad2da5c -package-id=integer-gmp-1.0.0.0-bf42c470d1a99383609c2d63038c6d96 -package-id=pretty-1.1.2.0-72a7570af8c65135ebd7ac958a4a1812 -package-id=process-1.2.3.0-e80848e270871e1a525ad6051db8884a -package-id=template-haskell-2.10.0.0-20c59f6e05cad16c3065e9a0b2e7a84d -package-id=time-1.5.0.1-802c20236039b7ed50da988195abc16b -package-id=transformers-0.4.2.0-92071d0128abe0876342c7281d6628ae -package-id=xhtml-3000.2.1-da217cc339a4f9f70cb1d1cd0f71ab4c C:\Users\NDMIT_~1\AppData\Local\Temp\stack2396\unbounded-delays-0.1.0.9\Setup.hs --builddir=.stack-work\dist\49224016\ build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: C:\Neil\ghcid\.stack-work\logs\unbounded-delays-0.1.0.9.log

    Configuring unbounded-delays-0.1.0.9...
    Building unbounded-delays-0.1.0.9...
    Preprocessing library unbounded-delays-0.1.0.9...
    [1 of 2] Compiling Control.Concurrent.Thread.Delay ( Control\Concurrent\Thread\Delay.hs, .stack-work\dist\49224016\build\Control\Concurrent\Thread\Delay.o )
    [2 of 2] Compiling Control.Concurrent.Timeout ( Control\Concurrent\Timeout.hs, .stack-work\dist\49224016\build\Control\Concurrent\Timeout.o )
    .stack-work\dist\49224016\build\.\Control\Concurrent\Timeout.dump-hi: commitBuffer: invalid argument (invalid character)

Didn't some idiot in #757 argue that stack ghci shouldn't change the codepage? (For pretty good reasons actually - maybe you need to change the codepage, then put it back?)

@snoyberg
Copy link
Contributor

snoyberg commented Oct 6, 2015

Curiously, that doesn't repro on my system either :/. The thing is: we are modifying the code page for the build portion of the ghci command, which you can see here:

unless (null packageTargets) $ globalFixCodePage go $

Would you be able to do some tracing and see if some of the returned values in fixCodePage are not as expected? The only other thing I can think of is that perhaps the WINDOWS CPP variable isn't being set correctly, but then stack build should also fail.

@ndmitchell
Copy link
Contributor Author

Tracing reveals that at

unless (null packageTargets) $ globalFixCodePage go $
packageTargets is [], so it never triggers the page fix. Are you literally running stack ghci? If so, how are packageTargets being set? It may be different for me because I have run stack build in the directory first? That builds some stuff, but not the test suite, which is the thing that requires unbounded-delays.

@snoyberg
Copy link
Contributor

snoyberg commented Oct 6, 2015

Apparently hidden inside Stack.Ghci is another call to build (not sure why we need two of them). I think I'm going to move the fixCodePage code to inside Stack.Build itself and see if that helps. I'm still unclear as to why I can't reproduce this problem. I'll ping you with a possible fix in the next 30 minutes or so most likely.

@snoyberg
Copy link
Contributor

snoyberg commented Oct 6, 2015

@ndmitchell Can you try out master now?

@snoyberg snoyberg added this to the P1: Must milestone Oct 6, 2015
@snoyberg snoyberg self-assigned this Oct 6, 2015
@ndmitchell
Copy link
Contributor Author

Thanks, it works now. It didn't drop into ghci at the end, but that may have been a wobble. It also complained about a reinstall of tasty, but that was due to my ghc-pkg unregister. I consider that solved.

@snoyberg
Copy link
Contributor

snoyberg commented Oct 6, 2015

Cool, hopefully the new placement will prevent any future problems.

@snoyberg snoyberg closed this as completed Oct 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants