[GHC] #11499: Loading temp shared object failed in GHCi

#11499: Loading temp shared object failed in GHCi --------------------------------------+------------------------------- Reporter: alfa07 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.10.3 Keywords: | Operating System: MacOS X Architecture: x86_64 (amd64) | Type of failure: GHCi crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: --------------------------------------+------------------------------- While trying to launch ghci got the following error: ❯ stack ghci The following GHC options are incompatible with GHCi and have not been passed to it: -threaded -Odph Using main module: 1. Package `line-segment-intersection' component exe:demo with main-is file: /Users/maxim/Dev/ComputationGeometry/LineSegmentIntersection/app/Main.hs Configuring GHCi with the following packages: line-segment-intersection, GLUT, GLUtil, boundingboxes, freetype-simple, freetype2 GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help ghc: panic! (the 'impossible' happened) (GHC version 7.10.3 for x86_64-apple-darwin): Loading temp shared object failed: dlopen(/var/folders/dz/lm9jncs90nq0vn_5j7xhpg2xqyfj66/T/ghc23900_0/libghc_25.dylib, 5): Symbol not found: _bdf_driver_class Referenced from: /var/folders/dz/lm9jncs90nq0vn_5j7xhpg2xqyfj66/T/ghc23900_0/libghc_25.dylib Expected in: flat namespace in /var/folders/dz/lm9jncs90nq0vn_5j7xhpg2xqyfj66/T/ghc23900_0/libghc_25.dylib Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11499 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11499: Loading temp shared object failed in GHCi -------------------------------+--------------------------------------- Reporter: alfa07 | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: GHCi | Version: 7.10.3 Resolution: | Keywords: dynamic linking Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #10458 | Differential Rev(s): Wiki Page: | -------------------------------+--------------------------------------- Changes (by trommler): * status: new => infoneeded * keywords: => dynamic linking * related: => #10458 Comment: Thanks for the report. This looks like the same issue as #10458, which is fixed in HEAD and the tip of ghc-8.0 but not RC1. Could you try with one of those and report back. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11499#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11499: Loading temp shared object failed in GHCi -------------------------------+--------------------------------------- Reporter: alfa07 | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: GHCi | Version: 7.10.3 Resolution: | Keywords: dynamic linking Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #10458 | Differential Rev(s): Wiki Page: | -------------------------------+--------------------------------------- Changes (by trommler): * cc: trommler (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11499#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11499: Loading temp shared object failed in GHCi -------------------------------+--------------------------------------- Reporter: alfa07 | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: GHCi | Version: 7.10.3 Resolution: | Keywords: dynamic linking Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #10458 | Differential Rev(s): Wiki Page: | -------------------------------+--------------------------------------- Comment (by alfa07): Thank you Peter! I will try, not sure I will be able to make stack work with ghc-8 though. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11499#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11499: Loading temp shared object failed in GHCi -------------------------------+--------------------------------------- Reporter: alfa07 | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: GHCi | Version: 7.10.3 Resolution: | Keywords: dynamic linking Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #10458 | Differential Rev(s): Wiki Page: | -------------------------------+--------------------------------------- Comment (by alfa07): Alas building with ghc-8 didn't help (I have rebuilt it from HEAD and checked that your diff is in): ❯ stack --skip-ghc-check --system-ghc --stack-yaml stack-8.yaml ghci GLUtil-0.8.8: build GLUtil-0.8.8: copy/register line-segment-intersection-0.1.0.0: configure line-segment-intersection-0.1.0.0: build line-segment-intersection-0.1.0.0: copy/register Completed 2 action(s). The following GHC options are incompatible with GHCi and have not been passed to it: -threaded -Odph Using main module: 1. Package `line-segment-intersection' component exe:demo with main-is file: /Users/maxim/Dev/ComputationGeometry/LineSegmentIntersection/app/Main.hs Configuring GHCi with the following packages: line-segment-intersection, GLUT, GLUtil, boundingboxes, freetype-simple, freetype2 GHCi, version 8.1.20160129: http://www.haskell.org/ghc/ :? for help ghc: panic! (the 'impossible' happened) (GHC version 8.1.20160129 for x86_64-apple-darwin): Loading temp shared object failed: dlopen(/var/folders/dz/lm9jncs90nq0vn_5j7xhpg2xqyfj66/T/ghc55362_0/libghc_25.dylib, 5): Symbol not found: _bdf_driver_class Referenced from: /var/folders/dz/lm9jncs90nq0vn_5j7xhpg2xqyfj66/T/ghc55362_0/libghc_25.dylib Expected in: flat namespace in /var/folders/dz/lm9jncs90nq0vn_5j7xhpg2xqyfj66/T/ghc55362_0/libghc_25.dylib Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11499#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11499: Loading temp shared object failed in GHCi -------------------------------+--------------------------------------- Reporter: alfa07 | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: GHCi | Version: 7.10.3 Resolution: | Keywords: dynamic linking Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #10458 | Differential Rev(s): Wiki Page: | -------------------------------+--------------------------------------- Comment (by alfa07): Using patch as Simon suggested fixes issue after recompiling ghc-7.10.3 with it (rts/Linker.c): {{{ - hdl = dlopen(dll_name, RTLD_LAZY|RTLD_LOCAL); /* see Note [RTLD_LOCAL] */ + hdl = dlopen(dll_name, RTLD_LAZY | RTLD_GLOBAL); }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11499#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

Alas building with ghc-8 didn't help (I have rebuilt it from HEAD and checked that your diff is in): {{{ ❯ stack --skip-ghc-check --system-ghc --stack-yaml stack-8.yaml ghci GLUtil-0.8.8: build GLUtil-0.8.8: copy/register
#11499: Loading temp shared object failed in GHCi -------------------------------+--------------------------------------- Reporter: alfa07 | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: GHCi | Version: 7.10.3 Resolution: | Keywords: dynamic linking Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #10458 | Differential Rev(s): Wiki Page: | -------------------------------+--------------------------------------- Comment (by trommler): I reformatted the compiler output below. Could you perhaps attach the contents of the directory where you invoke `stack` so I can have a look and perhaps reproduce? Replying to [comment:4 alfa07]: line-segment-intersection-0.1.0.0: configure line-segment-intersection-0.1.0.0: build line-segment-intersection-0.1.0.0: copy/register Completed 2 action(s). The following GHC options are incompatible with GHCi and have not been passed to it: -threaded -Odph Using main module: 1. Package `line-segment-intersection' component exe:demo with main-is file: /Users/maxim/Dev/ComputationGeometry/LineSegmentIntersection/app/Main.hs Configuring GHCi with the following packages: line-segment-intersection, GLUT, GLUtil, boundingboxes, freetype-simple, freetype2 GHCi, version 8.1.20160129: http://www.haskell.org/ghc/ :? for help ghc: panic! (the 'impossible' happened) (GHC version 8.1.20160129 for x86_64-apple-darwin): Loading temp shared object failed: dlopen(/var/folders/dz/lm9jncs90nq0vn_5j7xhpg2xqyfj66/T/ghc55362_0/libghc_25.dylib, 5): Symbol not found: _bdf_driver_class Referenced from: /var/folders/dz/lm9jncs90nq0vn_5j7xhpg2xqyfj66/T/ghc55362_0/libghc_25.dylib Expected in: flat namespace in /var/folders/dz/lm9jncs90nq0vn_5j7xhpg2xqyfj66/T/ghc55362_0/libghc_25.dylib Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11499#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11499: Loading temp shared object failed in GHCi -------------------------------+--------------------------------------- Reporter: alfa07 | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: GHCi | Version: 7.10.3 Resolution: | Keywords: dynamic linking Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #10458 | Differential Rev(s): Wiki Page: | -------------------------------+--------------------------------------- Comment (by alfa07): Here is the link to the tar.gzipped folder: [https://www.dropbox.com/s/q468h8zvht7w0ln/line-segment- intersection.tar.gz?dl=0] Can't attach it as the size is larger than allowed 256k. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11499#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11499: Loading temp shared object failed in GHCi -------------------------------+--------------------------------------- Reporter: alfa07 | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: GHCi | Version: 7.10.3 Resolution: | Keywords: dynamic linking Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #10458 | Differential Rev(s): Wiki Page: | -------------------------------+--------------------------------------- Comment (by trommler): Replying to [comment:5 alfa07]:
Using patch as Simon suggested fixes issue after recompiling ghc-7.10.3 with it (rts/Linker.c):
{{{ - hdl = dlopen(dll_name, RTLD_LAZY|RTLD_LOCAL); /* see Note [RTLD_LOCAL] */ + hdl = dlopen(dll_name, RTLD_LAZY | RTLD_GLOBAL); }}} This patch breaks `ghci/scripts ghci058` at least on Linux and this is to be expected given ELF symbol resolution semantics. See the note referenced in note `RTLD_LOCAL` for a more detailed explanation.
Did you run `./validate` on MacOS with the proposed patch applied? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11499#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11499: Loading temp shared object failed in GHCi -------------------------------------+------------------------------------- Reporter: alfa07 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.10.3 Resolution: | Keywords: dynamic | linking Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: 11238 | Blocking: Related Tickets: #10458 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by trommler): * status: infoneeded => new * os: MacOS X => Unknown/Multiple * architecture: x86_64 (amd64) => Unknown/Multiple * blockedby: => 11238 Comment: Replying to [comment:7 alfa07]:
Here is the link to the tar.gzipped folder: [https://www.dropbox.com/s/q468h8zvht7w0ln/line-segment- intersection.tar.gz?dl=0] Can't attach it as the size is larger than allowed 256k. Thank you!
I can reproduce the issue on Linux with a GHC that has the #10458 patch: {{{ GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help ghc: panic! (the 'impossible' happened) (GHC version 7.10.3 for x86_64-unknown-linux): Loading temp shared object failed: /tmp/ghc29316_0/libghc_25.so: undefined symbol: tt_driver_class }}} I see a different symbol missing but the missing symbol should come from `freetype2`, too. Redesign of dynamic linking should fix this. So marking as blocked on that ticket. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11499#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

I can reproduce the issue on Linux with a GHC that has the #10458 patch:
{{{ GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help ghc: panic! (the 'impossible' happened) (GHC version 7.10.3 for x86_64-unknown-linux): Loading temp shared object failed: /tmp/ghc29316_0/libghc_25.so: undefined symbol: tt_driver_class }}}
I see a different symbol missing but the missing symbol should come from `freetype2`, too.
Redesign of dynamic linking should fix this. So marking as blocked on
#11499: Loading temp shared object failed in GHCi -------------------------------------+------------------------------------- Reporter: alfa07 | Owner: trommler Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.10.3 Resolution: | Keywords: dynamic | linking Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: 11238 | Blocking: Related Tickets: #10458 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by trommler): * owner: => trommler Comment: Replying to [comment:9 trommler]: that ticket. I think I understand what is going on. The undefined symbols are provided by a package that is loaded at startup. Because we need to load (`dlopen`)with `RTLD_LOCAL` those symbols are not available in the temporary shared object. This will be fixed with the new design proposed in #11238. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11499#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11499: Loading temp shared object failed in GHCi -------------------------------------+------------------------------------- Reporter: alfa07 | Owner: trommler Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.10.3 Resolution: | Keywords: dynamic | linking Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: 11238 | Blocking: Related Tickets: #10458 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by alfa07): Yeah, I suspected that the easy solution has some catches in the wider world (RTLD_GLOBAL). Thank you for looking at it Peter! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11499#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11499: Loading temp shared object failed in GHCi -------------------------------------+------------------------------------- Reporter: alfa07 | Owner: trommler Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.10.3 Resolution: | Keywords: dynamic | linking Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: 11238 | Blocking: Related Tickets: #10458 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by basvandijk): * cc: basvandijk (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11499#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11499: Loading temp shared object failed in GHCi -------------------------------------+------------------------------------- Reporter: alfa07 | Owner: trommler Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.10.3 Resolution: | Keywords: dynamic | linking Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: 11238 | Blocking: Related Tickets: #10458 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonmar): * cc: simonmar (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11499#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11499: Loading temp shared object failed in GHCi -------------------------------------+------------------------------------- Reporter: alfa07 | Owner: trommler Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.10.3 Resolution: | Keywords: dynamic | linking Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: 11238 | Blocking: Related Tickets: #10458 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by bgamari: Old description:
While trying to launch ghci got the following error:
❯ stack ghci The following GHC options are incompatible with GHCi and have not been passed to it: -threaded -Odph Using main module: 1. Package `line-segment-intersection' component exe:demo with main-is file: /Users/maxim/Dev/ComputationGeometry/LineSegmentIntersection/app/Main.hs Configuring GHCi with the following packages: line-segment-intersection, GLUT, GLUtil, boundingboxes, freetype-simple, freetype2 GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help ghc: panic! (the 'impossible' happened) (GHC version 7.10.3 for x86_64-apple-darwin): Loading temp shared object failed: dlopen(/var/folders/dz/lm9jncs90nq0vn_5j7xhpg2xqyfj66/T/ghc23900_0/libghc_25.dylib, 5): Symbol not found: _bdf_driver_class Referenced from: /var/folders/dz/lm9jncs90nq0vn_5j7xhpg2xqyfj66/T/ghc23900_0/libghc_25.dylib Expected in: flat namespace in /var/folders/dz/lm9jncs90nq0vn_5j7xhpg2xqyfj66/T/ghc23900_0/libghc_25.dylib
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
New description: While trying to launch ghci got the following error: {{{ ❯ stack ghci The following GHC options are incompatible with GHCi and have not been passed to it: -threaded -Odph Using main module: 1. Package `line-segment-intersection' component exe:demo with main-is file: /Users/maxim/Dev/ComputationGeometry/LineSegmentIntersection/app/Main.hs Configuring GHCi with the following packages: line-segment-intersection, GLUT, GLUtil, boundingboxes, freetype-simple, freetype2 GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help ghc: panic! (the 'impossible' happened) (GHC version 7.10.3 for x86_64-apple-darwin): Loading temp shared object failed: dlopen(/var/folders/dz/lm9jncs90nq0vn_5j7xhpg2xqyfj66/T/ghc23900_0/libghc_25.dylib, 5): Symbol not found: _bdf_driver_class Referenced from: /var/folders/dz/lm9jncs90nq0vn_5j7xhpg2xqyfj66/T/ghc23900_0/libghc_25.dylib Expected in: flat namespace in /var/folders/dz/lm9jncs90nq0vn_5j7xhpg2xqyfj66/T/ghc23900_0/libghc_25.dylib Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11499#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC