haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 210 forks source link

Build error with AuthProxy on Windows #1276

Closed nihlete closed 5 years ago

nihlete commented 5 years ago

I have an authentication proxy in my university. Win7 x64 machine. In cmd I set up an enviroment variables:

SET HTTP_PROXY=username:password@proxyserver.com:port
SET HTTPS_PROXY=username:password@proxyserver.com:port

Calling E:\hie>stack ./install.hs hie-8.6.5 --verbose results with

git submodule sync --recursive
Synchronizing submodule url for 'submodules/HaRe'
Synchronizing submodule url for 'submodules/HaRe/submodules/cabal-helper'
Synchronizing submodule url for 'submodules/HaRe/submodules/ghc-mod'
Synchronizing submodule url for 'submodules/HaRe/submodules/haskell-ide-engine'
Synchronizing submodule url for 'submodules/HaRe/submodules/haskell-ide-engine/submodules/HaRe'
Synchronizing submodule url for 'submodules/HaRe/submodules/haskell-ide-engine/submodules/HaRe/submodules/cabal-helper'
Synchronizing submodule url for 'submodules/HaRe/submodules/haskell-ide-engine/submodules/HaRe/submodules/ghc-mod'
Synchronizing submodule url for 'submodules/HaRe/submodules/haskell-ide-engine/submodules/brittany'
Synchronizing submodule url for 'submodules/HaRe/submodules/haskell-ide-engine/submodules/cabal-helper'
Synchronizing submodule url for 'submodules/HaRe/submodules/haskell-ide-engine/submodules/floskell'
Synchronizing submodule url for 'submodules/HaRe/submodules/haskell-ide-engine/submodules/ghc-mod'
Synchronizing submodule url for 'submodules/brittany'
Synchronizing submodule url for 'submodules/cabal-helper'
Synchronizing submodule url for 'submodules/ghc-mod'
git submodule update --init --recursive
stack --stack-yaml=shake.yaml --numeric-version
cabal --numeric-version
cabal v1-update
dieVerbatim: user error (cabal:
'C:\Users\WS-0001\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\usr\bin\curl.exe'
exited with an error:
curl: (28) Connection timed out after 300193 milliseconds
)
Error when running Shake build system:
  at want, called at src\Development\Shake\Internal\Args.hs:81:69 in shake-0.17.9-2jhL6CMFBCPCYba2aXg0ei:Development.Shake.Internal.Args
* Depends on: hie-8.6.5
  at need, called at install.hs:127:9 in main:Main
* Depends on: cabal
* Raised the exception:
user error (Development.Shake.command_, system command failed
Command line: cabal v1-update
Exit code: 1
Stderr:
dieVerbatim: user error (cabal:
'C:\Users\WS-0001\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\usr\bin\curl.exe'
exited with an error:
curl: (28) Connection timed out after 300193 milliseconds
)
)

Seems like Shake build system relies on curl call which is not take into account env variables.

I'm not sure that this problem caused by build config, maybe this is a problem of Shake by itself.

nponeccop commented 5 years ago

You should try running curl manually and find the options which work in your case. https://curl.haxx.se/docs/manpage.html

Then we can see what can be done. Note that the manual doesn't specify login/password in proxy urls.

Also, from the message it seems that it was cabal who failed. So try running cabal v1-update as well.

nihlete commented 5 years ago

Thanks for the answer, I'll try that at Monday.

nihlete commented 5 years ago

This type of call works fine without enviroment variables. C:\Users\WS-0001\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\usr\bin\curl.exe -x proxyserver.com:port -U username:password https://github.com/haskell/haskell-ide-engine

With enviroment variables this call works fine C:\Users\WS-0001\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\usr\bin\curl.exe https://github.com/haskell/haskell-ide-engine

In curl docs I found mention of config file. I create .curlrc in C:\Users\WS-0001\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\home\user with content

-x proxyserver.com:port
-U username:password

and this type of workaround worked.

Seems like curl called in new instance of cmd, without proper env variables. Anyway, I'm Ok with my workaround, this issue may be closed.

samuelpilz commented 5 years ago

Where should this workaround be documented?

nponeccop commented 5 years ago

In README. "Installation behind a proxy" I think