Ambiguous occurence `unsafePerformIO' when installing binary-strict - haskell

I'm trying to cabal install binary-strict and I get this error:
src/Data/Binary/BitBuilder.hs:205:37:
Ambiguous occurrence `unsafePerformIO'
It could refer to either `Foreign.unsafePerformIO',
imported from `Foreign' at src/Data/Binary/BitBuilder.hs:38:1-14
or `System.IO.Unsafe.unsafePerformIO',
imported from `System.IO.Unsafe' at src/Data/Binary/BitBuilder.hs:42:26-40
(and originally defined in `GHC.IO')
Failed to install binary-strict-0.4.8.1
cabal: Error: some packages failed to install:
binary-strict-0.4.8.1 failed during the building phase. The exception was:
ExitFailure 1
I'm running ghc 7.6.3. If it's relevant, I have binary-0.7.2.3 installed too.

As written, binary-strict only works for base >= 4.7. GHC 7.6.3 uses base = 4.6.* so it will not work. You should file a bug with the maintainer and work around the issue by adding hiding (unsafePerformIO) to the import Foreign line of the file in question.

I only just found out about this. It is now fixed. Also I have listed the git repo in the package details so you can now raise issues and I will know about them. Thanks to Thomas for suggesting the fix.

Related

GHC not generating dyn_hi

I'm working on a Linux machine with GHC 7.8.2 and cabal 1.20.0.1.
I'm trying to install semigroups and whenever I do, I get the dreaded error message about missing dyn_hi files.
/home/me/.cabal/lib/x86_64-linux-ghc-7.8.2/semigroups-0.14
setup-Simple-Cabal-1.18.1.3-x86_64-linux-ghc-7.8.2: Error: Could not find
module: Data.Semigroup with any suffix: ["dyn_hi"] in the search path:
["dist/build"]
cabal: Error: some packages failed to install:
semigroups-0.14 failed during the final install step. The exception was:
I've tried following the advice given here and here. I've removed .cabal/config, .ghc, added shared : True and followed each step.But after multiple repetitions of these instructions I'm still getting the same errors.
Is there any other way to diagnose and fix these errors?

Haskell on Travis CI fails, passes locally

https://travis-ci.org/Fresheyeball/fbatch
Preprocessing library monad-parallel-0.5...
Control/Monad/Parallel.hs:67:8:
Could not find module `Control.Monad.Identity'
It is a member of the hidden package `mtl-2.2.1'.
Perhaps you need to add `mtl' to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
cabal: Error: some packages failed to install:
monad-parallel-0.5 failed during the building phase. The exception was:
ExitFailure 1
I am new to haskell, and just can't seem to get past this. I've tinkered with my .cabal file all I can, and the sub dependency fails on Travis every time.
Please help.
If a build fails while resolving a dependency, it's worth having a look a what version of that package gets installed. Normally, cabal should default to the most recent possible, which if well-maintained should install fine. Older versions do of course often mean trouble, if some dependency of theirs has now a newer, incompatible version installed.
In your case, cabal tried to install the somewhat ancient monad-parallel-0.5, which imports a module that doesn't exist in transformers (namely Control.Monad.Identity). The more recent version 0.7.1.2 does not try this and thus builds successfully. You can force such a recent install by giving a lower bound to the dependency in your .cabal file, in this case monad-parallel >= 0.7.

How to install "cryptopp" on Ubuntu 13.10 for Haskell?

When trying to install clckwrks, I get the following error after a couple cabal install tries:
~/Progs/clckwrks/clckwrks$ cabal install
Resolving dependencies...
Configuring happstack-server-tls-7.1.0...
cabal: Missing dependency on a foreign library:
* Missing C library: cryptopp
....
Why can I not find this library in the repositories? Is it the Crypto++ from cryptopp.com? Oddly enough there's no mention of this on the getting started guide at http://clckwrks.com/page/view-page-slug/3/get-started .
Yes, you need to install crypto++. If you'll get the same error after installing this lib, look at this question.
BTW, actually, the problem is in happstack-server-tls, not in clckwrks, so they haven't mentioned it.
Update
On server running you can get error about ssl/localhost.key and ssl/localhost.cer. In this case - look for the answer here.

Pandoc 'Could not find module ...' for installed module

I'm currently trying to use pandoc (as a Haskell module, not as a program) to convert MediaWiki text to other formats.
Let's assume this program:
import Text.Pandoc.Readers.MediaWiki
main = do print "foo"
When using runghc to run it, I get the following error message:
pandock.hs:1:8:
Could not find module `Text.Pandoc.Readers.MediaWiki'
Use -v to see a list of the files searched for.
My first assumption was that pandoc was either not installed or incorrectly installed. Therefore I reinstalled it with --force-reinstalls
$ cabal install pandoc --reinstall
[...]
In order, the following will be installed:
pandoc-1.12.3.1 (reinstall) changes: old-time-1.1.0.1 added
[...]
[32 of 55] Compiling Text.Pandoc.Readers.MediaWiki ( src/Text/Pandoc/Readers/MediaWiki.hs, dist/build/Text/Pandoc/Readers/MediaWiki.o )
[...]
Installing library in
/home/uli/.cabal/lib/x86_64-linux-ghc-7.6.3/pandoc-1.12.3.1
Installing executable(s) in /home/uli/.cabal/bin
Registering pandoc-1.12.3.1...
Installed pandoc-1.12.3.1
The output of runghc -v pandock.hs is quite long, I assume the relevant part is:
*** Chasing dependencies:
Chasing modules from: *pandock.hs
pandock.hs:1:8:
Could not find module `Text.Pandoc.Readers.MediaWiki'
Locations searched:
Text/Pandoc/Readers/MediaWiki.hs
Text/Pandoc/Readers/MediaWiki.lhs
Failed, modules loaded: none.
However, both ~/.cabal/lib/x86_64-linux-ghc-7.6.3/pandoc-1.12.3.1/Text/Pandoc/Readers/Mediawiki/MediaWiki.hi and ~/.cabal/bin/pandoc exist. How can I make GHC properly recognize the cabal-installed package?
Any help will be appreciated!
When trying to reproduce this issue on other computers, only 2 out of 5 computers had this issue. On both of them I installed cabal packages in about the same way and order.
In retrospect I assume this issue arose because of some broken packages wreaking havoc:
$ ghc-pkg check
There are problems in package feed-0.3.9.2:
dependency "xml-1.3.13-dd52b1688e97a3c6cd0aa48dba7b153e" doesn't exist
There are problems in package hxt-9.3.1.3:
dependency "network-2.4.2.2-ea77cdf1bc747bc58308fdeb52745c4d" doesn't exist
There are problems in package hspec-1.8.1.1:
dependency "QuickCheck-2.6-409fcc32c191cd6e04afdebb15869820" doesn't exist
There are problems in package quickcheck-io-0.1.0:
dependency "QuickCheck-2.6-409fcc32c191cd6e04afdebb15869820" doesn't exist
There are problems in package regex-compat-0.95.1:
dependency "regex-base-0.93.2-2023953b859e6f91efe89733d2ef5421" doesn't exist
There are problems in package regex-posix-0.95.2:
dependency "regex-base-0.93.2-2023953b859e6f91efe89733d2ef5421" doesn't exist
There are problems in package hxt-9.3.1.2:
dependency "network-2.4.2.2-ea77cdf1bc747bc58308fdeb52745c4d" doesn't exist
The following packages are broken, either because they have a problem
listed above, or because they depend on a broken package.
feed-0.3.9.2
hxt-9.3.1.3
hspec-1.8.1.1
quickcheck-io-0.1.0
regex-compat-0.95.1
regex-posix-0.95.2
hxt-9.3.1.2
MissingH-1.2.0.2
yesod-test-1.2.1
Note that neither pandoc nor yaml (I installed it after asking the question and had the exact same issues as with pandoc) are listed there.
For users also having a similar problem, please ensure:
The package is installed and you're not inside any sandbox where the package is not installed.
In the directory where you're executing the test script, ensure that there is no Text/Pandoc folder (or equivalent, depending on the package causing the problem
Run your test script with runghc -v to check if it searches the proper directory
ghc-pkg list lists your package as installed, and no packages are broken (use ghc-pkg check to check)
I solved my problem by renaming ~/.cabal and ~/.ghc. Note that I did this lacking a proper solution, I think you should only do this as a last resort.

Trying to install Image.Codec.DevIL under windows. Needs pthread and IL. Can't get IL to work

This is the output from cabal install codec-image-devil:
Resolving dependencies...
Configuring Codec-Image-DevIL-0.2.3...
cabal: Missing dependency on a foreign library:
* Missing C library: IL
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
cabal: Error: some packages failed to install:
Codec-Image-DevIL-0.2.3 failed during the configure step. The exception was:
ExitFailure 1
I tried --extra-include-dirs and --extra-lib-dirs. but they didn't work. so I edited the .cabal in Codec-Image-DevIL-0.2.3.tar.gz. I don't know if I'm even supposed to change that. but it worked for pthread.
I added these two lines:
include-dirs: C:\Users\Rumbold\Documents\libs\IL\include, C:\Users\Rumbold\Documents\libs\pthread\include, .
extra-lib-dirs: C:\Users\Rumbold\Documents\libs\IL\lib, C:\Users\Rumbold\Documents\libs\pthread\lib, .
They are indented so they are in the Library section. I don't know if I got the format for lists right, just something i stumbled upon while googling. The libs and `header files are all in the correct place, I think.
any clue how i can get it to work?
Edit_1:
I got it to work with --extra-include-dirs and --extra-lib-dirs, so I don't need to edit the cabal anymore. but IL still doesn't work. is there a way to find out which files it's looking for?
Wdit_2:
Alright it works. I had to rename DevIL.lib and DevIL.dll to libIL.lib and libIL.dll. (not sure if I had to do both, but that's what I did. also kept them under their old names)
Edit_3:
Getting lots of errors like:
"cabal\Codec-Image-DevIL-0.2.3\ghc-6.12.3/libHSCodec-Image-DevIL-0.2.3.a(DevIL.o):fake:(.text+0x2379):
undefined reference to `ilGetInteger#4'"

Resources