Repository navigation
Closed
Milestone
Description
I had dependency problems building my project with global cabal, so i wanted to switch to stack. Whereas I am able to install new packages via cabal-install, stack always fails with the same error.
The system is Windows 8.1 x64 first with haskell platform and stack, later only stack. The error did not change.
Steps to reproduce
- Download stack installer and install stack
- Create new stack project with
stack new cdinto the new project directorystack setupfinishes successfully (both with haskell platform ghc and newly downloaded ghc)- Try
stack install cabal-install(or any other package)
Expected:
6. successful build of cabal and other packages
Actual:
6. Get the following error structure:
PS D:\stacktest> stack build
Setting codepage to UTF-8 (65001) to ensure correct output from GHC
[1 of 1] Compiling Main ( C:\Users\USER\AppData\Local\Temp\stack764\Setup.hs, C:\Users\USER\AppData\Lo
cal\Temp\stack764\Setup.o )
Linking C:\stack_root\setup-exe-cache\tmp-setup-Simple-Cabal-1.22.4.0-x86_64-windows-ghc-7.10.2.exe ...
stacktest-0.1.0.0: configure
Configuring stacktest-0.1.0.0...
setup-Simple-Cabal-1.22.4.0-x86_64-windows-ghc-7.10.2.exe: fd:4: invalid
argument
setup-Simple-Cabal-1.22.4.0-x86_64-windows-ghc-7.10.2.exe: fd:4: hGetContents: invalid argument (invalid byte sequence)
-- While building package stacktest-0.1.0.0 using:
C:\stack_root\setup-exe-cache\setup-Simple-Cabal-1.22.4.0-x86_64-windows-ghc-7.10.2.exe --builddir=.stack-work\dis
t\d96ab9d9 configure --with-ghc=C:\Users\USER\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.2\bin\ghc.exe --wi
th-ghc-pkg=C:\Users\USER\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.2\bin\ghc-pkg.exe --user --package-db=c
lear --package-db=global --package-db=C:\stack_root\snapshots\cf5cf2bf\pkgdb --package-db=D:\stacktest\.stack-work\insta
ll\2bc429f2\pkgdb --libdir=D:\stacktest\.stack-work\install\2bc429f2\lib --bindir=D:\stacktest\.stack-work\install\2bc42
9f2\bin --datadir=D:\stacktest\.stack-work\install\2bc429f2\share --libexecdir=D:\stacktest\.stack-work\install\2bc429f2
\libexec --sysconfdir=D:\stacktest\.stack-work\install\2bc429f2\etc --docdir=D:\stacktest\.stack-work\install\2bc429f2\d
oc\stacktest-0.1.0.0 --htmldir=D:\stacktest\.stack-work\install\2bc429f2\doc\stacktest-0.1.0.0 --haddockdir=D:\stacktest
\.stack-work\install\2bc429f2\doc\stacktest-0.1.0.0 --dependency=base=base-4.8.1.0-5e8cb96faebe2db97f24c6e11c6070d6 --ex
tra-include-dirs=C:\Users\USER\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw32\include --extra-inc
lude-dirs=C:\Users\USER\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\include --extra-lib-dirs=C
:\Users\USER\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw32\lib --extra-lib-dirs=C:\Users\USER
\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib --enable-tests --enable-benchmarks
Process exited with code: ExitFailure 1
PS D:\stacktest> stack build
Setting codepage to UTF-8 (65001) to ensure correct output from GHC
stacktest-0.1.0.0: configure
Configuring stacktest-0.1.0.0...
setup-Simple-Cabal-1.22.4.0-x86_64-windows-ghc-7.10.2.exe: fd:4: invalid
argument
setup-Simple-Cabal-1.22.4.0-x86_64-windows-ghc-7.10.2.exe: fd:4: hGetContents: invalid argument (invalid byte sequence)
-- While building package stacktest-0.1.0.0 using:
C:\stack_root\setup-exe-cache\setup-Simple-Cabal-1.22.4.0-x86_64-windows-ghc-7.10.2.exe --builddir=.stack-work\dis
t\d96ab9d9 configure --with-ghc=C:\Users\USER\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.2\bin\ghc.exe --wi
th-ghc-pkg=C:\Users\USER\AppData\Local\Programs\stack\x86_64-windows\ghc-7.10.2\bin\ghc-pkg.exe --user --package-db=c
lear --package-db=global --package-db=C:\stack_root\snapshots\cf5cf2bf\pkgdb --package-db=D:\stacktest\.stack-work\insta
ll\2bc429f2\pkgdb --libdir=D:\stacktest\.stack-work\install\2bc429f2\lib --bindir=D:\stacktest\.stack-work\install\2bc42
9f2\bin --datadir=D:\stacktest\.stack-work\install\2bc429f2\share --libexecdir=D:\stacktest\.stack-work\install\2bc429f2
\libexec --sysconfdir=D:\stacktest\.stack-work\install\2bc429f2\etc --docdir=D:\stacktest\.stack-work\install\2bc429f2\d
oc\stacktest-0.1.0.0 --htmldir=D:\stacktest\.stack-work\install\2bc429f2\doc\stacktest-0.1.0.0 --haddockdir=D:\stacktest
\.stack-work\install\2bc429f2\doc\stacktest-0.1.0.0 --dependency=base=base-4.8.1.0-5e8cb96faebe2db97f24c6e11c6070d6 --ex
tra-include-dirs=C:\Users\USER\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw32\include --extra-inc
lude-dirs=C:\Users\USER\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\include --extra-lib-dirs=C
:\Users\USER\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw32\lib --extra-lib-dirs=C:\Users\USER
\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib --enable-tests --enable-benchmarks
Process exited with code: ExitFailure 1
I have tried both powershell and cmd, uninstalling haskell platform, manually removing the stack root, ghc and cabal dirs in %APPDATA%. It doesn't change. Someone on the IRC suggested a unicode problem, but i have no idea how to check for that.
Reacted by monnef
Activity
pbethke commentedon Nov 29, 2015
Oh, that lengthy command
C:\stack_root\setup-exe-cache\setup-Simple-Cabal-1.22.4.0-x86_64-windows-ghc-7.10.2.exe...` doesn't fail if i call it manually. Is it related to that codepage setting?pbethke commentedon Nov 29, 2015
OK, one more update:
Using the
bashsome ssh client brought onto my system, I am able to install and build packages again:stack buildfails just as beforeLANG=C.utf-8 stack buildworks as intended.mgsloan commentedon Jan 3, 2016
Did
LANG=C.utf-8resolve the issue, then? Feel free to re-open if not.CarstenKoenig commentedon Jan 11, 2016
I have the same issue on windows with
and while
LANG=C.utf-8 stack buidsolves the problem it (of course) only works if you are using some kind of bashI think you can also add this to your environment variables in windows to work but all this feels like workarounds to me - so it would be great if you could look on it again
in case I am just using an outdated version (although I did grab the latest binary just now) - then please feel free to ignore or delete this comment/item
Thank you
mgsloan commentedon Jan 11, 2016
@borsboom @snoyberg I don't really grok this windows codepage stuff. Is there something that can be done automatically here?
A couple relevant issues from the past, that led to the current codepage stuff: #757 #824
4 remaining items
CarstenKoenig commentedon Jan 21, 2016
Update: it seems to work for me right now even on GHC 7.10.2 which seems strange (especially as it tells me
still)
CarstenKoenig commentedon Feb 3, 2016
Well sadly the issue is back: if I
I get
this time no setting (tried
LANG,LANGUAGE,LC_ALL) helps[-]Stack fails to build anything[/-][+]"invalid argument" error on windows[/+]mgsloan commentedon Feb 4, 2016
Interesting. Is there anything unusual about your setup? I'm just wondering why we aren't hearing similar things from other windows users.
CarstenKoenig commentedon Feb 4, 2016
well that is hard to tell:
stack --version: Version 1.0.2, Git revision fa09a980d8bb3df88b2a9193cd9bf84cc6c419b3 (3084 commits) x86_64ghc --version: The Glorious Glasgow Haskell Compilation System, version 7.10.2cabal --version: cabal-install version 1.22.6.0 using version 1.22.4.0 of the Cabal libraryLANG=C.utf8set in environment (but tried to remove it too)The error happened first in the middle of building a project using
yesod-hello-world- at least 20 dependencies build without any problems. But as I said a direct call tostack install transformer-base(after the firststack build) always get's me the error too.And maybe this is why you don't hear that much - if it only happens with certain packages in the middle of a big pile of other packages(?)
CarstenKoenig commentedon Mar 14, 2016
it's still there with stack 1.0.4 (while building ghcjs) - I tried:
LC_ALL,LANGUAGE,LANGtoC.utf8,de_DE.utf8oren_US.utf8chcp 65001(command-prompt)nothing works at the moment
mgsloan commentedon Mar 14, 2016
I'm not familiar enough with this issue / windows to be much help, sorry! One wild guess is to try temporarily switching the locale to english? That would at least tell us if it's some sort of issue related to locale
CarstenKoenig commentedon Apr 4, 2016
I just tried again and yes @mgsloan was on the right track.
Thankfully you don't have to reset your complete system.
At least on my german Win8 and Win10 systems - if you change the Language for non-Unicode programs settings in windows (as described here) to Englisch (US)
GhcJs seems to be finally compiling (at least the
transformersproblem is gone)borsboom commentedon Apr 4, 2016
Does anything change if you use GHC 7.10.3 instead of 7.10.2? They fixed some locale issues on Windows in that and Stack disables its workarounds (which were not entirely reliable) when using 7.10.3 or later.
tlewowski commentedon Sep 24, 2016
I have the exactly same problem, also during building GHCJS -
transformersnot compiling on 64-bit Windows 10 with errorcommitBuffer: invalid argument (invalid character). SettingLC_ALLetc. didn't help.I checked
stack1.1.2 and 1.2.0 (no differences - neither works) and GHC 7.10.3 and 7.10.2 (also neither works).Changing Language for non-Unicode programs to English (US) helped (my usual locale is Polish).
If it's hard to fix and heavily configuration-dependent, it would be great if we at least had a hint in https://docs.haskellstack.org/en/stable/ghcjs/#ghcjs that such problems happen in Windows environments and the workaround is changing locale
Added workaround explaination for non-English, Windows users of GHCJS (…
Added workaround explaination for non-English, Windows users of GHCJS (…
mgsloan commentedon Oct 4, 2016
Since there is a documentation fix, closing this for now. If there is something that stack can do better here, please open another issue about it!
nh2 commentedon Apr 27, 2018
I've created #3988 to fix this issue properly so that the workaround linked above should no longer be necessary once done.