[GHC] #10458: GHCi fails to load shared object (the 'impossible' happened)

#10458: GHCi fails to load shared object (the 'impossible' happened) -----------------------------------------+--------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.10.1 Keywords: | Operating System: Linux Architecture: x86_64 (amd64) | Type of failure: None/Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -----------------------------------------+--------------------------------- I have a project that uses two external libraries, namely `-lcrypt` and `-lpcre`. Building with `cabal` and running the resulting executable works as expected, but I'm having trouble starting a REPL in GHCi: {{{ % cabal repl Preprocessing executable 'etamoo' for EtaMOO-0.2.1.0... GHCi, version 7.10.1: http://www.haskell.org/ghc/ :? for help /usr/bin/ld: dist/build/etamoo/etamoo-tmp/src/cbits/crypt.o: relocation R_X86_64_PC32 against undefined symbol `crypt' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status }}} The error suggests I need `-fPIC`, and this seems to help the `-lcrypt` case, but now I get: {{{ % cabal repl --ghc-options="-fPIC" Preprocessing executable 'etamoo' for EtaMOO-0.2.1.0... GHCi, version 7.10.1: http://www.haskell.org/ghc/ :? for help ghc: panic! (the 'impossible' happened) (GHC version 7.10.1 for x86_64-unknown-linux): Loading temp shared object failed: /tmp/ghc21539_0/libghc21539_2.so: undefined symbol: pcre_callout Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} FYI the C type of `pcre_callout` is a little unusual: {{{ extern int (*pcre_callout)(pcre_callout_block *); }}} In other words it is a global variable (pointer to function), not a function itself. Any advice is welcome, including the proper way to start GHCi given these external dependencies, as well as on this apparent bug. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+----------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ---------------------------------+----------------------------------------- Comment (by rwbarton): I think this is the same as #10442, and that there's currently no way to get `.o` files being loaded into ghci (like your `cbits/crypt.o`) to see symbols from dynamic C libraries (except the ones like libgmp that ghci is already linked against). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+----------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ---------------------------------+----------------------------------------- Changes (by rwbarton): * milestone: => 7.10.2 Comment: Actually I was wrong about the exact issue being discussed in #10442, but the rest of my comment still applies. Do you have `-fobject-code` set in your cabal file somewhere? Of course what you are trying to do should work even so, but as a workaround you can use the bytecode interpreter. You do need to build your cbits with `-fPIC` here. I thought that Cabal was smart enough to do that automatically, but I guess not? Anyways, a Cabal issue and not a GHC one. Tentatively re-milestoning for 7.10.2. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+----------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ---------------------------------+----------------------------------------- Comment (by rleslie): I do not have `-fobject-code` set in my cabal file. Adding `cc-options: -fPIC` to the cabal file does avoid the first problem I encountered, but the second one remains (with GHCi imploring me to report this as a GHC bug). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+----------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ---------------------------------+----------------------------------------- Comment (by rwbarton): OK, actually this particular error has nothing to do with loading Haskell modules as object code: cabal is presumably including some cbits `.o` file as an argument to ghci (as it should) and ghci is trying to load it eagerly at startup, and this fails at load time because the pcre library is not visible to the temporary shared library (due to the `RTLD_LOCAL` change). But, the same issue could arise in other settings, for example if a Haskell module that does a foreign import from a shared library is loaded with `-fobject-code`. (Regarding `-fPIC`, I just meant to say that it is expected that you have to use `-fPIC` as you described from the start, at least as far as GHC is concerned.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+----------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ---------------------------------+----------------------------------------- Comment (by rwbarton): I'm a little worried about whether the obvious fix for this (adding `-lfoo` to the gcc command line for building the temporary shared objects for each library `-lfoo` specified on the ghci command line) might cause #8935 to occur again in some configurations. If we add every library that we've loaded there then what was the point of loading the libraries with RTLD_LOCAL? Possibly we only need to use RTLD_LOCAL when building the ghci linker statically? Then we could revert the other changes like #10322 and #10110 and #10058. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+----------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ---------------------------------+----------------------------------------- Comment (by rwbarton): We should probably just go ahead with that fix anyways since this breakage is rather severe. Let's keep this ticket open after doing so though, to see whether it causes any issues like #8935 and perhaps take a moment to see if we can find a simpler way to handle this whole situation. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+----------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ---------------------------------+----------------------------------------- Changes (by trommler): * cc: trommler (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

I'm a little worried about whether the obvious fix for this (adding `-lfoo` to the gcc command line for building the temporary shared objects for each library `-lfoo` specified on the ghci command line) might cause #8935 to occur again in some configurations. If we add every library that we've loaded there then what was the point of loading the libraries with RTLD_LOCAL? We need RTLD_LOCAL when we want to override symbols in a shared library
#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+----------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ---------------------------------+----------------------------------------- Comment (by trommler): Replying to [comment:5 rwbarton]: previously loaded with symbols from a shared library loaded later. Given that we do not want to override symbols from C libraries, we can add them to the link command. My understanding of what we want to be able to override is very hazy. Do we have a wiki page that describes the semantics of loading packages and libraries into ghci?
Possibly we only need to use RTLD_LOCAL when building the ghci linker statically? Then we could revert the other changes like #10322 and #10110 and #10058. What does it mean "building the ghci linker statically"?
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+----------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: high | Milestone: 7.10.2 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ---------------------------------+----------------------------------------- Changes (by rwbarton): * priority: normal => high -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+----------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: high | Milestone: 7.10.2 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ---------------------------------+----------------------------------------- Comment (by bgamari): Has there been any progress on this? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+----------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: high | Milestone: 7.10.2 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ---------------------------------+----------------------------------------- Changes (by bgamari): * cc: bgamari (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

We should probably just go ahead with that fix anyways since this breakage is rather severe. Let's keep this ticket open after doing so
#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+----------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: high | Milestone: 7.10.2 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ---------------------------------+----------------------------------------- Comment (by trommler): Replying to [comment:6 rwbarton]: though, to see whether it causes any issues like #8935 and perhaps take a moment to see if we can find a simpler way to handle this whole situation. The issue in #8935 was that we did not search the global context (the executable) first when resolving a symbol. The issue were certain relocations used for global variables (the process environment in the case of #8935). To solve the issue here we have two options: 1. Load C libraries with RTLD_GLOBAL, the symbols cannot be overridden by Haskell code. Is there a reasonable use case where we would override the definition of a symbol in a C library during one run of GHCi? 1. Append all `-lfoo` to every link command of a temporary shared library. If a symbol is defined in a library mentioned earlier in the link command it will override the symbol in `libfoo`. The second option is probably easier to implement whereas the performance of the first option will most likely be better (fewer libraries to open and fewer symbols to look at). I would say we go for option two for now and create a new ticket for a complete redesign of dynamic linking for 7.12. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

Replying to [comment:5 rwbarton]: My understanding of what we want to be able to override is very hazy. Do we have a wiki page that describes the semantics of loading packages and
#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+----------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: high | Milestone: 7.10.2 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ---------------------------------+----------------------------------------- Comment (by rwbarton): Replying to [comment:8 trommler]: libraries into ghci?
Possibly we only need to use RTLD_LOCAL when building the ghci linker statically? Then we could revert the other changes like #10322 and #10110 and #10058. What does it mean "building the ghci linker statically"?
I mean when compiling the RTS (specifically Linker.c) for eventual inclusion into a static library rather than a dynamic library. I thought that we already used some mechanism to check for this somewhere in the RTS, but now I can't find it so maybe I imagined it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+----------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: high | Milestone: 7.12.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ---------------------------------+----------------------------------------- Changes (by bgamari): * milestone: 7.10.2 => 7.12.1 Comment: As we are going to punt on this in 7.10.2 I'm going to re-milestone this for 7.12.1. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+----------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: high | Milestone: 7.10.3 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: ---------------------------------+----------------------------------------- Changes (by rwbarton): * milestone: 7.12.1 => 7.10.3 Comment: I guess it's too late for 7.10.2 but we should really fix this for 7.10.3. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+-------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: high | Milestone: 7.10.3 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): ---------------------------------+-------------------------------------- Comment (by mboes): This issue is preventing `stack repl` or `cabal repl` from working in the inline-r package of the HaskellR project. It is therefore not currently possible to hack on inline-r code in GHCi. Any chance a fix for this will make it into 7.10.3? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

I'm a little worried about whether the obvious fix for this (adding `-lfoo` to the gcc command line for building the temporary shared objects for each library `-lfoo` specified on the ghci command line) might cause #8935 to occur again in some configurations. The right way to build a shared library would be to add `-lfoo`. Haskell
#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+-------------------------------------- Reporter: rleslie | Owner: trommler Type: bug | Status: new Priority: high | Milestone: 7.10.3 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): ---------------------------------+-------------------------------------- Changes (by trommler): * owner: => trommler Comment: Replying to [comment:5 rwbarton]: libraries are linked with `-Bsymbolic` and I wonder if that would indeed make #8935 come back. Perhaps it is better to go for option one in my comment:12 and load C Libraries with `RTLD_GLOBAL` after all. I'll take a look. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:17 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+-------------------------------------- Reporter: rleslie | Owner: trommler Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Changes (by bgamari): * milestone: 7.10.3 => 8.0.1 Comment: Remilestoning as there there is no fix ready for 7.10.3. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

Perhaps it is better to go for option one in my comment:12 and load C
#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+-------------------------------------- Reporter: rleslie | Owner: trommler Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by mboes): Replying to [comment:17 trommler]: libraries with `RTLD_GLOBAL` after all.
I'll take a look.
Any luck? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:19 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+-------------------------------------- Reporter: rleslie | Owner: trommler Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by trommler): Replying to [comment:17 trommler]:
Haskell libraries are linked with `-Bsymbolic` and I wonder if that would indeed make #8935 come back. No, forget that. `-Bsymbolic` has nothing to do with #8935.
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:20 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+-------------------------------------- Reporter: rleslie | Owner: trommler Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by trommler): Replying to [comment:19 mboes]:
Replying to [comment:17 trommler]:
I'll take a look.
Any luck? I have a first version of a fix at https://github.com/trommler/ghc/tree/T10458
I still need to create a regression test that does not depend on extra C libraries. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:21 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) ---------------------------------+-------------------------------------- Reporter: rleslie | Owner: trommler Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Changes (by RyanGlScott): * cc: RyanGlScott (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:22 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+---------------------------------------- Reporter: rleslie | Owner: trommler Type: bug | Status: patch Priority: high | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+---------------------------------------- Changes (by trommler): * status: new => patch * failure: None/Unknown => GHCi crash * differential: => Phab:D1631 * architecture: x86_64 (amd64) => Unknown/Multiple Comment: I uploaded a fix to Phabricator. I need some help with writing a regression test. For the test we need a C shared library that is not part of GHCi and that is available on all operating systems. Alternatively we could create our own little shared library. Does the testsuite have support to portably create a shared library? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:23 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+---------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: patch Priority: high | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+---------------------------------------- Changes (by trommler): * owner: trommler => -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:24 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+---------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: patch Priority: high | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+---------------------------------------- Comment (by Phyx-): Hi trommler, do you need a static or dynamic lib for the regression test? I built a few dynamic ones myself in `testsuite\tests\ghci\linking\dyn` -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:25 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+---------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: patch Priority: high | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+---------------------------------------- Changes (by Phyx-): * cc: Phyx- (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:26 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+---------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: patch Priority: high | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+---------------------------------------- Comment (by trommler): Replying to [comment:25 Phyx-]:
Hi trommler, do you need a static or dynamic lib for the regression test? I built a few dynamic ones myself in `testsuite\tests\ghci\linking\dyn` Thank you very much @Phyx-!
That is exactly what I was looking for. Regression test is coming. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:27 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+---------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: 11042 Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+---------------------------------------- Changes (by trommler): * status: patch => new Comment: @simonmar did not like my hack, and he is right. Let me sit down and actually fix dynamic linking properly. My plan for a redesign of dynamic linking is (I'll add that to Trac #11238 too): 1. Use ld to generate a temporary shared object .so from an object file .o linking no other libraries at all. ELF shared objects allow undefined symbols at link time. 1. Link all temporary shared objects, Haskell libraries, and command line C libraries (in that order) into a dummy shared object. Exclude shared objects that are to be unloaded from the link. 1. Load the dummy shared object. Call this the "new" dummy shared object and call the one that was previously loaded the "old" dummy shared object. 1. Unload (dlclose) the dummy shared object. This will also unload shared objects that are to be unloaded (unless they are still referenced by other still loaded libraries). See Phab:1631 for details. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:29 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+---------------------------------------- Reporter: rleslie | Owner: trommler Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: 11042 Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+---------------------------------------- Changes (by trommler): * owner: => trommler -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:30 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+----------------------------------------- Reporter: rleslie | Owner: trommler Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: 9237, 9498, 11042 Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+----------------------------------------- Changes (by hgolden): * cc: hgolden (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:33 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+----------------------------------------- Reporter: rleslie | Owner: trommler Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: 9237, 9498, 11042 Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+----------------------------------------- Comment (by hgolden): Replying to [comment:29 trommler]:
See Phab:1631 for details. The link above doesn't work. Phab:D1631 is correct.
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:34 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+----------------------------------------- Reporter: rleslie | Owner: trommler Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: 9237, 9498, 11042 Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+----------------------------------------- Changes (by simonmar): * cc: simonmar (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:35 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+----------------------------------------- Reporter: rleslie | Owner: trommler Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: 9237, 9498, 11042 Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+----------------------------------------- Comment (by simonmar):
Unload (dlclose) the dummy shared object. This will also unload shared objects that are to be unloaded (unless they are still referenced by other still loaded libraries).
Note that (as discussed in D1631) this is dangerous because there might still be references to the old code from the heap. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:36 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+----------------------------------------- Reporter: rleslie | Owner: trommler Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: 9237, 9498, 11042 Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+----------------------------------------- Comment (by trommler): Replying to [comment:34 hgolden]:
Replying to [comment:29 trommler]:
See Phab:1631 for details. The link above doesn't work. Phab:D1631 is correct. Fixed. Thank you!
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:37 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+----------------------------------------- Reporter: rleslie | Owner: trommler Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: 9237, 9498, 11042 Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+----------------------------------------- Changes (by bgamari): * priority: high => highest Comment: People have privately indicated to me that this is affecting them and it would be nice to see it fixed for 8.0.1. Given that the patch apparently validates on OS X, perhaps we should consider merging. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:38 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+----------------------------------------- Reporter: rleslie | Owner: trommler Type: bug | Status: patch Priority: highest | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: 9237, 9498, 11042 Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+----------------------------------------- Changes (by trommler): * status: new => patch Comment: The patch is ready for merge. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:39 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened)
-------------------------------+-----------------------------------------
Reporter: rleslie | Owner: trommler
Type: bug | Status: patch
Priority: highest | Milestone: 8.0.1
Component: GHCi | Version: 7.10.1
Resolution: | Keywords:
Operating System: Linux | Architecture: Unknown/Multiple
Type of failure: GHCi crash | Test Case:
Blocked By: | Blocking: 9237, 9498, 11042
Related Tickets: | Differential Rev(s): Phab:D1631
Wiki Page: |
-------------------------------+-----------------------------------------
Comment (by Ben Gamari

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+----------------------------------------- Reporter: rleslie | Owner: trommler Type: bug | Status: closed Priority: highest | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: 9237, 9498, 11042 Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+----------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed Comment: Merged to `master` and `ghc-8.0`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:41 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+---------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+---------------------------------------- Changes (by basvandijk): * status: closed => new * owner: trommler => * resolution: fixed => Comment: As also mentioned in #12152 I'm getting the following panic with GHC-8.0.1 which looks very similar to the error discussed in this ticket: {{{ $ git clone https://github.com/LumiGuide/haskell-opencv.git $ cd haskell-opencv $ nix-shell -I nixpkgs=../nixpkgs # a checkout of a recent nixos-16.09 $ rm -rf dist/ $ cabal build -v Package has never been configured. Configuring with default flags. If this fails, please run configure manually. /nix/store/91grrinb827jsdr44yd2lqls9i7z2az0-ghc-8.0.1/bin/ghc --numeric- version looking for tool ghc-pkg near compiler in /nix/store/91grrinb827jsdr44yd2lqls9i7z2az0-ghc-8.0.1/bin found ghc-pkg in /nix/store/91grrinb827jsdr44yd2lqls9i7z2az0-ghc-8.0.1/bin/ghc-pkg /nix/store/91grrinb827jsdr44yd2lqls9i7z2az0-ghc-8.0.1/bin/ghc-pkg --version /nix/store/91grrinb827jsdr44yd2lqls9i7z2az0-ghc-8.0.1/bin/ghc --supported- languages /nix/store/91grrinb827jsdr44yd2lqls9i7z2az0-ghc-8.0.1/bin/ghc --info Reading available packages... /nix/store/pkymfih8lf7j3ib6bfab7srri4xiyw34-pkg-config-0.29/bin/pkg-config --version /nix/store/pkymfih8lf7j3ib6bfab7srri4xiyw34-pkg-config-0.29/bin/pkg-config --list-all /nix/store/pkymfih8lf7j3ib6bfab7srri4xiyw34-pkg-config-0.29/bin/pkg-config --modversion poppler-cairo Wand-6.Q16 'ImageMagick++-6.Q16' python2 formw 'ncurses++' openssl libkeymap libgvc MagickWand-6.Q16 blkid form libxdot opencv ImageMagick menu smartcols libsystemd-login gimpui-2.0 libcdt libgvpr devmapper com_err libcurl libssl libsystemd-journal polkit- gobject-1 libecpg libsystemd polkit-agent-1 libpathplan nix-main libpci poppler panelw Wand libcap xorg-server e2p ImageMagick-6.Q16 liblzma gimpthumb-2.0 ncurses lvm2app MagickCore sqlite3 python libpq libcgraph xtables libprocps libkmod libip4tc libecpg_compat libpgtypes nix-store libcrypto poppler-splash libudev panel ext2fs libiptc poppler-glib 'Magick++-6.Q16' python-2.7 fdisk uuid libsystemd-daemon nix-expr poppler- cpp libip6tc mount fuse MagickWand gimp-2.0 fontconfig udisks2 ncursesw ss 'ImageMagick++' MagickCore-6.Q16 'Magick++' menuw libsystemd-id128 'ncurses++w' Choosing modular solver. Resolving dependencies... creating dist/setup creating dist creating dist/setup copy ./Setup.hs to ./dist/setup/setup.hs /nix/store/91grrinb827jsdr44yd2lqls9i7z2az0-ghc-8.0.1/bin/ghc --make -odir ./dist/setup -hidir ./dist/setup -i -i. -package-id Cabal-1.24.0.0 ./dist/setup/setup.hs -o ./dist/setup/setup -threaded [1 of 1] Compiling Main ( dist/setup/setup.hs, dist/setup/Main.o ) Linking ./dist/setup/setup ... ./dist/setup/setup configure --verbose=2 --builddir=dist --ghc --prefix=/home/bas.van.dijk/.cabal --user --extra-prog-path=/home/bas.van.dijk/.cabal/bin --dependency=aeson=aeson-0.11.2.1-11xZO4dSHJ36B3esP34sNx --dependency=base=base-4.9.0.0 --dependency=base64-bytestring=base64-bytestring-1.0.0.1-In9M41tLtcS9QYt3QpGpNY --dependency=bindings-DSL=bindings-DSL-1.0.23-GUrVdpTUVQC2JWoov2sGwA --dependency=bytestring=bytestring-0.10.8.1 --dependency=containers=containers-0.5.7.1 --dependency=deepseq=deepseq-1.4.2.0 --dependency=inline-c=inline-c-0.5.5.7-3JCuNEZtXHO4YTLZSRWOQ2 --dependency=inline-c-cpp=inline-c-cpp-0.1.0.0-2wSjs2z7tfoLnsB36U1XGl --dependency=linear=linear-1.20.5-2Z9jl9x0ElZ4xkEQ6d4gVk --dependency=primitive=primitive-0.6.1.0-Ip44DqhfCp21tTUYbecwa --dependency=repa=repa-3.4.1.1-FdCcjPvmfDZGBwGc0CsqjV --dependency=template-haskell=template-haskell-2.11.0.0 --dependency=text=text-1.2.2.1-JAnD1x1IHr6H3rdrqlXcyH --dependency=transformers=transformers-0.5.2.0 --dependency=vector=vector-0.11.0.0-BEDZb5o2QOhGbIm6ky7rl6 --disable-tests --exact-configuration --disable-benchmarks Configuring opencv-0.0.0... Dependency aeson ==0.11.2.1: using aeson-0.11.2.1 Dependency base ==4.9.0.0: using base-4.9.0.0 Dependency base64-bytestring ==1.0.0.1: using base64-bytestring-1.0.0.1 Dependency bindings-DSL ==1.0.23: using bindings-DSL-1.0.23 Dependency bytestring ==0.10.8.1: using bytestring-0.10.8.1 Dependency containers ==0.5.7.1: using containers-0.5.7.1 Dependency deepseq ==1.4.2.0: using deepseq-1.4.2.0 Dependency inline-c ==0.5.5.7: using inline-c-0.5.5.7 Dependency inline-c-cpp ==0.1.0.0: using inline-c-cpp-0.1.0.0 Dependency linear ==1.20.5: using linear-1.20.5 Dependency primitive ==0.6.1.0: using primitive-0.6.1.0 Dependency repa ==3.4.1.1: using repa-3.4.1.1 Dependency template-haskell ==2.11.0.0: using template-haskell-2.11.0.0 Dependency text ==1.2.2.1: using text-1.2.2.1 Dependency transformers ==0.5.2.0: using transformers-0.5.2.0 Dependency vector ==0.11.0.0: using vector-0.11.0.0 Dependency opencv -any: using version 3.1.0 Using Cabal-1.24.0.0 compiled by ghc-8.0 Using compiler: ghc-8.0.1 Using install prefix: /home/bas.van.dijk/.cabal Binaries installed in: /home/bas.van.dijk/.cabal/bin Libraries installed in: /home/bas.van.dijk/.cabal/lib/x86_64-linux- ghc-8.0.1/opencv-0.0.0-2zTtfFNABNdFAnLU4MNJ6b Private binaries installed in: /home/bas.van.dijk/.cabal/libexec Data files installed in: /home/bas.van.dijk/.cabal/share/x86_64-linux-ghc-8.0.1/opencv-0.0.0 Documentation installed in: /home/bas.van.dijk/.cabal/share/doc/x86_64-linux-ghc-8.0.1/opencv-0.0.0 Configuration files installed in: /home/bas.van.dijk/.cabal/etc No alex found Using ar found on system at: /nix/store/v77miigq2dx55ga1hxfv3k7v9a873472-binutils-2.27/bin/ar No c2hs found Using cpphs version 1.20.2 found on system at: /nix/store/91grrinb827jsdr44yd2lqls9i7z2az0-ghc-8.0.1/bin/cpphs Using gcc version 5.4.0 given by user at: /nix/store/45qrn064f92kfxnjg99z39zxda671h6f-gcc-wrapper-5.4.0/bin/g++ Using ghc version 8.0.1 found on system at: /nix/store/91grrinb827jsdr44yd2lqls9i7z2az0-ghc-8.0.1/bin/ghc Using ghc-pkg version 8.0.1 found on system at: /nix/store/91grrinb827jsdr44yd2lqls9i7z2az0-ghc-8.0.1/bin/ghc-pkg No ghcjs found No ghcjs-pkg found No greencard found Using haddock version 2.17.2 found on system at: /nix/store/91grrinb827jsdr44yd2lqls9i7z2az0-ghc-8.0.1/bin/haddock No happy found Using haskell-suite found on system at: haskell-suite-dummy-location Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy- location No hmake found Using hpc version 0.67 found on system at: /nix/store/91grrinb827jsdr44yd2lqls9i7z2az0-ghc-8.0.1/bin/hpc Using hsc2hs version 0.68 found on system at: /nix/store/91grrinb827jsdr44yd2lqls9i7z2az0-ghc-8.0.1/bin/hsc2hs Using hscolour version 1.24 found on system at: /run/current-system/sw/bin/HsColour No jhc found Using ld given by user at: /nix/store/45qrn064f92kfxnjg99z39zxda671h6f-gcc-wrapper-5.4.0/bin/g++ No lhc found No lhc-pkg found Using pkg-config version 0.29 found on system at: /nix/store/pkymfih8lf7j3ib6bfab7srri4xiyw34-pkg-config-0.29/bin/pkg-config Using strip version 2.27 found on system at: /nix/store/v77miigq2dx55ga1hxfv3k7v9a873472-binutils-2.27/bin/strip Using tar found on system at: /nix/store/blzs121zpxzms8axnblp1pbbzphrsb2r-gnutar-1.29/bin/tar No uhc found creating dist/setup ./dist/setup/setup build --verbose=2 --builddir=dist --jobs=2 Component build order: library creating dist/build creating dist/build/autogen Building opencv-0.0.0... /nix/store/91grrinb827jsdr44yd2lqls9i7z2az0-ghc-8.0.1/bin/ghc-pkg init dist/package.conf.inplace Preprocessing library opencv-0.0.0... creating dist/build/OpenCV/Core creating dist/build/OpenCV creating dist/build/OpenCV/Core ... ... Lots of calls to hsc2hs ... Building library... creating dist/build /nix/store/91grrinb827jsdr44yd2lqls9i7z2az0-ghc-8.0.1/bin/ghc \ --make \ -fbuilding-cabal-package \ -O \ -j2 \ -static -dynamic-too \ -dynosuf dyn_o -dynhisuf dyn_hi \ -outputdir dist/build -odir dist/build -hidir dist/build -stubdir dist/build \ -i \ -idist/build \ -isrc \ -idist/build/autogen \ -Idist/build/autogen \ -Idist/build \ -Iinclude \ -I/nix/store/gyqgb314gb2jny8xjix3bdrly50p9mrz- opencv-3.1.0/include/opencv \ -I/nix/store/gyqgb314gb2jny8xjix3bdrly50p9mrz-opencv-3.1.0/include \ -optP-include \ -optPdist/build/autogen/cabal_macros.h \ -this-unit-id opencv-0.0.0-2zTtfFNABNdFAnLU4MNJ6b \ -hide-all-packages \ -package-db dist/package.conf.inplace \ -package-id aeson-0.11.2.1-11xZO4dSHJ36B3esP34sNx \ -package-id base-4.9.0.0 \ -package-id base64-bytestring-1.0.0.1-In9M41tLtcS9QYt3QpGpNY \ -package-id bindings-DSL-1.0.23-GUrVdpTUVQC2JWoov2sGwA \ -package-id bytestring-0.10.8.1 -package-id containers-0.5.7.1 \ -package-id deepseq-1.4.2.0 \ -package-id inline-c-0.5.5.7-3JCuNEZtXHO4YTLZSRWOQ2 \ -package-id inline-c-cpp-0.1.0.0-2wSjs2z7tfoLnsB36U1XGl \ -package-id linear-1.20.5-2Z9jl9x0ElZ4xkEQ6d4gVk \ -package-id primitive-0.6.1.0-Ip44DqhfCp21tTUYbecwa \ -package-id repa-3.4.1.1-FdCcjPvmfDZGBwGc0CsqjV \ -package-id template-haskell-2.11.0.0 \ -package-id text-1.2.2.1-JAnD1x1IHr6H3rdrqlXcyH \ -package-id transformers-0.5.2.0 \ -package-id vector-0.11.0.0-BEDZb5o2QOhGbIm6ky7rl6 \ -XHaskell2010 -XBangPatterns -XDataKinds -XFlexibleContexts \ -XFlexibleInstances -XLambdaCase -XOverloadedStrings \ -XPackageImports -XPolyKinds -XScopedTypeVariables \ -XTupleSections -XTypeFamilies -XTypeOperators \ OpenCV OpenCV.Calib3d OpenCV.Core.ArrayOps OpenCV.Core.Types OpenCV.Core.Types.Mat OpenCV.Core.Types.Mat.HMat OpenCV.Core.Types.Mat.Repa OpenCV.Core.Types.Matx OpenCV.Core.Types.Point OpenCV.Core.Types.Rect OpenCV.Core.Types.Size OpenCV.Core.Types.Vec OpenCV.Exception OpenCV.Features2d OpenCV.HighGui OpenCV.ImgCodecs OpenCV.ImgProc.ColorMaps OpenCV.ImgProc.Drawing OpenCV.ImgProc.FeatureDetection OpenCV.ImgProc.GeometricImgTransform OpenCV.ImgProc.ImgFiltering OpenCV.ImgProc.MiscImgTransform OpenCV.ImgProc.MiscImgTransform.ColorCodes OpenCV.ImgProc.ObjectDetection OpenCV.ImgProc.StructuralAnalysis OpenCV.ImgProc.Types OpenCV.JSON OpenCV.Photo OpenCV.TypeLevel OpenCV.Unsafe OpenCV.Video OpenCV.Video.MotionAnalysis OpenCV.VideoIO.VideoCapture OpenCV.Internal OpenCV.Internal.Mutable OpenCV.Internal.C.Inline OpenCV.Internal.C.PlacementNew OpenCV.Internal.C.PlacementNew.TH OpenCV.Internal.C.Types OpenCV.Internal.Calib3d.Constants OpenCV.Internal.Core.ArrayOps OpenCV.Internal.Core.Types OpenCV.Internal.Core.Types.Constants OpenCV.Internal.Core.Types.Mat OpenCV.Internal.Core.Types.Mat.Depth OpenCV.Internal.Core.Types.Mat.Marshal OpenCV.Internal.Core.Types.Mat.ToFrom OpenCV.Internal.Core.Types.Matx OpenCV.Internal.Core.Types.Matx.TH OpenCV.Internal.Core.Types.Point OpenCV.Internal.Core.Types.Point.TH OpenCV.Internal.Core.Types.Rect OpenCV.Internal.Core.Types.Rect.TH OpenCV.Internal.Core.Types.Size OpenCV.Internal.Core.Types.Size.TH OpenCV.Internal.Core.Types.Vec OpenCV.Internal.Core.Types.Vec.TH OpenCV.Internal.Exception OpenCV.Internal.ImgCodecs OpenCV.Internal.ImgProc.MiscImgTransform OpenCV.Internal.ImgProc.MiscImgTransform.TypeLevel OpenCV.Internal.ImgProc.MiscImgTransform.ColorCodes OpenCV.Internal.ImgProc.Types OpenCV.Internal.Photo.Constants \ -Wall \ -fwarn-incomplete-patterns \ -funbox-strict-fields \ -O2 [ 1 of 64] Compiling OpenCV.Internal.Photo.Constants ( dist/build/OpenCV/Internal/Photo/Constants.hs, dist/build/OpenCV/Internal/Photo/Constants.o ) [ 2 of 64] Compiling OpenCV.Internal.ImgProc.MiscImgTransform ( dist/build/OpenCV/Internal/ImgProc/MiscImgTransform.hs, dist/build/OpenCV/Internal/ImgProc/MiscImgTransform.o ) [ 3 of 64] Compiling OpenCV.Internal.ImgCodecs ( dist/build/OpenCV/Internal/ImgCodecs.hs, dist/build/OpenCV/Internal/ImgCodecs.o ) [ 4 of 64] Compiling OpenCV.Internal.Core.Types.Constants ( dist/build/OpenCV/Internal/Core/Types/Constants.hs, dist/build/OpenCV/Internal/Core/Types/Constants.o ) [ 5 of 64] Compiling OpenCV.Internal.C.PlacementNew ( src/OpenCV/Internal/C/PlacementNew.hs, dist/build/OpenCV/Internal/C/PlacementNew.o ) [ 6 of 64] Compiling OpenCV.Internal.C.PlacementNew.TH ( src/OpenCV/Internal/C/PlacementNew/TH.hs, dist/build/OpenCV/Internal/C/PlacementNew/TH.o ) [ 7 of 64] Compiling OpenCV.Internal.Mutable ( src/OpenCV/Internal/Mutable.hs, dist/build/OpenCV/Internal/Mutable.o ) [ 8 of 64] Compiling OpenCV.Internal.Core.ArrayOps ( dist/build/OpenCV/Internal/Core/ArrayOps.hs, dist/build/OpenCV/Internal/Core/ArrayOps.o ) [ 9 of 64] Compiling OpenCV.Internal ( src/OpenCV/Internal.hs, dist/build/OpenCV/Internal.o ) [10 of 64] Compiling OpenCV.Internal.Calib3d.Constants ( dist/build/OpenCV/Internal/Calib3d/Constants.hs, dist/build/OpenCV/Internal/Calib3d/Constants.o ) [11 of 64] Compiling OpenCV.Internal.C.Types ( src/OpenCV/Internal/C/Types.hs, dist/build/OpenCV/Internal/C/Types.o ) [12 of 64] Compiling OpenCV.Internal.Core.Types.Matx ( src/OpenCV/Internal/Core/Types/Matx.hs, dist/build/OpenCV/Internal/Core/Types/Matx.o ) [13 of 64] Compiling OpenCV.Internal.Core.Types.Matx.TH ( src/OpenCV/Internal/Core/Types/Matx/TH.hs, dist/build/OpenCV/Internal/Core/Types/Matx/TH.o ) [14 of 64] Compiling OpenCV.Internal.Core.Types.Point ( src/OpenCV/Internal/Core/Types/Point.hs, dist/build/OpenCV/Internal/Core/Types/Point.o ) [15 of 64] Compiling OpenCV.Internal.Core.Types.Point.TH ( src/OpenCV/Internal/Core/Types/Point/TH.hs, dist/build/OpenCV/Internal/Core/Types/Point/TH.o ) [16 of 64] Compiling OpenCV.Internal.Core.Types.Size ( src/OpenCV/Internal/Core/Types/Size.hs, dist/build/OpenCV/Internal/Core/Types/Size.o ) [17 of 64] Compiling OpenCV.Internal.Core.Types.Size.TH ( src/OpenCV/Internal/Core/Types/Size/TH.hs, dist/build/OpenCV/Internal/Core/Types/Size/TH.o ) [18 of 64] Compiling OpenCV.Internal.Core.Types.Vec ( src/OpenCV/Internal/Core/Types/Vec.hs, dist/build/OpenCV/Internal/Core/Types/Vec.o ) [19 of 64] Compiling OpenCV.Internal.Core.Types.Vec.TH ( src/OpenCV/Internal/Core/Types/Vec/TH.hs, dist/build/OpenCV/Internal/Core/Types/Vec/TH.o ) [20 of 64] Compiling OpenCV.Internal.C.Inline ( src/OpenCV/Internal/C/Inline.hs, dist/build/OpenCV/Internal/C/Inline.o ) [21 of 64] Compiling OpenCV.Core.Types.Size ( src/OpenCV/Core/Types/Size.hs, dist/build/OpenCV/Core/Types/Size.o ) [22 of 64] Compiling OpenCV.Core.Types.Vec ( src/OpenCV/Core/Types/Vec.hs, dist/build/OpenCV/Core/Types/Vec.o ) [23 of 64] Compiling OpenCV.TypeLevel ( src/OpenCV/TypeLevel.hs, dist/build/OpenCV/TypeLevel.o ) [24 of 64] Compiling OpenCV.Internal.ImgProc.MiscImgTransform.TypeLevel ( src/OpenCV/Internal/ImgProc/MiscImgTransform/TypeLevel.hs, dist/build/OpenCV/Internal/ImgProc/MiscImgTransform/TypeLevel.o ) [25 of 64] Compiling OpenCV.Internal.ImgProc.MiscImgTransform.ColorCodes ( src/OpenCV/Internal/ImgProc/MiscImgTransform/ColorCodes.hs, dist/build/OpenCV/Internal/ImgProc/MiscImgTransform/ColorCodes.o ) [26 of 64] Compiling OpenCV.ImgProc.MiscImgTransform.ColorCodes ( src/OpenCV/ImgProc/MiscImgTransform/ColorCodes.hs, dist/build/OpenCV/ImgProc/MiscImgTransform/ColorCodes.o ) [27 of 64] Compiling OpenCV.Internal.Core.Types.Mat.Depth ( src/OpenCV/Internal/Core/Types/Mat/Depth.hs, dist/build/OpenCV/Internal/Core/Types/Mat/Depth.o ) [28 of 64] Compiling OpenCV.Internal.Exception ( src/OpenCV/Internal/Exception.hs, dist/build/OpenCV/Internal/Exception.o ) [29 of 64] Compiling OpenCV.Exception ( src/OpenCV/Exception.hs, dist/build/OpenCV/Exception.o ) [30 of 64] Compiling OpenCV.Internal.Core.Types.Mat.Marshal ( dist/build/OpenCV/Internal/Core/Types/Mat/Marshal.hs, dist/build/OpenCV/Internal/Core/Types/Mat/Marshal.o ) [31 of 64] Compiling OpenCV.Core.Types.Point ( src/OpenCV/Core/Types/Point.hs, dist/build/OpenCV/Core/Types/Point.o ) [32 of 64] Compiling OpenCV.Internal.Core.Types ( src/OpenCV/Internal/Core/Types.hs, dist/build/OpenCV/Internal/Core/Types.o ) [33 of 64] Compiling OpenCV.Internal.Core.Types.Mat ( src/OpenCV/Internal/Core/Types/Mat.hs, dist/build/OpenCV/Internal/Core/Types/Mat.o ) <no location info>: error: ghc: panic! (the 'impossible' happened) (GHC version 8.0.1 for x86_64-unknown-linux): Loading temp shared object failed: /run/user/1001/ghc8697_0/libghc_200.so: undefined symbol: inline_c_OpenCV_Internal_Exception_1_2402dbf3aea4f7f79392b71ed42618962a22e9aa Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug [36 of 64] Compiling OpenCV.Internal.Core.Types.Rect ( src/OpenCV/Internal/Core/Types/Rect.hs, dist/build/OpenCV/Internal/Core/Types/Rect.o ) [37 of 64] Compiling OpenCV.Internal.Core.Types.Rect.TH ( src/OpenCV/Internal/Core/Types/Rect/TH.hs, dist/build/OpenCV/Internal/Core/Types/Rect/TH.o ) [38 of 64] Compiling OpenCV.Core.Types.Rect ( src/OpenCV/Core/Types/Rect.hs, dist/build/OpenCV/Core/Types/Rect.o ) <no location info>: error: ghc: panic! (the 'impossible' happened) (GHC version 8.0.1 for x86_64-unknown-linux): Loading temp shared object failed: /run/user/1001/ghc8697_0/libghc_206.so: undefined symbol: inline_c_OpenCV_Core_Types_Point_19_5c3d561e8841e5271fd465bfb109504b1d56b3f6 Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug [39 of 64] Compiling OpenCV.Core.Types.Matx ( src/OpenCV/Core/Types/Matx.hs, dist/build/OpenCV/Core/Types/Matx.o ) }}} The details are in https://github.com/NixOS/nixpkgs/issues/18558. It's worth repeating here that I've successfully build `haskell-opencv` with GHC-8.0.1 before on an older version of `nixpkgs`. So it has probably something to do with how GHC is packaged in `nixpkgs` or with the used `binutils`. However, a GHC panic should also warrant a ticket on the GHC bug tracker so here it is. Although this ticket is about GHCi and I'm using GHC do note that `haskell-opencv` makes use of template-haskell in lots of places which I believe is using GHCi internally. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:45 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+---------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+---------------------------------------- Changes (by basvandijk): * cc: basvandijk (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:46 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+---------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: GHCi | Version: 8.0.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+---------------------------------------- Changes (by basvandijk): * version: 7.10.1 => 8.0.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:47 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+---------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: GHCi | Version: 8.0.1 Resolution: | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+---------------------------------------- Comment (by bgamari): I am able to reproduce this with GHC 8.0.1 and the instructions given in comment:45. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:48 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+---------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: closed Priority: highest | Milestone: 8.0.1 Component: GHCi | Version: 8.0.1 Resolution: duplicate | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+---------------------------------------- Changes (by trommler): * status: new => closed * resolution: => duplicate Comment: I think this is a duplicate of #11499. The missing symbol seems to be coming from a Haskell package and not a C library. The obvious solution would be to also link all command line Haskell packages into the temporary shared library. This is what fixed the original ticket. In #11238 I am working on a redesigned dynamic linker and it is done for ELF. I need to come back to that patch and finish it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:49 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+---------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: closed Priority: highest | Milestone: 8.0.1 Component: GHCi | Version: 8.0.1 Resolution: duplicate | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+---------------------------------------- Comment (by basvandijk): I fixed the error in haskell-opencv. Somebody at the Haskell eXchange mentioned it could have something to do with the recent [https://nixos.org/nixpkgs/manual/#sec-hardening-in-nixpkgs hardening changes in NixOS-16.09]. It turned out that the `bindnow` feature was causing the problem. After [https://github.com/LumiGuide/haskell- opencv/commit/5ea490af7662fe74b3740619963d37f1fd91e3d4 disabling] the feature the library is building successfully. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:50 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+---------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: closed Priority: highest | Milestone: 8.0.1 Component: GHCi | Version: 8.0.1 Resolution: duplicate | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+---------------------------------------- Comment (by trommler): Replying to [comment:50 basvandijk]:
I fixed the error in haskell-opencv. Somebody at the Haskell eXchange mentioned it could have something to do with the recent [https://nixos.org/nixpkgs/manual/#sec-hardening-in-nixpkgs hardening changes in NixOS-16.09]. It turned out that the `bindnow` feature was causing the problem. After [https://github.com/LumiGuide/haskell- opencv/commit/5ea490af7662fe74b3740619963d37f1fd91e3d4 disabling] the feature the library is building successfully. OK, so the issue is caused by an additional linker flag and is not a duplicate of #11499 after all.
Let's revisit this after #11238. Would you mind creating a new ticket and mark it blocked on #11238? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:51 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10458: GHCi fails to load shared object (the 'impossible' happened) -------------------------------+---------------------------------------- Reporter: rleslie | Owner: Type: bug | Status: closed Priority: highest | Milestone: 8.0.1 Component: GHCi | Version: 8.0.1 Resolution: duplicate | Keywords: Operating System: Linux | Architecture: Unknown/Multiple Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1631 Wiki Page: | -------------------------------+---------------------------------------- Comment (by basvandijk): OK I created #12684 but I expect this is more of a NixOS issue than a GHC issue. I expect GHC is just calling `ld` which on NixOS is a [https://github.com/NixOS/nixpkgs/blob/release-16.09/pkgs/build-support /cc-wrapper/ld-wrapper.sh wrapper script] setting these hardening flags. So I'm not sure if GHC can fix this... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10458#comment:52 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC