Skip to content

stack setup --upgrade-cabal breaks GHC relocatability on Windows #1159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mwu-tow opened this issue Oct 14, 2015 · 2 comments
Closed

stack setup --upgrade-cabal breaks GHC relocatability on Windows #1159

mwu-tow opened this issue Oct 14, 2015 · 2 comments

Comments

@mwu-tow
Copy link
Contributor

mwu-tow commented Oct 14, 2015

I have a custom build of GHC 7.8.4. Normally I can move it between machines on Windows, as the GHC distribution is relocable. However, in order to build my projects with stack, I need to do the --upgrade-cabal step. The stack installs then a new Cabal 1.22 library into the global package database that goes with compiler. However, the installed Cabal package is not relocable and such "patched" GHC installation can't be moved to a different location anymore.

Tha file describing package in database (GHC_DIR\lib\package.conf.d\Cabal-1.22.4.0-795f2274b99f2bda17fbad366d93efef.conf in my case) uses absolute paths, like:

library-dirs: C:\Users\mwurb_000\AppData\Local\Programs\stack\x86_64-windows\ghc-7.8.4\new-cabal\1.22.4.0\lib\x86_64-windows-ghc-7.8.4\Cabal-1.22.4.0

If I manually replace such absolute paths with the relative ones using the $topdir (like all other packages in the database), everything becomes relocable again. Could stack set relative paths for the Cabal package description it installs? The following fixes the problem for me:

library-dirs: $topdir\..\new-cabal\1.22.4.0\lib\x86_64-windows-ghc-7.8.4\Cabal-1.22.4.0
@snoyberg
Copy link
Contributor

AFAIK, Stack cannot control this, it would need to be a change to the Cabal
library. If I'm mistaken and there is a way to configure in this way, a PR
would certainly be accepted (presuming it doesn't break other OSes).

On Wed, Oct 14, 2015 at 1:09 PM, Michał Wawrzyniec Urbańczyk <
[email protected]> wrote:

I have a custom build of GHC 7.8.4. Normally I can move it between
machines on Windows, as the GHC distribution is relocable. However, in
order to build my projects with stack, I need to do the --upgrade-cabal
step. The stack installs then a new Cabal 1.22 library into the global
package database that goes with compiler. However, the installed Cabal
package is not relocable and such "patched" GHC installation can't be moved
to a different location anymore.

Tha file describing package in database
(GHC_DIR\lib\package.conf.d\Cabal-1.22.4.0-795f2274b99f2bda17fbad366d93efef.conf
in my case) uses absolute paths, like:

library-dirs: C:\Users\mwurb_000\AppData\Local\Programs\stack\x86_64-windows\ghc-7.8.4\new-cabal\1.22.4.0\lib\x86_64-windows-ghc-7.8.4\Cabal-1.22.4.0

If I manually replace such absolute paths with the relative ones using the
$topdir (like all other packages in the database), everything becomes
relocable again. Could stack set relative paths for the Cabal package
description it installs? The following fixes the problem for me:

library-dirs: $topdir..\new-cabal\1.22.4.0\lib\x86_64-windows-ghc-7.8.4\Cabal-1.22.4.0


Reply to this email directly or view it on GitHub
#1159.

@mwu-tow
Copy link
Contributor Author

mwu-tow commented Oct 14, 2015

If it is an external problem, then fixing it on the stack side is probably more trouble than it is worth. Having manually corrected the paths to the new-cabal I can simply copy the patched installation between computers, so the issue is not a big problem for me. [I guess I could even teach stack to download it automatically]

I did some more searching and perhaps this is already fixed in the Cabal: haskell/cabal#2255 — I haven't tested it but it looks that cabal-installed packages will use relative paths.

I guess I'll close the issue in such case.

@mwu-tow mwu-tow closed this as completed Oct 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants