[GHC] #8614: Duplicate symbol error when loading text twice

#8614: Duplicate symbol error when loading text twice ------------------------------------+------------------------------------- Reporter: nh2 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: GHCi crash Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- We are developing some FFI binding to some Kinect Camera library, and came across the following: {{{ GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> import Honi Prelude Honi> import Honi.Types Prelude Honi Honi.Types> initialize 2 Loading package array-0.4.0.1 ... linking ... done. Loading package deepseq-1.3.0.1 ... linking ... done. Loading package bytestring-0.10.0.2 ... linking ... done. Loading package text-0.11.3.1 ... linking ... done. Loading package honi-0.1.0.0 ... can't load .so/.DLL for: libfreenect.so (libfreenect.so: cannot open shared object file: No such file or directory) Prelude Honi Honi.Types> Right [d] <- getDeviceList Loading package array-0.4.0.1 ... linking ... done. Loading package deepseq-1.3.0.1 ... linking ... done. Loading package bytestring-0.10.0.2 ... linking ... done. Loading package text-0.11.3.1 ... GHCi runtime linker: fatal error: I found a duplicate definition for symbol __stginit_textzm0zi11zi3zi1_DataziText whilst processing object file /home/niklas/.cabal/lib/x86_64-linux- ghc-7.6.3/text-0.11.3.1/libHStext-0.11.3.1.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. }}} Apparently, ghci has no problem linking packages like array and deepseq twice, but when it comes across loading text another time, we get this duplicate symbol error. Does this make sense? Why does it not detect that text is already linked, like for the other packages? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8614 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8614: Duplicate symbol error when loading text twice -------------------------------------+------------------------------------- Reporter: nh2 | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: GHCi crash | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thomie): * status: new => infoneeded Comment: I tried `cabal install honi`, but am getting the error: {{{ * Missing C libraries: OpenNI2, freenect }}} Where do I get those, for Ubuntu 14.04. Or better: could you construct a small program that doesn't use `honi` to reproduce this issue? Thanks. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8614#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8614: Duplicate symbol error when loading text twice -------------------------------------+------------------------------------- Reporter: nh2 | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: GHCi crash | Blocked By: Test Case: | Related Tickets: #7030 Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thomie): * related: => #7030 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8614#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8614: Duplicate symbol error when loading text twice -------------------------------------+------------------------------------- Reporter: nh2 | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Runtime System | Version: 7.6.3 (Linker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #7030 | Differential Revisions: -------------------------------------+------------------------------------- Changes (by ezyang): * component: Compiler => Runtime System (Linker) Comment: So, it turns out that there is a linking failure in the pasted transcript. So it looks like the bug is that we are not properly unloading the objects we loaded prior to the failure; namely, text has something which is not unloaded. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8614#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8614: Duplicate symbol error when loading text twice -------------------------------------+------------------------------------- Reporter: nh2 | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Runtime System | Version: 7.6.3 (Linker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #7030 | Differential Revisions: -------------------------------------+------------------------------------- Comment (by ezyang): OK, so I tried to reproduce with a very minimal example, using the following steps: 1. I took honi, and edited it so it had no dependence on the actual libraries. I installed it, and then manually edited package config so that it had a dependency on a non-existent dynamic library. 2. Then I opened GHCi, and induced GHCi to attempt to load the packages twice (failing because this last package couldn't load the non-existent package.) However, text reloaded fine for me. Granted, it was `text-1.2.1.3` but I don't think there is any substantive difference here. So yes, we are going to need more information to reproduce and solve this bug. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8614#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8614: Duplicate symbol error when loading text twice -------------------------------------+------------------------------------- Reporter: nh2 | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Runtime System | Version: 7.6.3 (Linker) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #7030 | Differential Revisions: -------------------------------------+------------------------------------- Changes (by nh2): * status: infoneeded => closed * resolution: => fixed Comment: OK, so first on how to get the deps: * freenect: `apt-get install libfreenect-dev` on Ubuntu 14.04 * OpenNI2: `git clone https://github.com/occipital/OpenNI2.git`, `cd OpenNI2`, `git checkout origin/develop` Then I compile with `$HOME/.local/bin/cabal install --extra-include- dirs=$HOME/src/OpenNI2/Include/ --extra-lib- dirs=$HOME/src/OpenNI2/Bin/x64-Release/` However, I have tried this now with GHC 7.10.2, and cabal-install 1.22.6.0, and can no longer reproduce the issue. My output: {{{ ➤ ghci GHCi, version 7.10.2: http://www.haskell.org/ghc/ :? for help Prelude> import Honi Prelude Honi> import Honi.Types Prelude Honi Honi.Types> initialize 2 StatusOK }}} Trying the same with GHC 7.8: {{{ ~/.stack/programs/x86_64-linux/ghc-7.8.4/bin/ghc --interactive GHCi, version 7.8.4: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> import Honi Prelude Honi> import Honi.Types Prelude Honi Honi.Types> initialize 2 Loading package array-0.5.0.0 ... linking ... done. Loading package deepseq-1.3.0.2 ... linking ... done. Loading package bytestring-0.10.4.0 ... linking ... done. Loading package containers-0.5.5.1 ... linking ... done. Loading package binary-0.7.1.0 ... linking ... done. Loading package text-1.2.1.3 ... linking ... done. Loading package honi-0.1.0.0 ... linking ... done. StatusOK }}} So I believe this was probably fixed with the linker improvements in GHC 7.8 (I reported the bug against 7.6). Thanks for poking at this bug, I'm happy to find that it is fixed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8614#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC