struggling with -fdevelopment

15 views
Skip to first unread message

Matthias Fischmann

unread,
May 2, 2015, 5:55:21 AM5/2/15
to snap_fr...@googlegroups.com

Hi there,

I am here:

$ cabal install -fdevelopment
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: JuicyPixels-3.2.3/installed-c1b... (user goal)
[...]
trying: snap-loader-dynamic-0.10.0.2 (dependency of
[...]-0.0.1:+snap-development)
trying: hint-0.4.2.2 (dependency of snap-loader-dynamic-0.10.0.2)
next goal: ghc (dependency of hint-0.4.2.2)
rejecting: ghc-7.8.4/installed-f10... (conflict: JuicyPixels =>
transformers==0.4.3.0/installed-f18..., ghc =>
transformers==0.3.0.0/installed-645...)
Backjump limit reached (change with --max-backjumps).

Using ghc-7.8.4, and it works fine without -fdevelopment. I suspect
that dynamic linking somehow changes the way the built-in transformers
library can be ignored, but my understanding of this is too fuzzy to
tell whether it's easy to solve or not.

We may be upgrading to 7.10 soon, but I think the general question
remains valid: is there a way to compile in development mode even if
the application depends on another version of a core lib than the ghc
used for building it?

thanks,
matthias

Matthias Fischmann

unread,
May 2, 2015, 6:01:48 AM5/2/15
to snap_fr...@googlegroups.com

(forgot to add: i found two related threads on this list, one from
2012 and one from last december, but neither looks like this issue has
been solved "properly". thanks!)


On Sat, May 02, 2015 at 11:54:26AM +0200, Matthias Fischmann wrote:
> Date: Sat, 2 May 2015 11:54:26 +0200
> From: Matthias Fischmann <m.fis...@gmail.com>
> To: snap_fr...@googlegroups.com
> Subject: struggling with -fdevelopment

Adam Bergmark

unread,
May 2, 2015, 10:48:08 AM5/2/15
to snap_fr...@googlegroups.com
with -fdevelopment you add a dependency on ghc-as-a-library. When you depend on that you must also depend on its versions of boot packages. When you installed before (without -fdevelopment) Cabal picked a newer transformers version because it could, you had no ghc dependency at that point.
 
> We may be upgrading to 7.10 soon, but I think the general question
> remains valid: is there a way to compile in development mode even if
> the application depends on another version of a core lib than the ghc
> used for building it?

You can't. But Juicypixels doesn't depend on the newest transformers, in fact it only requires >= 0.2. Cabal just doesn't like reinstalling packages since it may break others.
 
I'd recommend deleting your sandbox and starting over with the initial install being -fdevelopment. You may also want to use Stackage, it will prevent problems such as these.

- Adam

>
> thanks,
> matthias

--

---
You received this message because you are subscribed to the Google Groups "Snap Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to snap_framewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

MightyByte

unread,
May 2, 2015, 11:25:29 AM5/2/15
to snap_fr...@googlegroups.com
I want to reinforce Adam's advice about starting with a fresh sandbox.
When using -fdevelopment you should ALWAYS start off by building from
scratch with a fresh sandbox. This isn't unique to Snap's development
mode. The whole purpose of cabal is to figure out a set of consistent
dependencies. Cabal has a number of preferences, such as preferring
newer versions of packages to older ones and preferring already
installed versions over just about anything else. Any time you add a
new dependency into the mix there's a chance that it will introduce
constraints that conflict with the ones already chose. If that
happens, you need to blow away your sandbox and try fresh to see if
GHC can find a solution with fewer restrictions.

This doesn't mean that your production deployment and your development
mode deployment have to use the same packages. You could develop on
7.10 and deploy on 7.8. Assuming all your code builds fine on both,
that's a perfectly doable scenario. But what you will not be able to
do is use your 7.10 sandbox to build the 7.8 version for deployment.

Another option is to use a cabal freeze file to unify both cases. You
would first build from a clean sandbox with -fdevelopment. Then, when
everything is built run "cabal freeze". This creates a file
cabal.config that records specific versions of every package in your
dependency tree and fixes you to using those versions. Now you should
be able to switch back and forth between -fdevelopment and
non-development without deleting your entire sandbox. You should only
need to do "cabal clean" first. The key here is that you have to do
the "cabal freeze" when you're in your most restricted state...i.e.
development mode.

Matthias Fischmann

unread,
May 3, 2015, 5:08:42 PM5/3/15
to snap_fr...@googlegroups.com

Thanks Adam and migthybyte!

I am using a freeze file already. Otherwise you're right, I should
have tried again from scratch (without freeze file and with fresh
sandbox) before coming here. I think I have an actual dependency
conflict there somewhere between two transformers versions, but from
what I understand now, it may be possible to resolve that by upgrading
to 7.10. I'll try that soonish, if you don't hear from me again this
will have worked! :)

Thanks again, cheers,
m.


On Sat, May 02, 2015 at 11:25:29AM -0400, MightyByte wrote:
> Date: Sat, 2 May 2015 11:25:29 -0400
> From: MightyByte <might...@gmail.com>
> To: "snap_fr...@googlegroups.com" <snap_fr...@googlegroups.com>
> Subject: Re: [snap] Re: struggling with -fdevelopment
Reply all
Reply to author
Forward
0 new messages