3

For a while I was mystified about the fact that doing installs/builds in a cabal sandbox often failed on my Windows machine. I eventually figured out that the failures were caused by certain paths exceeding the MAX_PATH limit (paths are effectively limited to 255 characters).

As a specific example, if I try to cabal install data-default-instances-old-locale-0.0.1 within a cabal sandbox folder, it fails. At some point in the process, Cabal invokes ar.exe with a path that looks like dist/dist-sandbox-72eb259b\build\libHSdata-default-instances-old-locale-0.0.1-6jcjjaR25tK4x3nJhHHjFM.a-45644\libHSdata-default-instances-old-locale-0.0.1-6jcjjaR25tK4x3nJhHHjFM.a. This is relative to a working folder under the temp directory (which I have set to simply C:\Temp), so the full path works out to be C:\Temp\data-default-instances-old-locale-0.0.1-18744\data-default-instances-old-locale-0.0.1\dist\dist-sandbox-72eb259b\build\libHSdata-default-instances-old-locale-0.0.1-6jcjjaR25tK4x3nJhHHjFM.a-18744\libHSdata-default-instances-old-locale-0.0.1-6jcjjaR25tK4x3nJhHHjFM.a.

That final path is 272 characters long, well over the 255 limit.

It is possible to deal with longer paths on Windows, but it isn't trivial and in any case, ar doesn't seem to do whatever is necessary to handle them (not surprising since it's just a port of the GNU tool chain).

I have a feeling this is the situation for the foreseeable future, but maybe someone can think of a work around?

Daniel Pratt
  • 12,007
  • 2
  • 44
  • 61

1 Answers1

3

This was fixed in the most recent release of cabal-install. Upgrading should solve the problem.

Michael Snoyman
  • 31,100
  • 3
  • 48
  • 77
  • It appears you are correct. I did `cabal install cabal-install` and thereafter I was able to execute the previously failing command. Is this fix documented somewhere? I'm curious to know how it was fixed. – Daniel Pratt Jun 30 '15 at 12:59
  • 1
    You can see the gory details here: https://github.com/haskell/cabal/issues/2502. Note that the initial fix actually caused a much worse bug where cabal couldn't install anything, see: https://github.com/haskell/cabal/issues/2658 – Michael Snoyman Jun 30 '15 at 13:50