Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What can cause `stack build` to keep unregistering local dependencies every time?

I've tried stack clean, and also removing .stack-work. But still, every time I run build it unregisters 5 (the same) packages. stack build --dry-run tells me the list, but not any reason why.

I've also recently upgraded from 1.4.1

Also, if it is not quite simple how to figure this out, I'd like to get back to using 1.4.1. Any simple way to downgrade haskell-stack to that version?

Edit 1

Downgrading to 1.4.0 didn't help. About 70 packages got unregistered and rebuilt, and after that I got into the same 5-unregister-loop.

So I thought, where else could have my local state be corrupted since ~yesterday? ~/.stack! So I've (re)moved my ~/.stack folder, and also .stack-work folder, thinking that if anything could have gone wrong it's in these two places, and now I am in an even worse of a rut. Now the constant unregister cycle includes 23 packages (some of them quite heavy) instead of just 5.

Would unregister locally:
cairo-0.13.3.1 (missing dependencies: gtk2hs-buildtools)
dump-0.3.0 (missing dependencies: haskell-src-meta, interpolatedstring-perl6)
entropy-0.3.7
ghcjs-dom-0.2.4.0 (missing dependencies: glib, gtk3, webkitgtk3)
gio-0.13.3.1 (missing dependencies: glib, gtk2hs-buildtools)
glib-0.13.4.1 (missing dependencies: gtk2hs-buildtools)
gtk2hs-buildtools-0.13.2.2 (missing dependencies: happy)
gtk3-0.14.6 (missing dependencies: cairo, gio, glib, gtk2hs-buildtools, pango)
haskell-src-exts-1.17.1 (missing dependencies: happy)
haskell-src-meta-0.6.0.14 (missing dependencies: haskell-src-exts)
here-1.2.9 (missing dependencies: haskell-src-meta)
hs-di-0.4.0 (missing dependencies: haskell-src-meta, interpolate, interpolatedstring-perl6)
interpolate-0.1.0 (missing dependencies: haskell-src-meta)
interpolatedstring-perl6-1.0.0 (missing dependencies: haskell-src-meta)
pango-0.13.3.1 (missing dependencies: cairo, glib, gtk2hs-buildtools)
reflex-0.5.0 (missing dependencies: haskell-src-exts, haskell-src-meta)
reflex-dom-0.4 (missing dependencies: ghcjs-dom, glib, gtk3, reflex, webkitgtk3, webkitgtk3-javascriptcore)
threepenny-gui-0.7.1.0
uuid-1.3.13
webkitgtk3-0.14.2.1 (missing dependencies: cairo, glib, gtk2hs-buildtools, gtk3, pango)
webkitgtk3-javascriptcore-0.13.2.0 (missing dependencies: glib, gtk2hs-buildtools, gtk3, webkitgtk3)
websockets-0.9.8.2
websockets-snap-0.10.0.0

@user2407038, what kind of information might help to start diagnosing this? Is the above helpful to begin with? Under what circumstances can ever such an unregister-loop arise?

I have one more idea that I could try: this particular project depends on a few local packages, and afaik their .stack-work folder may play a role in this. So maybe I could (re)move those as well.

Any more ideas should the above one fail?

like image 965
Wizek Avatar asked Aug 19 '17 10:08

Wizek


People also ask

Should I use cabal or stack?

AFAIU stack is handy to quickly work on an existing project. If you start something from scratch, you will certainly have to use cabal.

What does stack build do?

stack build takes a list of one or more optional targets to be built. The supported syntaxes for targets are: package, e.g. stack build foobar , is the most commonly used target. It will try to find the package in the following locations: local packages, extra deps, snapshots, and package index (e.g. Hackage).

Where does stack install packages?

Stack installs the Stackage libraries in ~/. stack and any project libraries or extra dependencies in a . stack-work directory within each project's directory.

What is stack Ghci?

stack ghci allows you to load components and files of your project into ghci . It uses the same TARGET syntax as stack build , and can also take options like --test , --bench , and --flag . Similarly to stack build , the default is to load up ghci with all libraries and executables in the project.


1 Answers

Long story short: changing resolver: lts-7.19 to resolver: lts-7.24 in stack.yaml seems to have fixed the error for me.


I have some guesses and hunches what may have gone wrong in the background, but I am not entirely sure.

I got a clue from the --dry-run flag that some of the missing packages it reports are build-time haskell package dependencies, like alex, happy, etc...

So maybe the older lts didn't install those correctly? If someone is more knowledgeable on the subject, I'd love to hear more.

And I'm also sad that this incident has destroyed some of my trust in stack's promise of reproducible builds, as a (AFAIK purported-to-be-safe) stack upgrade (and even with subsequent downgrade) suddenly left one of my projects un-buildable for days.

And at any rate, I'd love if

  1. stack would warn and ask me before it makes destructive changes on my system, especially if it results in hours of recompilation. (Which actually meant days of head-scratching in my case since any idea I tried I had to wait quite a bit of time in-between.)
  2. It could employ a similar build store as nix, whereas even if I change some configuration, I can switch back to the previous working configuration readily.
like image 92
Wizek Avatar answered Oct 10 '22 19:10

Wizek