Re: [GHC] #3799: undefined symbols and undefined references possibly related to template haskell
#3799: undefined symbols and undefined references possibly related to template haskell -+-- Reporter: JeremyShaw | Owner: Type: bug | Status: closed Priority: normal | Milestone: 6.12.2 Component: Compiler|Version: 6.13 Resolution: invalid | Keywords: undefined symbols references template haskell Difficulty: | Os: Unknown/Multiple Testcase: | Architecture: Unknown/Multiple Failure: Compile-time crash | -+-- Comment(by waern): Replying to [comment:13 Saizan]: just for clarification: only recently haddock started building to object code and so triggering this bug, right? Since the common case has always been calling cabal haddock just after cabal build and it used to work correctly. Yes, that's correct, Haddock started building to object code for TH modules relatively recently. It should have started with 2.4.2, released Mar 21 2009. Then we switched to the native code generator (instead of compiling via C) in 2.5.0. In the latest release we use the native code generator only on platforms where it's available. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3799#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3799: undefined symbols and undefined references possibly related to template haskell
#3799: undefined symbols and undefined references possibly related to template haskell -+-- Reporter: JeremyShaw | Owner: Type: bug | Status: closed Priority: normal | Milestone: 6.12.2 Component: Compiler|Version: 6.13 Resolution: invalid | Keywords: undefined symbols references template haskell Difficulty: | Os: Unknown/Multiple Testcase: | Architecture: Unknown/Multiple Failure: Compile-time crash | -+-- Comment(by Saizan): just for clarification: only recently haddock started building to object code and so triggering this bug, right? Since the common case has always been calling cabal haddock just after cabal build and it used to work correctly. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3799#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3799: undefined symbols and undefined references possibly related to template haskell
#3799: undefined symbols and undefined references possibly related to template haskell -+-- Reporter: JeremyShaw | Owner: Type: bug | Status: closed Priority: normal | Milestone: 6.12.2 Component: Compiler|Version: 6.13 Resolution: invalid | Keywords: undefined symbols references template haskell Difficulty: | Os: Unknown/Multiple Testcase: | Architecture: Unknown/Multiple Failure: Compile-time crash | -+-- Changes (by simonpj): * status: new = closed * resolution: = invalid Comment: Thank you for investigating this. It looks as if my hypothesis was right: Cabal is causing you to (a) compile a module against M.hi, but then (b) link against an M.o that was generated by a different call of GHC. That's simply not supported by GHC: .hi and .o files are indissolubly bound together. So I declare this a Cabal bug. Antoine has helpfully opened a Cabal ticket for it http://hackage.haskell.org/trac/hackage/ticket/624, so I'll close this one as invalid (ie not GHC's problem). Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3799#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3799: undefined symbols and undefined references possibly related to template haskell
#3799: undefined symbols and undefined references possibly related to template haskell -+-- Reporter: JeremyShaw | Owner: Type: bug | Status: closed Priority: normal | Milestone: 6.12.2 Component: Compiler|Version: 6.13 Resolution: invalid | Keywords: undefined symbols references template haskell Difficulty: | Os: Unknown/Multiple Testcase: | Architecture: Unknown/Multiple Failure: Compile-time crash | -+-- Comment(by simonmar): It may be mitigated by this recent patch: {{{ Tue Jan 12 14:58:53 PST 2010 Simon Marlow marlo...@gmail.com * Do some recompilation avoidance in GHC.loadModule GHC.loadModule compiles a module after it has been parsed and typechecked explicity. If we are compiling to object code and there is a valid object file already on disk, then we can skip the compilation step. This is useful in Haddock, when processing a package that uses Template Haskell and hence needs actual compilation, and the package has already been compiled. As usual, the recomp avoidance can be disabled with -fforce-recomp. M ./compiler/main/GHC.hs -7 +17 M ./compiler/main/HscMain.lhs +17 }}} because this should mean that `cabal haddock` won't do any actual recompilation if the package is already built. It's not a robust fix, since if you modify a source file then `cabal haddock` will still do some compilation without updating the `HSsyb-with-class-0.6.1.o` file. The sledgehammer fix in Cabal (use a different `-odir` when haddocking) will avoid the problem, but at the cost of forcing `cabal haddock` to compile everything. I suggest a better fix might be for `cabal haddock` to invoke `cabal build` before running Haddock, to ensure that the object files are up to date. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3799#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3799: undefined symbols and undefined references possibly related to template haskell
#3799: undefined symbols and undefined references possibly related to template haskell --+- Reporter: JeremyShaw |Owner: Type: bug| Status: new Priority: normal |Milestone: 6.12.2 Component: Compiler | Version: 6.13 Keywords: undefined symbols references template haskell | Difficulty: Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: Compile-time crash --+- Comment(by AntoineLatter): Here's the thread on the happstack mailing list where I ran into the issue: http://groups.google.com/group/happs/browse_thread/thread/c66c74294d8eabf Here's a thread on the cafe with another instance: http://thread.gmane.org/gmane.comp.lang.haskell.cafe/69215 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3799#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3799: undefined symbols and undefined references possibly related to template haskell
#3799: undefined symbols and undefined references possibly related to template haskell --+- Reporter: JeremyShaw |Owner: Type: bug| Status: new Priority: normal |Milestone: 6.12.2 Component: Compiler | Version: 6.13 Keywords: undefined symbols references template haskell | Difficulty: Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: Compile-time crash --+- Comment(by AntoineLatter): I did a cabal configure cabal build for syb-with-class, and then checked the timestamps on all of my .hi and .o files. I then did a cabal haddock, and again checked the timestamps. It turns out that running cabal haddock rebuilds all of the .hi and .o files except HSsyb-with-class-0.6.1.o So now the .o file that we make our package out of is out of synch with the .hi files left over in dist/buid. This is probably almost always okay, except for when TH-generated names would end-up in the symbol table. (or if I edited the sources in between cabal build and cabal haddock. Does that make this a bug with Cabal? Following is the dump from my terminal. antoine-latters-macbook:syb-with-class-0.6.1 alatter$ find . | grep \\.o$ | xargs ls -l -rw-r--r-- 1 alatter staff 121496 Jan 16 20:04 ./dist/build/Data/Generics/SYB/WithClass/Basics.o -rw-r--r-- 1 alatter staff5888 Jan 16 20:04 ./dist/build/Data/Generics/SYB/WithClass/Context.o -rw-r--r-- 1 alatter staff 157220 Jan 16 20:04 ./dist/build/Data/Generics/SYB/WithClass/Derive.o -rw-r--r-- 1 alatter staff 403216 Jan 16 20:04 ./dist/build/Data/Generics/SYB/WithClass/Instances.o -rw-r--r-- 1 alatter staff 602752 Jan 16 20:04 ./dist/build/HSsyb-with- class-0.6.1.o antoine-latters-macbook:syb-with-class-0.6.1 alatter$ find . | grep \\.hi$ | xargs ls -l -rw-r--r-- 1 alatter staff 33600 Jan 16 20:04 ./dist/build/Data/Generics/SYB/WithClass/Basics.hi -rw-r--r-- 1 alatter staff2367 Jan 16 20:04 ./dist/build/Data/Generics/SYB/WithClass/Context.hi -rw-r--r-- 1 alatter staff 13960 Jan 16 20:04 ./dist/build/Data/Generics/SYB/WithClass/Derive.hi -rw-r--r-- 1 alatter staff 166039 Jan 16 20:04 ./dist/build/Data/Generics/SYB/WithClass/Instances.hi antoine-latters-macbook:syb-with-class-0.6.1 alatter$ cabal haddock Running Haddock for syb-with-class-0.6.1... Preprocessing library syb-with-class-0.6.1... Warning: The documentation for the following packages are not installed. No links will be generated to these packages: ffi-1.0, rts-1.0 Documentation created: dist/doc/html/syb-with-class/index.html antoine-latters-macbook:syb-with-class-0.6.1 alatter$ find . | grep \\.o$ | xargs ls -l -rw-r--r-- 1 alatter staff 121496 Jan 16 20:05 ./dist/build/Data/Generics/SYB/WithClass/Basics.o -rw-r--r-- 1 alatter staff5896 Jan 16 20:05 ./dist/build/Data/Generics/SYB/WithClass/Context.o -rw-r--r-- 1 alatter staff 157220 Jan 16 20:05 ./dist/build/Data/Generics/SYB/WithClass/Derive.o -rw-r--r-- 1 alatter staff 403216 Jan 16 20:05 ./dist/build/Data/Generics/SYB/WithClass/Instances.o -rw-r--r-- 1 alatter staff 602752 Jan 16 20:04 ./dist/build/HSsyb-with- class-0.6.1.o antoine-latters-macbook:syb-with-class-0.6.1 alatter$ find . | grep \\.hi$ | xargs ls -l -rw-r--r-- 1 alatter staff 33600 Jan 16 20:05 ./dist/build/Data/Generics/SYB/WithClass/Basics.hi -rw-r--r-- 1 alatter staff2367 Jan 16 20:05 ./dist/build/Data/Generics/SYB/WithClass/Context.hi -rw-r--r-- 1 alatter staff 13960 Jan 16 20:05 ./dist/build/Data/Generics/SYB/WithClass/Derive.hi -rw-r--r-- 1 alatter staff 166039 Jan 16 20:05 ./dist/build/Data/Generics/SYB/WithClass/Instances.hi -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3799#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3799: undefined symbols and undefined references possibly related to template haskell
#3799: undefined symbols and undefined references possibly related to template haskell --+- Reporter: JeremyShaw |Owner: Type: bug| Status: new Priority: normal |Milestone: 6.12.2 Component: Compiler | Version: 6.13 Keywords: undefined symbols references template haskell | Difficulty: Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: Compile-time crash --+- Changes (by igloo): * milestone: = 6.12.2 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3799#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3799: undefined symbols and undefined references possibly related to template haskell
#3799: undefined symbols and undefined references possibly related to template haskell -+-- Reporter: JeremyShaw | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler|Version: 6.12.1 Resolution: | Keywords: undefined symbols references template haskell Difficulty: | Os: Unknown/Multiple Testcase: | Architecture: Unknown/Multiple Failure: Compile-time crash | -+-- Comment (by dsf): The symbol that is still undefined under GHC 6.13 is {{{ happstackzmextrazm0zi76_HappstackziDataziIxSetziStore_constrZMa14JsZN_closure }}} which decodes to {{{ happstack-extra-0.76_Happstack.Data.IxSet.Store_constr[a14Js]_closure }}} I will attach Store.o and Store.hi. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3799#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3799: undefined symbols and undefined references possibly related to template haskell
#3799: undefined symbols and undefined references possibly related to template haskell -+-- Reporter: JeremyShaw | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler|Version: 6.13 Resolution: | Keywords: undefined symbols references template haskell Difficulty: | Os: Unknown/Multiple Testcase: | Architecture: Unknown/Multiple Failure: Compile-time crash | -+-- Changes (by dsf): * version: 6.12.1 = 6.13 Comment: This bug is still present under ghc 6.13-20091231, though to a lesser extent. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3799#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3799: undefined symbols and undefined references possibly related to template haskell
#3799: undefined symbols and undefined references possibly related to template haskell -+-- Reporter: JeremyShaw | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler|Version: 6.12.1 Resolution: | Keywords: undefined symbols references template haskell Difficulty: | Os: Unknown/Multiple Testcase: | Architecture: Unknown/Multiple Failure: Compile-time crash | -+-- Comment (by simonpj): Another common factor is that all the missing things look like {{{ sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_constrZMad6fZN_closure }}} Or possibly `dataType` instead of `constr`. Undoing the z-encoding we get: {{{ syb-with- class-0.6.1_Data.Generics.SYB.WithClass.Instances_constr[ad6f]_closure }}} And indeed, I download `syb-with-class` and compile `Instances` with `-ddump-splices` I see {{{ Data/Generics/SYB/WithClass/Instances.hs:1:0: Data/Generics/SYB/WithClass/Instances.hs:1:0: Splicing declarations deriveData ['ByteString] == Data/Generics/SYB/WithClass/Instances.hs:726:3-27 constr[a2YC] :: Constr constr[a2YC] = mkConstr dataType[a2YB] PS Prefix dataType[a2YB] :: DataType dataType[a2YB] = mkDataType ByteString [constr[a2YC]] }}} Those are pretty weird names for top-level bindings! But still, it should work fine, because they are only used via the instance declaration. But it does make me wonder: could you have compiled syb-with-class twice? Each time you compile it you could potentially get different names. If it happens repeatably, do {{{ ghc --show-iface Instances.hi }}} where the `Instances.hi` file is the one from the syb-with-class package. Check the names of the top level bindings (as above). Are they the same as you see with `nm Instances.o`? Now when compiling `Server.hs` (which gets the offending symbols), use `-ddump-if-trace` to see what interface files it is loading, and check that it loads the correct `Instances.hi`. Does the same thing happen in file-at-a-time batch mode, or just with `--make`? Somehow or other, I bet that you are getting two different `Instances.hi` files, or an `Instances.hi` that does not line up with the `Instances.o`. Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3799#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
[GHC] #3799: undefined symbols and undefined references possibly related to template haskell
#3799: undefined symbols and undefined references possibly related to template haskell -+-- Reporter: JeremyShaw| Owner: Type: bug | Status: new Priority: normal| Component: Compiler Version: 6.12.1|Keywords: undefined symbols references template haskell Os: Unknown/Multiple |Testcase: Architecture: Unknown/Multiple | Failure: Compile-time crash -+-- I have seen a number of instances where template-haskell (?) fails at compile time due to missing symbols. For example, when building happstack- data: {{{ [ 7 of 16] Compiling Happstack.Data.Xml.Base ( src/Happstack/Data/Xml/Base.hs, dist/build/Happstack/Data/Xml/Base.o ) Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Loading package array-0.3.0.0 ... linking ... done. Loading package bytestring-0.9.1.5 ... linking ... done. Loading package containers-0.3.0.0 ... linking ... done. Loading package pretty-1.0.1.1 ... linking ... done. Loading package template-haskell ... linking ... done. Loading package syb-with-class-0.6.1 ... linking ... done. Loading package HUnit-1.2.2.1 ... linking ... done. Loading package syb-0.1.0.2 ... linking ... done. Loading package base-3.0.3.2 ... linking ... done. Loading package old-locale-1.0.0.2 ... linking ... done. Loading package time-1.1.4 ... linking ... done. Loading package random-1.0.0.2 ... linking ... done. Loading package QuickCheck-1.2.0.0 ... linking ... done. Loading package extensible-exceptions-0.1.1.1 ... linking ... done. Loading package mtl-1.1.0.2 ... linking ... done. Loading package old-time-1.0.0.3 ... linking ... done. Loading package parsec-2.1.0.1 ... linking ... done. Loading package hsemail-1.3 ... linking ... done. Loading package network-2.2.1.5 ... linking ... done. Loading package SMTPClient-1.0.1 ... linking ... done. Loading package filepath-1.1.0.3 ... linking ... done. Loading package unix-2.4.0.0 ... linking ... done. Loading package directory-1.0.1.0 ... linking ... done. Loading package process-1.0.1.2 ... linking ... done. Loading package hslogger-1.0.7 ... linking ... done. Loading package deepseq-1.1.0.0 ... linking ... done. Loading package parallel-2.2.0.1 ... linking ... done. Loading package strict-concurrency-0.2.2 ... linking ... done. Loading package unix-compat-0.1.2.1 ... linking ... done. Loading package happstack-util-0.4.1 ... linking ... done. Loading package binary-0.5.0.2 ... linking ... done. Loading package haskell98 ... linking ... done. Loading package HaXml-1.13.3 ... linking ... done. Loading package ffi-1.0 ... linking ... done. ghc: unknown symbol `_sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_dataT ypeZMad6eZN_closure' }}} or in some private code: {{{ Loading package extensible-exceptions-0.1.1.1 ... linking ... done. ghc: /usr/lib/haskell-packages/ghc6/lib/generic-formlets-1.53/ghc-6.12.1 /HSgeneric-formlets-1.53.o: unknown symbol `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_constrZMad9AZN_closure' Loading package hsemail-1.3 ... linking ... done. }}} The work around so far has been to compile with {{{-O0}}}. However, it is not consistent *what* needs to be compiled with -O0. In the case of happstack-data, compiling happstack-data with {{{-O0}}} fixed the problem. In the second example I pasted, I actually had to recompile the library that the missing symbol was coming from with {{{-O0}}}. I have also seen similar linking errors during the final link of an executable: {{{ Linking dist/build/senioritymatters/senioritymatters ... dist/build/senioritymatters/senioritymatters-tmp/Senior/Server.o: In function `s5OwR_info': (.text+0x10559): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_constrZMad6fZN_closure' dist/build/senioritymatters/senioritymatters-tmp/Senior/Server.o: In function `r5Hbl_info': (.text+0x105a1): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_dataTypeZMad6eZN_closure' dist/build/senioritymatters/senioritymatters-tmp/Senior/Server.o: In function `r5Hbj_srt': (.data+0x2cec): undefined reference to `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_constrZMad6fZN_closure' dist/build/senioritymatters/senioritymatters-tmp/Senior/Server.o: In function `r5Hbl_srt': (.data+0x2cf8): undefined reference to
Re: [GHC] #3799: undefined symbols and undefined references possibly related to template haskell
#3799: undefined symbols and undefined references possibly related to template haskell -+-- Reporter: JeremyShaw | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler|Version: 6.12.1 Resolution: | Keywords: undefined symbols references template haskell Difficulty: | Os: Unknown/Multiple Testcase: | Architecture: Unknown/Multiple Failure: Compile-time crash | -+-- Changes (by simonmar): * difficulty: = Comment: does it happen with a clean compile, or is it when recompiling? (I'm wondering about #481) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3799#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #3799: undefined symbols and undefined references possibly related to template haskell
#3799: undefined symbols and undefined references possibly related to template haskell -+-- Reporter: JeremyShaw | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler|Version: 6.12.1 Resolution: | Keywords: undefined symbols references template haskell Difficulty: | Os: Unknown/Multiple Testcase: | Architecture: Unknown/Multiple Failure: Compile-time crash | -+-- Comment (by JeremyShaw): Alas, it happens even during a clean build. Happens even if you remove everything and start with a vanilla install. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3799#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs