[GHC] #11683: compiled files don't load in ghci

GHC ghc-devs at haskell.org
Sun Mar 6 17:21:31 UTC 2016


#11683: compiled files don't load in ghci
-------------------------------------+-------------------------------------
           Reporter:  George         |             Owner:
               Type:  bug            |            Status:  new
           Priority:  high           |         Milestone:
          Component:  Compiler       |           Version:  8.0.1-rc2
           Keywords:                 |  Operating System:  MacOS X
       Architecture:                 |   Type of failure:  Incorrect result
  Unknown/Multiple                   |  at runtime
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 compiled files don't load in ghci

 {{{
 ghc -DYNAMIC bug.hs
 [1 of 1] Compiling Main             ( bug.hs, bug.o )
 Linking bug ...
 bash-3.2$ ghci -ignore-dot-ghci

 GHCi, version 8.0.0.20160204: http://www.haskell.org/ghc/  :? for help
 Prelude> Prelude> :load bug
 [1 of 1] Compiling Main             ( bug.hs, interpreted )
 Ok, modules loaded: Main.
 *Main> :show modules
 Main             ( bug.hs, interpreted )
 *Main>
 }}}

 According to the doc,
 file:///usr/local/share/doc/ghc-8.0.0.20160204/html/users_guide/ghci.html
 #loading-compiled-code,  this should work:

 {{{
 Note the -dynamic flag to GHC: GHCi uses dynamically-linked object code
 (if you are on a platform that supports it), and so in order to use
 compiled code with GHCi it must be compiled for dynamic linking.
 }}}

 Similarly https://ghc.haskell.org/trac/ghc/ticket/8736#comment:4 says the
 same thing:

 {{{
 if you say :load Foo in GHCi

 Foo was compiled with -dynamic: loads Foo.o
 }}}

 Interestingly -fobject-code does work:

 {{{
  ghci -ignore-dot-ghci -fobject-code
 GHCi, version 8.0.0.20160204: http://www.haskell.org/ghc/  :? for help
 Prelude> :load bug
 [1 of 1] Compiling Main             ( bug.hs, bug.o )
 Ok, modules loaded: Main.
 Prelude Main>
 }}}

 Unfortunately when I do
 {{{
 ghci -v -ignore-dot-ghci -fobject-code
 }}}

 I don't see why it works. It doesn't seem to use just ghc to compile , it
 also uses gcc, see attached file.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11683>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list