Opened 19 months ago

Last modified 19 months ago

#14856 new bug

GHC API: Linker failure on loading target multiple times

Reported by: fizzixnerd Owned by:
Priority: normal Milestone: 8.4.1
Component: GHC API Version: 8.4.1-alpha3
Keywords: GHC API Linker Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Other Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by fizzixnerd)

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.

Change History (2)

comment:1 Changed 19 months ago by fizzixnerd

Description: modified (diff)

fixed formatting.

comment:2 Changed 19 months ago by fizzixnerd

Architecture: Unknown/Multiplex86_64 (amd64)
Milestone: 8.4.1
Version: 8.2.28.4.1-alpha3

Checked this against ghc 8.4.0.20180224, and found it still exists. Updating ticket.

Note: See TracTickets for help on using tickets.