Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does aeson-native installation fail?

I have two Arch(64) machines on which I am trying to install yesod. On the first, a simple 'cabal install yesod' proceeds splendidly. On the second, I get the following error while building the aesod-native dependency:

Configuring aeson-native-0.3.3...
Preprocessing library aeson-native-0.3.3...
Building aeson-native-0.3.3...
[1 of 6] Compiling Data.Aeson.Functions ( Data/Aeson/Functions.hs, dist/build/Data/Aeson/Functions.o )
[2 of 6] Compiling Data.Aeson.Types ( Data/Aeson/Types.hs, dist/build/Data/Aeson/Types.o)

Data/Aeson/Types.hs:196:22:
No instance for (NFData Object)
arising from a use of rnf'<br> Possible fix: add an instance declaration for (NFData Object)<br> In the expression: rnf o<br> In an equation forrnf': rnf (Object o) = rnf o
In the instance declaration for `NFData Value'
cabal: Error: some packages failed to install:
aeson-native-0.3.3 failed during the building phase. The exception was:
ExitFailure 1

After the failure above, I did a fresh ghc install, and removed the ghc-pkg and .cabal directories. Again, same error. There seems to be nothing wrong with aeson-native, since it works fine elsewhere, so my environment must be to blame somehow. On the machine with the failure, I've experimented in the past with using pacman to manage hackage libs on occasion (mostly for xmonad). Not sure if it should matter, but I've never been certain how/if cabal and pacman have any idea what each other are doing.

GHC is 7.0.3. I did a cabal update prior to all installs. Any ideas what could possibly be wrong with this environment?

Thanks/O

like image 927
jdo Avatar asked Feb 23 '23 22:02

jdo


2 Answers

You're not alone. This should be able to get fixed by:

> cabal install deepseq-1.1.0.2
> ghc-pkg unregister deepseq-1.2.0.1 --force

And then you can install any aeson package. Please verify that it's indeed deepseq-1.2.0.1 you have installed by typing ghc-pkg list deepseq


I had this bug too a few days ago, but for aeson not aeson-native. I pull requested a fix on github then and it's already on hackage, though unfortunately only for aeson not aeson-native. May I suggest you try pull-requesting a fix to the aeson-native package. It really feels good to give something back to the community, try it! :)

like image 70
Tarrasch Avatar answered Mar 05 '23 20:03

Tarrasch


Object is just a type synonym for a Data.Map, and it appears that the NFData instance for Data.Map was recently moved from the deepseq package to containers.

However, this new version of containers has apparently not been released on Hackage yet, so since you're using the latest version of deepseq, the instance is not found in either package.

I expect this to be rectified soon. In the meanwhile, you should be able to downgrade deepseq to version 1.1.0.2, which is the latest version before the instance was moved.

like image 31
hammar Avatar answered Mar 05 '23 21:03

hammar