Duplicate definition for symbol - haskell

I'm trying to compile a package (git-annex) under OpenBSD and I'm hitting some weird issues.
I keep getting
Loading package gnuidn-0.2.1 ...
GHCi runtime linker: fatal error: I found a duplicate definition for symbol
c_isascii
whilst processing object file
/usr/local/lib/libidn.a
This could be caused by:
* Loading two different object files which export the same symbol
* Specifying the same object file twice on the GHCi command line
* An incorrect `package.conf' entry, causing some object to be loaded twice.
GHCi cannot safely continue in this situation. Exiting now. Sorry.
This was brought up here, here and here but it didn't help me at all. I have checked to see if I have different versions of different packages (which I don't, according to ~/.cabal/lib and 'ghc-pkg list') and I have even tried recompiling libidn without the c_isascii symbol, which only resulted in the same error but about a different symbol (stringprep_utf8_to_unichar).
So right now I have no idea what to do. Any ideas?
EDIT: Added 'ghc-pkg list' to the sources I've checked for conflicting packages.

Related

Haskell compile: the interface to load is a member of the hidden package (which is itself)

I hit this when compiling taffybar module. It is very strange that actually claim that I need load this hidden module, which is itself. Error msgs are below:
[~/Public/taffybar]-[myMaster↓]── - rm -rf ~/.cache/taffybar && taffybar
Configuration '/home/jethros/.config/taffybar/taffybar.hs' changed.
Recompiling.
Error occurred while loading configuration file.
Error:
/home/jethros/.config/taffybar/taffybar.hs:26:1: error:
Failed to load interface for ‘System.Taffybar.ToggleMonitor’
It is a member of the hidden package ‘taffybar-0.4.6’.
Use -v to see a list of the files searched for.

Yesod build error because of the duplicate definition for symbol "hsprimitive_memcpy"

I followed "Yesod quick start guide" to install Yesod in Windows 10.
But, when I issued the stack build command, it failed.
Environment
Windows 10 (64bits)
stack-0.1.5 (for Windows10 64bits)
Haskell Platform 7.10.2-a (from HaskellPlatform-7.10.2-a-x86_64-setup.exe)
alex-3.1.4.log
GHC runtime linker: fatal error: I found a duplicate definition for symbol
hsprimitive_memcpy
whilst processing object file
C:\Users\xxxxx\AppData\Roaming\stack\snapshots\x86_64-windows\lts-3.8\7.10.2\lib\x86_64-windows-ghc-7.10.2\primitive-0.6.1.0-5Jnw7oEuYtM9dmKXelGXVb\HSprimitive-0.6.1.0-5Jnw7oEuYtM9dmKXelGXVb.o
This could be caused by:
* Loading two different object files which export the same symbol
* Specifying the same object file twice on the GHCi command line
* An incorrect `package.conf' entry, causing some object to be
loaded twice.
ghc: panic! (the 'impossible' happened)
(GHC version 7.10.2 for x86_64-unknown-mingw32):
loadObj "C:\\Users\\xxxxx\\AppData\\Roaming\\stack\\snapshots\\x86_64-windows\\lts-3.8\\7.10.2\\lib\\x86_64-windows-ghc-7.10.2\\primitive-0.6.1.0-5Jnw7oEuYtM9dmKXelGXVb\\HSprimitive-0.6.1.0-5Jnw7oEuYtM9dmKXelGXVb.o": failed
It seems that the cause of the error were the duplicated GHC installation.
Thanks for #Reid comment, I realized that I installed Haskel Platform from exe file before and I also installed GHC through stack by folloing the guide.
I unisatlled GHC of Haskel Platform and executed 'stack setup' command.
Then, I executed 'stack build' command and it seemed worked.
I still have problems with the 'stack build' command, but I solved this issue.

Cabal: rebuild package to use newer libraries

I'm using Ubuntu 14.10 with GHC 7.6.3 and cabal installed via the Ubuntu package installer, and trying to use the Heap data structure, which I naively installed using:
cabal install heap
As soon as I started importing the library into my code, I got the following linking error:
...
Loading package primitive-0.5.0.1 ... linking ... done.
...
Loading package heap-1.0.0 ... linking ... done.
...
Loading package primitive-0.5.2.1 ... linking ... done
...
GHCi runtime linker: fatal error: I found a duplicate definition for symbol
hsprimitive_memset_Word32
whilst processing object file
/home/simon/.cabal/lib/primitive-0.5.2.1/ghc-7.6.3/HSprimitive-0.5.2.1.o
This could be caused by:
* Loading two different object files which export the same symbol
* Specifying the same object file twice on the GHCi command line
* An incorrect `package.conf' entry, causing some object to be
loaded twice.
GHCi cannot safely continue in this situation. Exiting now. Sorry.
This answer notionally explains what to do, but the instructions are not specific enough for me to follow.
How do I get Heap to use primitive-0.5.2.1 (I'm assuming that this lightly used library is the one that is out of date), or should I be doing something completely different?
One solution might be to specifically install an earlier version of heap:
cabal install heap-0.6.0
You might have to first unregister heap-1.0.0.
Another option is to blow away your ~/.ghc directory. Of course, you will have to reinstall cabal packages.
I think the best option is to start using cabal sandboxing for your projects.
Edit: heap-1.0.0 contains QuickCheck tests and thus brings in all of the QuickCheck dependencies. To install that version without QuickCheck, try this:
In a new directory, run cabal get heap-1.0.0
cd heap-1.0.0
Edit heap.cabal and remove the Build-Depends: line
Run cabal install

Haskell Plugins and cabal sandbox

So, I'm trying to use the Plugins package to dynamically load a haskell function from a source file. The source file depends on a package foo with module Foo.Bar. I'm running my project in a Cabal sandbox, where I have foo installed. Both my main program, and the module I'm loading with plugins, depend on foo. I always get one of the following two errors:
When I have foo installed in ~/.cabal, I get the error:
GHCi runtime linker: fatal error: I found a duplicate definition for symbol
aizmvszmaizmlibzm0zi1_FooziBar_zdfTypeableBazzuds2_closure
whilst processing object file
/home/joey/.cabal/lib/foo-0.1/ghc-7.6.3/HSfoo-0.1.o
This could be caused by:
* Loading two different object files which export the same symbol
* Specifying the same object file twice on the GHCi command line
* An incorrect `package.conf' entry, causing some object to be
loaded twice.
GHCi cannot safely continue in this situation. Exiting now. Sorry.
When I don't have it installed in ~/.cabal, I get a standard "module not found" error. And when I don't have it installed in my sandbox, I get the same module not found error trying to compile my main program code.
The plugins documentation is scarce at best. Any thoughts on how to solve this?
I got this working by using System.Plugins.Make to actually do the compliation, instead of relying on pre-existing object files. Not a complete solution, doesn't explain the problem, but it works for me for now.

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