[GHC] #9438: panic: loading archives not supported

#9438: panic: loading archives not supported ----------------------------------+---------------------------------- Reporter: egl | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Keywords: | Operating System: MacOS X Architecture: x86_64 (amd64) | Type of failure: Other Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ----------------------------------+---------------------------------- Running {{{ ghci -L/opt/local/lib -latlas }}} eventually leads to {{{ Loading object (static archive) /opt/local/lib/libatlas.a ... ghc: panic! (the 'impossible' happened) (GHC version 7.8.3 for x86_64-apple-darwin): Loading archives not supported Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} This looks similar to 8164 and 4828, which are marked closed. Mac OSX 10.9.4 Xcode 5.1.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9438 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9438: panic: loading archives not supported -----------------------------------+---------------------------------- Reporter: egl | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Other | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: #8164 Differential Revisions: | -----------------------------------+---------------------------------- Changes (by thomie): * cc: carter (added) * related: => #8164 Comment: I am CC-ing carter, since he opened and closed #8164, which looks similar, and maybe knows what's going on. egl: how does one install `atlas`? Please provide instructions so this bug can be more easily reproduced. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9438#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9438: panic: loading archives not supported -----------------------------------+---------------------------------- Reporter: egl | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 (amd64) Type of failure: Other | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: #8164 Differential Revisions: | -----------------------------------+---------------------------------- Comment (by egl): atlas was installed by Macports. This should install atlas: {{{ sudo port install atlas }}} If not, then this will drag atlas in as a dependency. {{{ sudo port install octave }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9438#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9438: panic: loading archives not supported -------------------------------------+------------------------------------- Reporter: egl | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 | (amd64) Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: #8164 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * os: MacOS X => Unknown/Multiple Comment: This is not an OS X-exclusive error, as you can trigger it with any GHC build that has `DYNAMIC_GHC_PROGRAMS=YES`. For instance, on Linux: {{{ $ ghci -L/usr/lib/llvm-3.9/lib -lLLVMBPFCodeGen GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help ghc: panic! (the 'impossible' happened) (GHC version 8.0.2 for x86_64-unknown-linux): Loading archives not supported Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9438#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9438: panic: loading archives not supported -------------------------------------+------------------------------------- Reporter: egl | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 | (amd64) Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: #8164, #14708 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * related: #8164 => #8164, #14708 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9438#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9438: panic: loading archives not supported -------------------------------------+------------------------------------- Reporter: egl | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 | (amd64) Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: #8164, #14708 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Note that the use of interpreted code (either with `ghci`, as in this example, or with `ANN`, as in #14708) is needed to trigger the panic. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9438#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9438: panic: loading archives not supported -------------------------------------+------------------------------------- Reporter: egl | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 (Linking) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #8164, #14708, | Differential Rev(s): #15032 | Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * failure: Other => GHCi crash * component: Compiler => Compiler (Linking) * architecture: x86_64 (amd64) => Unknown/Multiple * related: #8164, #14708 => #8164, #14708, #15032 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9438#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9438: panic: loading archives not supported -------------------------------------+------------------------------------- Reporter: egl | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 (Linking) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #8164, #14708, | Differential Rev(s): #15032 | Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): I'm quite unclear if this is intended behavior or not. This behavior was introduced in commit 83f5c6c69ceeff6cb6ca8d56dfad79c5e126a130 (`When dynamic-by-default, don't use the GHCi linker`), which gives the rationalization:
When dynamic-by-default, don't use the GHCi linker
I'm not sure if this was supposed to apply to //user-supplied// archive files, however. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9438#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9438: panic: loading archives not supported -------------------------------------+------------------------------------- Reporter: egl | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 (Linking) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #8164, #14708, | Differential Rev(s): Phab:D4589 #15032 | Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => patch * differential: => Phab:D4589 Comment: After talking to Phyx-, this should indeed be an error. I've created Phab:D4589 to turn this panic to an error message. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9438#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9438: panic: loading archives not supported -------------------------------------+------------------------------------- Reporter: egl | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 (Linking) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #8164, #14708, | Differential Rev(s): Phab:D4589 #15032 | Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => new Comment: This is now a proper error. Phyx, should this ticket remain open or is this as fixed as this will be? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9438#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9438: panic: loading archives not supported
-------------------------------------+-------------------------------------
Reporter: egl | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.3
(Linking) |
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: GHCi crash | Test Case:
Blocked By: | Blocking:
Related Tickets: #8164, #14708, | Differential Rev(s): Phab:D4589
#15032 |
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#9438: Dynamic GHCi doesn't support static libraries -------------------------------------+------------------------------------- Reporter: egl | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 (Linking) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #8164, #14708, | Differential Rev(s): Phab:D4589 #15032 | Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * type: bug => feature request Comment: Indeed, I've converted this to a feature request per https://phabricator.haskell.org/D4589#126967. (Alas, that means the commit message in comment:10 is misleading, since that commit didn't actually fix this ticket. Oh well.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9438#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9438: Dynamic GHCi doesn't support static libraries -------------------------------------+------------------------------------- Reporter: egl | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 (Linking) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: #8164, #14708, | Differential Rev(s): Phab:D4589 #15032 | Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): @bgamari It certainly *can* be implemented, but it really depends on how `DYNAMIC_GHC_PROGRAMS` is implemented. I haven't looked at the exact implementation but I would imagine, that in order for this to work, the .so must export all symbols as globals. I suspect (without looking) that ghc is linking the shared lib using `--whole-archive`. C static shared archives wouldn't be must of an issue. If you have no reference to the C code in your own code it doesn't matter if the symbols are not there. As you can't directly call C code anyway. static Haskell libraries are a different issue, loading a static archive would require all it's symbols to also be exported. Two libraries with the exact same z-encoded symbol names would produce a duplicate symbol error, while this need not be the case normally. This is why I *think* it's currently not supported. An obvious work-around would be to create multiple .so and link them in the same order as the static archives. So I think it can be supported, but will require a bit of changes to `DYNAMIC_GHC_PROGRAMS`. You'd also have to track these archives. It would be a bit annoying to recompile them on every scope change when they didn't change. A totally naive implementation would be a bit of a performance hit. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9438#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC