On Windows, when trying to build (after cloning) using the following command:
C:\Tools\haskell-ide-engine [master 鈮> stack .\install.hs cabal-build-all
Gives the following output:
install.hs: C:\Users\Arthur: createProcess: does not exist (No such file or directory)
I'm not really experienced with stack but it appears to be an issue with spaces in the path (my actual user folder is C:\Users\Arthur Heidt), the path appears to be cut off at the first space.
Do we know which command failed specifically? E.g. does stack .\install.hs help fail with the same error?
Or is this a cabal issue, e.g. cabal v2-build fails?
@fendor any stack .\install.hs fails:
C:\Tools\haskell-ide-engine [master 鈮> stack .\install.hs
install.hs: C:\Users\Arthur: createProcess: does not exist (No such file or directory)
C:\Tools\haskell-ide-engine [master 鈮> stack .\install.hs help
install.hs: C:\Users\Arthur: createProcess: does not exist (No such file or directory)
It probably doesn't matter but I'm using the integrated powershell terminal in vscode.
cabal v2-build also does not work but it gives some more diagonstics:
Failed to build network-3.0.1.1. The failure occurred during the configure
step.
Build log ( C:\Users\Arthur
Heidt\AppData\Roaming\cabal\logs\ghc-8.6.5\network-3.0.1.1-a7c0a2f72c1e0fc4564857678c584897c6b48964.log
):
Configuring network-3.0.1.1...
cabal.exe: The package has a './configure' script. If you are on Windows, This
requires a Unix compatibility toolchain such as MinGW+MSYS or Cygwin. If you
are not on Windows, ensure that an 'sh' command is discoverable in your path.
cabal.exe: Failed to build network-3.0.1.1 (which is required by
test:unit-test from haskell-ide-engine-0.12.0.0, test:wrapper-test from
haskell-ide-engine-0.12.0.0 and others). See the build log above for details.
It needs a unix toolchain but I believe it is included with the Haskell platform. Here is the file: network-3.0.1.1-a7c0a2f72c1e0fc4564857678c584897c6b48964.log
Sounds a bit like an issue upstream...
I know the issue with cabal, but no fix to it.
Stack should work though.
Except it does not.
I tried a minimal example on windows with a space in the path, it seems to work alright. So, this issue might indeed be caused by the install script.
What windows version, btw?
Windows 10 Pro x64 version 1903 (updated yesterday).
Fyi, I did not clone the repository into my user folder, I cloned it into C:\tools\haskell-ide-engine. The first time I ran the stack command it did some stuff before giving the error, now it immideatly crashes.
It was probably downloading ghc and building the install script.
I don't know where stack installs the script to, it might be into appdata and then tries to execute which now includes the username. More investigation required!
It needs a unix toolchain but I believe it is included with the Haskell platform.
re: cabal error
I am afraid that the configure step is not ghc related and you definitely need run cabal inside a msys console to build packages with it as the message suggests (network is required by many many haskell packages)
Once you have built network and it is cached, you can build the package in a ps console.
@ArthurHNL i would relocate all paths used by stack to directories out of your user dir:
X:\sr setting the %STACK_ROOT% env var to that value stack init to recreate files under the new %STACK_ROOT% dir if needed, change paths in %STACK_ROOT%\config.yaml:local-bin-path: X:\bin
local-programs-path: X:\bin\stack
Of course you can replace X:\bin with whatever, but try to keep it short to avoid long paths issues.
@ArthurHNL have you had the opportunity to try those changes in stak config? Imo that stack configuration is good in general to develop with stack in windows.
@jneira I just tried the new configuration and it appears to be working :)
Great! I think we could close this, having a good workaround and being at the end a upstream issue.
Is it an upstream issue though? Did we confirm that? Could not find a stack issue.
Mmm i've not reproduced it but given that changing stack config fixes it i think it would be so.
Anyway I'll try to reproduce and fill a stack issue if needed
Before trying to reproduce is, what is your stack version @ArthurHNL?
EDIT: closed by accident
Ok, i've reproduced it simply setting a path with spaces in local-programs-path field of %STACK_ROOT%\config.yaml:
local-programs-path: D:\bin\s t a c k
When you run a stack command instead a script it emits a warning:
D:\dev\ws\haskell\stack-test> stack build
Stack's 'programs' path contains a space character and has no alternative short ('8 dot 3') name.
This will cause problems with packages that use the GNU project's 'configure' shell script.
Use the 'local-programs-path' configuation option to specify an alternative path.
The current 'shortest' path is: D:\bin\s t a c k\
The warning is a little bit weird in the suggestions but i think that makes clear that they are aware of the issue. The improvement could be show the message when running a script (like hie install.hs) too.
Filling an issue upstream...
@jneira should I add a check into the install.hs?
mmm, it would be great at least while stack itself doesn't warn anything.
@power-fungus i've just opened a pr upstream to make stack show the warning. We will have to wait to the next release but maybe we dont need add the message to hie.
@jneira Awesome. The warning does make more sense coming from stack
Since the upstream issue is closed, what do we aim to do here? Add to readme, or just close this issue?
Not sure if we should wait to a stack release with the warning that hie could use
I had the same issue because Stack was installed under C:\Program Files\ .. . Moving Stack to C:\binstack was not enough however. Had to also uninstall and reinstall the whole Haskell Platform to C:\Haskell\8.6.5 which was previously installed under C:\Program Files\Haskell Platform\8.6.5 .
Before reinstalling the Haskell Platform the GHC 8.6.5 and stack based install failed with:
cabal: Failed to build cabal-helper-0.9.0.0 (which is required by
exe:hie-wrapper from haskell-ide-engine-0.14.0.0, lib:hie-test-utils from
haskell-ide-engine-0.14.0.0 and others). The failure occurred during the final
install step. The exception was:
dieVerbatim: user error (cabal:
'C:\binstack\x86_64-windows\ghc-8.6.5\bin\ghc-pkg.exe' exited with an
error:
cabal-helper-0.9.0.0: Warning: .:3:1: Unknown field: "visibility"
cabal-helper-0.9.0.0: Warning: library-dirs: C:\Program doesn't exist or isn't
a directory
cabal-helper-0.9.0.0: Warning: dynamic-library-dirs: C:\Program doesn't exist
or isn't a directory
cabal-helper-0.9.0.0: Warning: include-dirs: C:\Program doesn't exist or isn't
a directory
cabal-helper-0.9.0.0: Warning: include-dirs:
C:\hie\haskell-ide-engine\submodules\cabal-helper\Files\Haskell doesn't exist
or isn't a directory
cabal-helper-0.9.0.0: Warning: include-dirs:
C:\hie\haskell-ide-engine\submodules\cabal-helper\Platform\8.6.5\mingw\include
doesn't exist or isn't a directory
cabal-helper-0.9.0.0: Warning: haddock-interfaces:
C:\hie\haskell-ide-engine\dist-newstyle\build\x86_64-windows\ghc-8.6.5\cabal-helper-0.9.0.0\doc\html\cabal-helper\cabal-helper.haddock
doesn't exist or isn't a file
cabal-helper-0.9.0.0: Warning: haddock-html:
C:\hie\haskell-ide-engine\dist-newstyle\build\x86_64-windows\ghc-8.6.5\cabal-helper-0.9.0.0\doc\html\cabal-helper
doesn't exist or isn't a directory
cabal-helper-0.9.0.0: library-dirs: Files\Haskell is a relative path which
makes no sense (as there is nothing for it to be relative to). You can make
paths relative to the package database itself by using ${pkgroot}. (use
--force to override)
cabal-helper-0.9.0.0: library-dirs: Platform\8.6.5\mingw\lib is a relative
path which makes no sense (as there is nothing for it to be relative to). You
can make paths relative to the package database itself by using ${pkgroot}.
(use --force to override)
cabal-helper-0.9.0.0: dynamic-library-dirs: Files\Haskell is a relative path
which makes no sense (as there is nothing for it to be relative to). You can
make paths relative to the package database itself by using ${pkgroot}. (use
--force to override)
cabal-helper-0.9.0.0: dynamic-library-dirs: Platform\8.6.5\mingw\lib is a
relative path which makes no sense (as there is nothing for it to be relative
to). You can make paths relative to the package database itself by using
${pkgroot}. (use --force to override)
)
Most helpful comment
@ArthurHNL i would relocate all paths used by
stackto directories out of your user dir:X:\srsetting the%STACK_ROOT%env var to that valuestack initto recreate files under the new%STACK_ROOT%dir if needed, change paths in%STACK_ROOT%\config.yaml:Of course you can replace
X:\binwith whatever, but try to keep it short to avoid long paths issues.