
#11748: GHC runtime linker: fatal error: I found a duplicate definition for symbol -------------------------------------+------------------------------------- Reporter: jeiea | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 7.10.3 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: #11223 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): The original issue turns out to be simply due to the fact that `inline-c` depends on `Win32` (via `directory`), and your program's cabal file states a dependency on your local version `Win32a`. `Win32` defines functions like `rgb` as wrappers around Windows API macros and your clone `Win32a` also defines functions with the same names. So you do have duplicate definitions for symbols. The issue doesn't have anything to do with `inline-c` besides the fact that it is causing the real `Win32` to be linked in. The issue is that, unlike symbols that come from Haskell functions, we don't mangle the symbols defined in C source files with the package identifier. I think there is a ticket about changing this, but for now it's a known limitation that you have to ensure that symbol names in C files you link in globally unique. Using the symbol name `rgb` in `Win32` is really not very good, as it is fairly likely to collide with someone else's symbol, and we should change that. In the `unix` package, we use symbol names like `__hsunix_ptsname`. However using a more GHC-specific symbol name would not help here, since you copied the `Win32` source into your own package. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11748#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler