[GHC] #8734: 7.8.1 rc1 ghci won't load compiled files

#8734: 7.8.1 rc1 ghci won't load compiled files --------------------------+------------------------------------------------ Reporter: George | Owner: Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: GHCi | Version: 7.8.1-rc1 Keywords: | Operating System: MacOS X Architecture: | Type of failure: Incorrect result at runtime Unknown/Multiple | Test Case: Difficulty: | Blocking: Unknown | Blocked By: | Related Tickets: | --------------------------+------------------------------------------------ -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8734 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8734: 7.8.1 rc1 ghci won't load compiled files ------------------------------------------------+-------------------------- Reporter: George | Owner: Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: GHCi | Version: Resolution: | 7.8.1-rc1 Operating System: MacOS X | Keywords: Type of failure: Incorrect result at runtime | Architecture: Test Case: | Unknown/Multiple Blocking: | Difficulty: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by George): Following is script showing that 7.8.1-rc1 ghci won't load compiled files on Mac {{{ /usr/local/bin/ghc Bug.hs [1 of 1] Compiling Main ( Bug.hs, Bug.o ) Linking Bug ... bash-3.2$ /usr/local/bin/ghci GHCi, version 7.8.20140130: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> :load bug [1 of 1] Compiling Main ( bug.hs, interpreted ) Ok, modules loaded: Main. *Main> :show modules Main ( bug.hs, interpreted ) *Main> but it did load .o files on 7.6.3: /usr/bin/ghc Bug.hs [1 of 1] Compiling Main ( Bug.hs, Bug.o ) Linking Bug ... bash-3.2$ /usr/bin/ghci GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> :load Bug Ok, modules loaded: Main. Prelude Main> :show modules Main ( Bug.hs, Bug.o ) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8734#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8734: 7.8.1 rc1 ghci won't load compiled files ------------------------------------------------+-------------------------- Reporter: George | Owner: Type: bug | Status: new Priority: high | Milestone: 7.8.1 Component: GHCi | Version: Resolution: | 7.8.1-rc1 Operating System: MacOS X | Keywords: Type of failure: Incorrect result at runtime | Architecture: Test Case: | Unknown/Multiple Blocking: | Difficulty: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by hvr): ...that's actually by design, as 7.8.1 switched to using the system linker in combination with DSOs -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8734#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8734: 7.8.1 rc1 ghci won't load compiled files ------------------------------------------------+-------------------------- Reporter: George | Owner: Type: bug | Status: closed Priority: high | Milestone: 7.8.1 Component: GHCi | Version: Resolution: invalid | 7.8.1-rc1 Operating System: MacOS X | Keywords: Type of failure: Incorrect result at runtime | Architecture: Test Case: | Unknown/Multiple Blocking: | Difficulty: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Changes (by thoughtpolice): * status: new => closed * resolution: => invalid Comment: Herbert is correct. This is by design - GHCi now loads dynamic object files, not static object files. But GHC itself still defaults to dynamic linking. However, there is still a bug here: GHCi doesn't handle `.dyn_o` correctly. I've filed #8736 for that. Thanks for the report. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8734#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8734: 7.8.1 rc1 ghci won't load compiled files ------------------------------------------------+-------------------------- Reporter: George | Owner: Type: bug | Status: closed Priority: high | Milestone: 7.8.1 Component: Documentation | Version: Resolution: invalid | 7.8.1-rc1 Operating System: MacOS X | Keywords: Type of failure: Incorrect result at runtime | Architecture: Test Case: | Unknown/Multiple Blocking: | Difficulty: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Changes (by George): * component: GHCi => Documentation Comment: Then perhaps this is a doc bug? The GHC users guide. Ch.2, sec 3 on loading compiled code (../ghc-7.8.20140130/docs/users_guide/users_guide /ghci-compiled.html) has: "When loading up source modules with :load, GHCi normally looks for any corresponding compiled object files, and will use one in preference to interpreting the source if possible. Is there any design doc on the dynamic linking changes that you could point me to? Also some user documentation on how to use dyn_o files in conjunction with ghci? Thanks for everybody's quick response. I;m hoping there is some documentation that you can point me at to get up too speed. I've probably missed some obvious things. Thanks again. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8734#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8734: 7.8.1 rc1 ghci won't load compiled files ------------------------------------------------+-------------------------- Reporter: George | Owner: Type: bug | Status: closed Priority: high | Milestone: 7.8.1 Component: Documentation | Version: Resolution: invalid | 7.8.1-rc1 Operating System: MacOS X | Keywords: Type of failure: Incorrect result at runtime | Architecture: Test Case: | Unknown/Multiple Blocking: | Difficulty: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by thoughtpolice): We highlighted it in the release notes ("As a result of this, GHCi (and Template Haskell) must now load dynamic object files...") but it perhaps warrants a bigger mention. I do think the part you quoted should be changed. The basic idea is pretty simple: GHC now just uses the system dynamic linker to load code. That's all. So it needs dynamically linked object files. GHC normally compiles statically, though (and there are advantages to this.) So now you need to compile "statically and dynamically at the same time." I'll revise this in the user manual. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8734#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8734: 7.8.1 rc1 ghci won't load compiled files ------------------------------------------------+-------------------------- Reporter: George | Owner: Type: bug | Status: closed Priority: high | Milestone: 7.8.1 Component: Documentation | Version: Resolution: invalid | 7.8.1-rc1 Operating System: MacOS X | Keywords: Type of failure: Incorrect result at runtime | Architecture: Test Case: | Unknown/Multiple Blocking: | Difficulty: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by George): Thanks, makes sense. Can you confirm my understanding? to load compiled object files into ghci users must compile with the -dynamic-too option. Once bug #8736 is fixed :load will load a compiled object file into ghci. If so then the release note might say: {{{ On Linux, FreeBSD and Mac OS X, GHCi now uses the system dynamic linker by default, instead of its built in (static) object linker. This is more robust cross-platform, and fixes many long-standing bugs (for example: constructors and destructors, weak symbols, etc work correctly, and several edge cases in the RTS are fixed.) As a result of this, GHCi (and Template Haskell) must now load dynamic object files, not static ones. To get dynamic object files, you must compile with the new compilation flag, -dynamic-too, which causes GHC to emit both static and dynamic object files. GHC itself still defaults to static linking. }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8734#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8734: 7.8.1 rc1 ghci won't load compiled files ------------------------------------------------+-------------------------- Reporter: George | Owner: Type: bug | Status: closed Priority: high | Milestone: 7.8.1 Component: Documentation | Version: Resolution: invalid | 7.8.1-rc1 Operating System: MacOS X | Keywords: Type of failure: Incorrect result at runtime | Architecture: Test Case: | Unknown/Multiple Blocking: | Difficulty: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by George): I understand now that compiling with -dynamic allows object files to be loaded into gchi. It would be good to improve doc. Looks like gnu emacs package should be changed to use that. I'll file a bug with them on that -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8734#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8734: 7.8.1 rc1 ghci won't load compiled files ------------------------------------------------+-------------------------- Reporter: George | Owner: Type: bug | Status: closed Priority: high | Milestone: 7.8.1 Component: Documentation | Version: Resolution: invalid | 7.8.1-rc1 Operating System: MacOS X | Keywords: Type of failure: Incorrect result at runtime | Architecture: Test Case: | Unknown/Multiple Blocking: | Difficulty: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by George): gnu emacs haskell package works fine -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8734#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC