[GHC] #9034: GHCi panics when given C++ object file on GNU/Linux

GHC ghc-devs at haskell.org
Thu Apr 24 17:58:46 UTC 2014


#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


More information about the ghc-tickets mailing list