Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

If there's a "cabal.sandbox.config", cabal-helper attempts to use cabal-sandbox, whereas ghc-mod is using stack #725

Closed
mgsloan opened this issue Jan 13, 2016 · 5 comments

Comments

@mgsloan
Copy link

mgsloan commented Jan 13, 2016

mgsloan@computer:~/fpco/stack$ ghc-mod debug -v
ghc-pkg: /home/mgsloan/fpco/stack/.cabal-sandbox/x86_64-linux-ghc-7.10.3-packages.conf.d: getDirectoryContents: does not exist (No such file or directory)
cabal-helper-wrapper: readCreateProcess: /home/mgsloan/.stack/programs/x86_64-linux/ghc-7.10.3/bin/ghc-pkg "list" "--simple-output" "Cabal" "--package-conf=/home/mgsloan/fpco/stack/.cabal-sandbox/x86_64-linux-ghc-7.10.3-packages.conf.d" (exit 1): failed
ghc-mod: readCreateProcess: /home/mgsloan/oss/kazu-yamamoto/.stack-work/install/x86_64-linux/lts-4.1/7.10.3/libexec/cabal-helper-wrapper "--with-ghc=/home/mgsloan/.stack/programs/x86_64-linux/ghc-7.10.3/bin/ghc" "--with-ghc-pkg=/home/mgsloan/.stack/programs/x86_64-linux/ghc-7.10.3/bin/ghc-pkg" "--with-cabal=cabal" "/home/mgsloan/fpco/stack" "/home/mgsloan/fpco/stack/.stack-work/dist/x86_64-linux/Cabal-1.22.5.0" "package-db-stack" "entrypoints" "source-dirs" "ghc-options" "ghc-src-options" "ghc-pkg-options" "ghc-merged-pkg-options" "ghc-lang-options" "licenses" "flags" "config-flags" "non-default-config-flags" "compiler-version" (exit 1): failed
mgsloan@computer:~/fpco/stack$ rm cabal.sandbox.config 
mgsloan@computer:~/fpco/stack$ ghc-mod debug -v
[1 of 5] Compiling CabalHelper.Types ( CabalHelper/Types.hs, /home/mgsloan/.ghc-mod/cabal-helper/CabalHelper/Types.o )
[2 of 5] Compiling CabalHelper.Common ( CabalHelper/Common.hs, /home/mgsloan/.ghc-mod/cabal-helper/CabalHelper/Common.o )
[3 of 5] Compiling CabalHelper.Sandbox ( CabalHelper/Sandbox.hs, /home/mgsloan/.ghc-mod/cabal-helper/CabalHelper/Sandbox.o )
[4 of 5] Compiling CabalHelper.Licenses ( CabalHelper/Licenses.hs, /home/mgsloan/.ghc-mod/cabal-helper/CabalHelper/Licenses.o )
[5 of 5] Compiling Main             ( CabalHelper/Main.hs, /home/mgsloan/.ghc-mod/cabal-helper/Main.o )
^Cghc-mod: user interrupt
@mgsloan
Copy link
Author

mgsloan commented Jan 13, 2016

Note that the arguments to cabal-helper-wrapper use info from stack.

@DanielG
Copy link
Owner

DanielG commented Jan 13, 2016

Untested for now but try this out: https://github.com/DanielG/cabal-helper/tree/fix-ghc-mod-725

@mgsloan
Copy link
Author

mgsloan commented Jan 13, 2016

Yup, that fixes it. Thanks!

@mgsloan
Copy link
Author

mgsloan commented Jan 13, 2016

However, the fact that it's doing anything with cabal sandboxes seems not so great. Simply logging errors here seems really error-prone.

Maybe ghc-mod should tell cabal-helper-wrapper about which cradle type its using?

@DanielG
Copy link
Owner

DanielG commented Jan 13, 2016

At this stage it doesn't really matter where this library comes from we just need any Cabal library of the right version. The only way we could run into trouble (that I can think of) this way is if a user installed a custom version of Cabal with the same version but breaking changes and they don't realize they still have the cabal sandbox lying around since they moved to stack. That scenario sounds kind of unlikely to me.

Actually looking at the code I think I already laid out a code path for stack and just never got around to using it :) https://github.com/DanielG/cabal-helper/blob/master/CabalHelper/Compile.hs#L73 If you pass down --with-cabal-pkg-db=.. it will bypass all that logic and just use the Cabal library in there which is exactly what you want for stack. I think the only thing missing is the glue logic in Distribution.Helper and L.H.GM.CabalHelper in ghc-mod so if you want to implement that feel free.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants