On Fri, May 7, 2010 at 5:33 AM, David Fox <firstname.lastname@example.org>
Sometimes the "Setup build" command gets run twice, and in some mysterious way this causes unresolved symbols when loading a library compiled against a library to which this has happened, like this:
Loading package syb-with-class-instances-text-0.0.1 ... linking ... done.
ghc: /usr/lib/haskell-packages/ghc6/lib/happstack-extra-0.87/ghc-6.12.1/HShappstack-extra-0.87.o: unknown symbol `sybzmwithzmclasszm0zi6zi1_DataziGenericsziSYBziWithClassziInstances_constrZMada0ZN_closure'
ghc: unable to load package `happstack-extra-0.87'
This is saying that while loading happstack-extra, it had to load the dependent library syb-with-class-instances-text, and during that load it expected a symbol to appear in syb-with-class which did not. That symbol was in the library produced during the first Setup build, but it came out with a different name during the second. How did syb-with-class-instances-text find out about this old symbol name? I have no idea.
I do know that the second run occurs because the directory dist-ghc6 is being used as a make rule target in hlibrary.mk, rather than using a stamp file whose date won't change once it is created. The attached patch replaces the uses of dist-ghc6 as a make target. Instead, it uses the stamp file dist-ghc6/dist-ghc6-stamp. I am currently rebuilding all of our packages with this fix. I've verified that the build is now only happening once in syb-with-class, and the libraries with the unknown symbol above are being shipped.