[GHC] #11748: GHC runtime linker: fatal error: I found a duplicate definition for symbol

GHC ghc-devs at haskell.org
Fri Jan 27 01:21:29 UTC 2017


#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):

 In the second reproducer, `child1`'s module `Lib` calls `rgb`, which is
 supposed to be defined by `child1`'s `HsGDI.c`. But the library `child1`
 does not have `c-sources: src/HsGDI.c`, only the (irrelevant) `child1-exe`
 does. It happens that `ghc-bug-maybe-exe` links indirectly against `Win32`
 (via `inline-c`), which coincidentally would provide a symbol `rgb`, but
 because there is no dependency of `child1` on `Win32`, it happened that
 `Win32` was given before `child1` on the linker command line and so the
 linker didn't know that there would be a reference to `rgb` when it
 processed `Win32`.

 The right thing to do of course is to specify `c-sources: src/HsGDI.c` in
 the `child1` ''library'' section; then you might get a duplicate symbol
 error again, because you chose the same name as `Win32` did.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11748#comment:16>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list