[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: A patch to hlibrary.mk in haskell-devscripts to prevent unknown symbol errors



On Fri, May 7, 2010 at 8:31 AM, David Fox <ddssff@gmail.com> wrote:
On Fri, May 7, 2010 at 5:33 AM, David Fox <ddssff@gmail.com> wrote:
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.

A matching patch to hscolour is required, attached.

Oh well, it turns out the problem lies elsewhere.  The patches are correct, but they won't solve the problem.

Reply to: