0
votes

I'm trying to install robot via cabal install.

Whenever I try to instal robot via cabal or after cloning the git repo , I get the following error message.

Resolving dependencies...
cabal: Entering directory '/tmp/cabal-tmp-6435/xhb-0.6.2015.8.1'
Configuring xhb-0.6.2015.8.1...
Building xhb-0.6.2015.8.1...
Preprocessing library xhb-0.6.2015.8.1...
[ 1 of 61] Compiling Graphics.XHB.Shared ( Graphics/XHB/Shared.hs, dist/build/Graphics/XHB/Shared.o )

Graphics/XHB/Shared.hs:271:17: error:
    Ambiguous occurrence ‘putInt8’
    It could refer to either ‘Data.Binary.Put.putInt8’,
                             imported from ‘Data.Binary.Put’ at Graphics/XHB/Shared.hs:9:1-22
                          or ‘Graphics.XHB.Shared.putInt8’,
                             defined at Graphics/XHB/Shared.hs:309:1

Graphics/XHB/Shared.hs:275:19: error:
    Ambiguous occurrence ‘getInt8’
    It could refer to either ‘Data.Binary.Get.getInt8’,
                             imported from ‘Data.Binary.Get’ at Graphics/XHB/Shared.hs:10:1-22
                          or ‘Graphics.XHB.Shared.getInt8’,
                             defined at Graphics/XHB/Shared.hs:312:1

Graphics/XHB/Shared.hs:279:17: error:
    Ambiguous occurrence ‘putInt16host’
    It could refer to either ‘Data.Binary.Put.putInt16host’,
                             imported from ‘Data.Binary.Put’ at Graphics/XHB/Shared.hs:9:1-22
                          or ‘Graphics.XHB.Shared.putInt16host’,
                             defined at Graphics/XHB/Shared.hs:315:1

Graphics/XHB/Shared.hs:283:19: error:
    Ambiguous occurrence ‘getInt16host’
    It could refer to either ‘Data.Binary.Get.getInt16host’,
                             imported from ‘Data.Binary.Get’ at Graphics/XHB/Shared.hs:10:1-22
                          or ‘Graphics.XHB.Shared.getInt16host’,
                             defined at Graphics/XHB/Shared.hs:318:1

Graphics/XHB/Shared.hs:287:17: error:
    Ambiguous occurrence ‘putInt32host’
    It could refer to either ‘Data.Binary.Put.putInt32host’,
                             imported from ‘Data.Binary.Put’ at Graphics/XHB/Shared.hs:9:1-22
                          or ‘Graphics.XHB.Shared.putInt32host’,
                             defined at Graphics/XHB/Shared.hs:321:1

Graphics/XHB/Shared.hs:291:19: error:
    Ambiguous occurrence ‘getInt32host’
    It could refer to either ‘Data.Binary.Get.getInt32host’,
                             imported from ‘Data.Binary.Get’ at Graphics/XHB/Shared.hs:10:1-22
                          or ‘Graphics.XHB.Shared.getInt32host’,
                             defined at Graphics/XHB/Shared.hs:324:1
cabal: Leaving directory '/tmp/cabal-tmp-6435/xhb-0.6.2015.8.1'
Failed to install xhb-0.6.2015.8.1
cabal: Error: some packages failed to install:
xhb-0.6.2015.8.1 failed during the building phase. The exception was:
ExitFailure 1


Can someone please guide me on how to proceed.

1
Evidently some compatibility problem. xhb seems a bit under-maintened, in fact I see no indication it was ever tested with GHC-8. What version of base and binary have you installed?leftaroundabout
I have installed base-4.9.1.0 and binary-0.8.5.1Harsh Agarwal

1 Answers

1
votes

Ok, so the problem is that binary-0.8 exports a whole lot of primitives that binary-0.7 didn't. Compare http://hackage.haskell.org/package/binary-0.7.5.0/docs/Data-Binary-Put.html#g:3 vs http://hackage.haskell.org/package/binary-0.8.5.1/docs/Data-Binary-Put.html#g:3.

+ putInt8 :: Int8 -> Put
+ putWord64be :: Word64 -> Put
+ putInt16be :: Int16 -> Put
...

In xhb these functions are imported separately, which leads to a name clash when using binary-0.8.

The safest way to solve this: fork xhb, make the import Data.Binary.{Put|Get} imports qualified, and then explicitly clarify from which module you want each use of putInt8 etc..

You may then file a pull request when you're done.

Alternatively, you may be able to get the install done by just adding the constraint binary < 0.8, but that would be merely a workaround.

cabal install xhb --constraint="binary<0.8"

After xhb is installed, the install of robot should then work without trouble.