[GHC] #14856: GHC API: Linker failure on loading target multiple times

GHC ghc-devs at haskell.org
Sun Feb 25 23:10:23 UTC 2018


#14856: GHC API: Linker failure on loading target multiple times
----------------------------------------+---------------------------
           Reporter:  fizzixnerd        |             Owner:  (none)
               Type:  bug               |            Status:  new
           Priority:  normal            |         Milestone:
          Component:  GHC API           |           Version:  8.2.2
           Keywords:  GHC API Linker    |  Operating System:  Linux
       Architecture:  Unknown/Multiple  |   Type of failure:  Other
          Test Case:                    |        Blocked By:
           Blocking:                    |   Related Tickets:
Differential Rev(s):                    |         Wiki Page:
----------------------------------------+---------------------------
 Minimum Working Example: https://github.com/Fizzixnerd/ghc-bug

 `stack exec -- ghc --version`
 >The Glorious Glasgow Haskell Compilation System, version 8.2.2

 `uname --all`
 >Linux <REDACTED> 4.14.0-3-amd64 #1 SMP Debian 4.14.13-1 (2018-01-14)
 x86_64 GNU/Linux

 Description: Loading a dynamic module more than once causes a linker
 failure with the following message:

 '''
 /usr/bin/ld.gold: error: cannot find -lghc_2
 collect2: error: ld returned 1 exit status
 `gcc' failed in phase `Linker'. (Exit code: 1)
 *** Exception: ExitFailure 1
 '''

 `-lghc_2' sometimes is `-lghc_5' or other numbers.

 Steps to Reproduce:
 1) Clone above repo.
 2) `stack build`
 3) `stack exec mwe-exe`

 The repo code will use the GHC API to load a string from the file
 contained in scripts/ named `val'.  There are three functions defined in
 src/Lib.hs.  `anotherFunc' should behave normally.  `someFunc' should
 display the bad behavior.

 Notes:
 - When using `intero`: intero must be restarted if this bug is encountered
 at the prompt, or else you will keep getting it over and over again.

 - I could not figure out how to load it up without using the `-dynamic'
 flag, but that should probably be checked out too.

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


More information about the ghc-tickets mailing list