Cabal: Latest Cabal fails to update or install

Created on 4 Jan 2018  Â·  15Comments  Â·  Source: haskell/cabal

I just updated my Haskell Platform to 8.2.2 on my Windows 7 laptop. But now I can't make use of cabal.

D:\>cabal install time
dieVerbatim: user error (cabal: 'C:\cygwin64\bin\curl.exe' exited with an error:
)

D:\>cabal update
dieVerbatim: user error (cabal: 'C:\cygwin64\bin\curl.exe' exited with an error:
)

D:\>cabal --version
cabal-install version 2.0.0.1
compiled using version 2.0.1.1 of the Cabal library

This was working in a previous version of the Haskell Platform (I think it was 8.0.1)

Is there anything I can do to correct this?

windows enhancement

All 15 comments

I just found a 'workaround' though I am not sure if it is the correct solution or not.

I added msysusrbin to the path ahead of my cygwin installation and now cabal seems to work. I had added this to the extra-prog-path config variable, but it doesn't seem to have done anything.

If cabal needs specific applications (and provides them) then I would have thought it would have been able to find those applications on its own without mucking in the user's environment.

Cabal neither needs or provides curl. It just tries to use the installed one if it finds it lying around. For some reason calling the cygwin one seems to fail from it?

You can find other choices for HttpTransport that can be configured by looking for the documentation with cabal help.

One thing we could perhaps do is give a better error when shelling out to curl or wget fails...

Seems like trying to use anything provided by Cygwin results in fail. Cygwin's sh is another major offender. Would be nice to have some kind of detection of these cases.

This is why we have the three lines we have in the install instructions for the platform to add certain paths to cabal's lookup directory. (now that I think about that, that would fix this too).

extra-prog-path: C:\Program Files\Haskell Platform\8.2.2\msys\usr\bin
extra-lib-dirs: C:\Program Files\Haskell Platform\8.2.2\mingw\lib
extra-include-dirs: C:\Program Files\Haskell Platform\8.2.2\mingw\include

It would be really nice (since this comes up a lot, in that people miss adding these) if there could be some more-automatic way of handling adding those lines or the equivalent to the config file, or otherwise providing the equivalent functionality.

With them in place, people can have cygwin or whatever on their path and it doesn't matter to cabal.

Yep, we should do that, no-one reads the release notes.

Can't we also make Cabal try harder if the curl fails for some reason?

relevant: https://github.com/haskell/haskell-platform/issues/279

i.e. we patch cabal to add

cabal user-config init --with-msys-location=...

now we just need to do it :-)

was @Mistuke interested in doing this?

@23Skidoo, I did add those three lines and they didn't help. I had to add the extra-prog-path value to my path just to get cabal to work. And, while curl isn't provided by cabal it is provided by the Haskell Platform. That is the one I am using and it works. I just wish that cabal made use of the extra-prog-path value.

I'm confused -- if we have the extra prog path set, shouldn't that take precedence for cabal's lookup over the user path?

@gbaz no I believe @hvr was going to do it?

In any case, the issue here is a different one. What I believe is happening is that @melston has worked himself into an ABI issue by mixing msys2 and Cygwin. the curl provided by the Haskell Platform is likely the msys2 version. And so depends on the msys2 runtime, but also on a libcurl compiled for msys2. However when cabal invokes curl the Windows loader is likely loading one of the dependencies from a Cygwin directory (before it considers the msys2 one). (which is why changing PATH works). You can easily verify this with strace or cygcheck.

The root of this problem is simply, you should never mix Cygwin and msys2. Changing the PATH is always going to break one of the two.

In fact the msys2 project warns against this https://github.com/msys2/msys2/wiki/MSYS2-introduction

Beware that mixing in programs from other MSYS2 installations, Cygwin installations, compiler toolchains or even various other programs is not supported and will probably break things in unexpected ways. Do not have these things in PATH when running MSYS2 unless you know what you're doing.

So really, this isn't a configuration we support, nor can support given the fact that both msys2 and Cygwin are newlib based but diverge in runtimes and are just ABI incompatible. And what you really don't want is your process having multiple copies of newlib loaded and mapped at a time.

If you really want to use Cygwin you need to grab the GHC binaries and cabal binaries from the website and configure your environment by hand.

Right. The interesting part of the above trace is the part in the log that says 'C:\cygwin64\bin\curl.exe' exited with an error -- so that indicates the cygwin provided curl was being called. If the three lines were added, I would have thought that would have meant that the one from the msys\bin dir would have taken precedence.

The problem is here, and I can work on a patch for it: https://github.com/haskell/cabal/blob/8356832e2907bee0c387ec33feae4268816a5326/cabal-install/Distribution/Client/HttpUtils.hs#L295

We need to configure the progDb we use there to take into account the extra search path. Its sort of irritating that we don't have that by construction throughout cabal :-/

the fix should be similar to (but simpler than) that done here: https://github.com/haskell/cabal/pull/2840/files

If curl is a cygwin curl I don't see why it fails or why adding msys2 to
the path works. Anyway if this is something you want to support then feel
free.

On Thu, Jan 4, 2018, 04:55 gbaz notifications@github.com wrote:

Right. The interesting part of the above trace is the part in the log that
says 'C:cygwin64bincurl.exe' exited with an error -- so that indicates
the cygwin provided curl was being called. If the three lines were added,
I would have thought that would have meant that the one from the msysbin
dir would have taken precedence.

The problem is here, and I can work on a patch for it:
https://github.com/haskell/cabal/blob/8356832e2907bee0c387ec33feae4268816a5326/cabal-install/Distribution/Client/HttpUtils.hs#L295

We need to configure the progDb we use there to take into account the
extra search path. Its sort of irritating that we don't have that by
construction throughout cabal :-/

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/haskell/cabal/issues/4995#issuecomment-355198945, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABH3KawKhRt-XRbov5Sq88eOLUsw5loHks5tHFm6gaJpZM4RSXzC
.

@gbaz, IIUC I think you are right. With 'extra-prog-path' set to the Haskell msys directory that should take precedence over the PATH environment variable (or, at least, get prepended to it) avoiding the need to 'fix' the PATH variable. It should have found the msys curl.exe and used that.

Ok, with that PR done, the remaining work falls under https://github.com/haskell/cabal/issues/4901 and I'm going to close this in favor of that...

Was this page helpful?
0 / 5 - 0 ratings