[GHC] #9034: GHCi panics when given C++ object file on GNU/Linux
#9034: GHCi panics when given C++ object file on GNU/Linux ------------------------------------------+------------------------------- Reporter: jun0 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.8.2 Keywords: panic, dynamic linking | Operating System: Linux Architecture: x86_64 (amd64) | Type of failure: GHCi crash Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------------+------------------------------- When given a C++ object file, GHCi panics saying that it can't find standard C++ symbols the object file relies on. If foo.cc contains {{{#!C++ #include <iostream> extern "C" void foo () { std::cout << "bar"; } }}} and is compiled with {{{ g++ -fPIC -c -o foo.o foo.cc }}} then {{{ ghci foo.o -lstdc++ }}} fails with {{{ GHCi, version 7.8.2: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading object (static) foo.o ... ghc: panic! (the 'impossible' happened) (GHC version 7.8.2 for x86_64-unknown-linux): Loading temp shared object failed: /tmp/ghc14109_0/ghc14109_1.so: undefined symbol: _ZSt4cout Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} It makes no difference to add -L<C++ library paths> which was, IIRC, necessary in older versions of GHC. This applies to only GHCi with C++ -- GHC can link C++ object files just fine, while GHCi has no trouble loading C object files. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9034> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9034: GHCi panics when given C++ object file on GNU/Linux -------------------------------+------------------------------------------ Reporter: jun0 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.8.2 Resolution: | Keywords: panic, dynamic linking Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: GHCi crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------+------------------------------------------ Comment (by jun0): Oh, I forgot to mention my environment. I observe this panic on Ubuntu GNU/Linux 13.10 amd64 with g++ (Ubuntu/Linaro 4.8.1-10ubuntu8) 4.8.1. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9034#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9034: GHCi panics when given C++ object file on GNU/Linux -------------------------------+------------------------------------------ Reporter: jun0 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.8.2 Resolution: | Keywords: panic, dynamic linking Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: GHCi crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------+------------------------------------------ Comment (by carter): could you try using a shared object instead? GHCi 7.8 uses the system dyanmic linker, this problem will likely go away if you use a shared object/dylib -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9034#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9034: GHCi panics when given C++ object file on GNU/Linux -------------------------------+------------------------------------------ Reporter: jun0 | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.3 Component: GHCi | Version: 7.8.2 Resolution: | Keywords: panic, dynamic linking Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: GHCi crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------+------------------------------------------ Changes (by thoughtpolice): * milestone: => 7.8.3 Comment: That's exactly what he's doing, hence the use of `-fPIC`. Otherwise he'd get an invalid relocation error. I can reproduce this, so it should definitely be marked for 7.8.3 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9034#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9034: GHCi panics when given C++ object file on GNU/Linux -------------------------------------+------------------------------------- Reporter: jun0 | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.10.1 Component: GHCi | Version: 7.8.2 Resolution: | Keywords: panic, dynamic Operating System: Linux | linking Type of failure: GHCi crash | Architecture: x86_64 (amd64) Test Case: | Difficulty: Unknown Blocking: | Blocked By: Differential Revisions: | Related Tickets: -------------------------------------+------------------------------------- Comment (by thomie): Running `ghci -v -lstdc++ doesnotexist.o` shows: {{{ ... Loading object (static) doesnotexist.o ... not found Loading object (dynamic) /usr/lib/gcc/x86_64-linux-gnu/4.8/libstdc++.so ... done ... }}} Shouldn't it try to load `libstdc++.so` before `doesnotexist.o`? And why does it say `(static)`? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9034#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9034: GHCi panics when given C++ object file on GNU/Linux -------------------------------------+------------------------------------- Reporter: jun0 | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: GHCi | Version: 7.8.2 Resolution: | Keywords: panic, | dynamic linking Operating System: Linux | Architecture: x86_64 | (amd64) Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by trommler): * cc: trommler (added) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9034#comment:9> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9034: GHCi panics when given C++ object file on GNU/Linux -------------------------------------+------------------------------------- Reporter: jun0 | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.0.1 Component: Compiler | Version: 7.8.2 (Linking) | Keywords: panic, Resolution: | dynamic linking Operating System: Linux | Architecture: x86_64 | (amd64) Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * component: GHCi => Compiler (Linking) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9034#comment:10> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9034: GHCi panics when given C++ object file on GNU/Linux -------------------------------------+------------------------------------- Reporter: jun0 | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 (Linking) | Keywords: panic, Resolution: fixed | dynamic linking Operating System: Linux | Architecture: x86_64 | (amd64) Type of failure: GHCi crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by rwbarton): * status: new => closed * resolution: => fixed Comment: Works in HEAD, probably thanks to c6a3e2277aef2d3b8a472cc82542c9b22cea86bf. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9034#comment:12> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC