[GHC] #11683: compiled files don't load in ghci
GHC
ghc-devs at haskell.org
Sun Mar 6 17:36:55 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
Resolution: | 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: |
-------------------------------------+-------------------------------------
Description changed by George:
@@ -55,0 +55,67 @@
+ {{{
+ ghc --version
+ The Glorious Glasgow Haskell Compilation System, version 8.0.0.20160204
+ bash-3.2$ ghc --info
+ [("Project name","The Glorious Glasgow Haskell Compilation System")
+ ,("GCC extra via C opts"," -fwrapv -fno-builtin")
+ ,("C compiler command","/usr/bin/gcc")
+ ,("C compiler flags"," -m64 -fno-stack-protector")
+ ,("C compiler link flags"," -m64")
+ ,("Haskell CPP command","/usr/bin/gcc")
+ ,("Haskell CPP flags","-E -undef -traditional -Wno-invalid-pp-token -Wno-
+ unicode -Wno-trigraphs")
+ ,("ld command","/usr/bin/ld")
+ ,("ld flags"," -arch x86_64")
+ ,("ld supports compact unwind","YES")
+ ,("ld supports build-id","NO")
+ ,("ld supports filelist","YES")
+ ,("ld is GNU ld","NO")
+ ,("ar command","/usr/bin/ar")
+ ,("ar flags","clqs")
+ ,("ar supports at file","NO")
+ ,("touch command","touch")
+ ,("dllwrap command","/bin/false")
+ ,("windres command","/bin/false")
+ ,("libtool command","libtool")
+ ,("perl command","/usr/bin/perl")
+ ,("cross compiling","NO")
+ ,("target os","OSDarwin")
+ ,("target arch","ArchX86_64")
+ ,("target word size","8")
+ ,("target has GNU nonexec stack","False")
+ ,("target has .ident directive","True")
+ ,("target has subsections via symbols","True")
+ ,("Unregisterised","NO")
+ ,("LLVM llc command","/usr/local/bin/llc-3.7")
+ ,("LLVM opt command","/usr/local/bin/opt-3.7")
+ ,("Project version","8.0.0.20160204")
+ ,("Project Git commit id","e2230228906a1c0fa1f86a0c1aa18d87de3cc49d")
+ ,("Booter version","7.10.2")
+ ,("Stage","2")
+ ,("Build platform","x86_64-apple-darwin")
+ ,("Host platform","x86_64-apple-darwin")
+ ,("Target platform","x86_64-apple-darwin")
+ ,("Have interpreter","YES")
+ ,("Object splitting supported","YES")
+ ,("Have native code generator","YES")
+ ,("Support SMP","YES")
+ ,("Tables next to code","YES")
+ ,("RTS ways","l debug thr thr_debug thr_l thr_p dyn debug_dyn thr_dyn
+ thr_debug_dyn l_dyn thr_l_dyn")
+ ,("RTS expects libdw","NO")
+ ,("Support dynamic-too","YES")
+ ,("Support parallel --make","YES")
+ ,("Support reexported-modules","YES")
+ ,("Support thinning and renaming package flags","YES")
+ ,("Requires unified installed package IDs","YES")
+ ,("Uses package keys","YES")
+ ,("Uses unit IDs","YES")
+ ,("Dynamic by default","NO")
+ ,("GHC Dynamic","YES")
+ ,("GHC Profiled","NO")
+ ,("Leading underscore","YES")
+ ,("Debug on","False")
+ ,("LibDir","/usr/local/lib/ghc-8.0.0.20160204")
+ ,("Global Package DB","/usr/local/lib/ghc-8.0.0.20160204/package.conf.d")
+ ]
+ }}}
New description:
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.
{{{
ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.0.0.20160204
bash-3.2$ ghc --info
[("Project name","The Glorious Glasgow Haskell Compilation System")
,("GCC extra via C opts"," -fwrapv -fno-builtin")
,("C compiler command","/usr/bin/gcc")
,("C compiler flags"," -m64 -fno-stack-protector")
,("C compiler link flags"," -m64")
,("Haskell CPP command","/usr/bin/gcc")
,("Haskell CPP flags","-E -undef -traditional -Wno-invalid-pp-token -Wno-
unicode -Wno-trigraphs")
,("ld command","/usr/bin/ld")
,("ld flags"," -arch x86_64")
,("ld supports compact unwind","YES")
,("ld supports build-id","NO")
,("ld supports filelist","YES")
,("ld is GNU ld","NO")
,("ar command","/usr/bin/ar")
,("ar flags","clqs")
,("ar supports at file","NO")
,("touch command","touch")
,("dllwrap command","/bin/false")
,("windres command","/bin/false")
,("libtool command","libtool")
,("perl command","/usr/bin/perl")
,("cross compiling","NO")
,("target os","OSDarwin")
,("target arch","ArchX86_64")
,("target word size","8")
,("target has GNU nonexec stack","False")
,("target has .ident directive","True")
,("target has subsections via symbols","True")
,("Unregisterised","NO")
,("LLVM llc command","/usr/local/bin/llc-3.7")
,("LLVM opt command","/usr/local/bin/opt-3.7")
,("Project version","8.0.0.20160204")
,("Project Git commit id","e2230228906a1c0fa1f86a0c1aa18d87de3cc49d")
,("Booter version","7.10.2")
,("Stage","2")
,("Build platform","x86_64-apple-darwin")
,("Host platform","x86_64-apple-darwin")
,("Target platform","x86_64-apple-darwin")
,("Have interpreter","YES")
,("Object splitting supported","YES")
,("Have native code generator","YES")
,("Support SMP","YES")
,("Tables next to code","YES")
,("RTS ways","l debug thr thr_debug thr_l thr_p dyn debug_dyn thr_dyn
thr_debug_dyn l_dyn thr_l_dyn")
,("RTS expects libdw","NO")
,("Support dynamic-too","YES")
,("Support parallel --make","YES")
,("Support reexported-modules","YES")
,("Support thinning and renaming package flags","YES")
,("Requires unified installed package IDs","YES")
,("Uses package keys","YES")
,("Uses unit IDs","YES")
,("Dynamic by default","NO")
,("GHC Dynamic","YES")
,("GHC Profiled","NO")
,("Leading underscore","YES")
,("Debug on","False")
,("LibDir","/usr/local/lib/ghc-8.0.0.20160204")
,("Global Package DB","/usr/local/lib/ghc-8.0.0.20160204/package.conf.d")
]
}}}
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11683#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list