Ticket #187 (new defect)

Opened 3 years ago

Last modified 15 months ago

With TH, when doing "cabal haddock", GHCi "couldn't find symbol"

Reported by: MikolajKonarski Owned by:
Priority: major Milestone:
Version: 2.9.2 Keywords:
Cc:

Description

This is a copy of the ticket http://hackage.haskell.org/trac/hackage/ticket/898, I've filed for Cabal. I include the whole ticket text below.

GHC 7.2.1, Cabal HEAD, Haddock 2.9.2. The message

During interactive linking, GHCi couldn't find the following symbol:
Allurezm0zi4zi2_UtilsziMultiline_multiline_closure

How to reproduce: get package http://hackage.haskell.org/package/Allure-0.4.2, cabal install, cabal haddock --executables and you should get the following:

Running Haddock for Allure-0.4.2...
Warning: The documentation for the following packages are not installed. No
links will be generated to these packages: ConfigFile-1.1.1, HUnit-1.2.4.2,
MissingH-1.1.1.0, ffi-1.0, rts-1.0, cairo-0.12.1, deepseq-1.1.0.2, gio-0.12.1,
glib-0.12.1, gtk-0.12.1, hslogger-1.1.5, mtl-2.0.1.0, network-2.3.0.6,
pango-0.12.1, parsec-3.1.2, random-1.0.1.0, regex-base-0.93.2,
regex-compat-0.95.1, regex-posix-0.95.1, text-0.11.1.6, transformers-0.2.2.0,
zlib-0.5.3.1
Preprocessing executable 'BotAllure' for Allure-0.4.2...
haddock coverage for dist/build/tmp-28531/src/Bot.hs:     0/3   0%
Warning: Main: could not find link destinations for:
    System.Random.StdGen
Documentation created: dist/doc/html/Allure/BotAllure/index.html
Preprocessing executable 'Allure' for Allure-0.4.2...
haddock coverage for dist/build/autogen/Paths_Allure.hs:     0/4   0%
haddock coverage for dist/build/tmp-28531/src/Utils/File.hs:     0/3   0%
haddock coverage for dist/build/tmp-28531/src/Frequency.hs:     0/6   0%
haddock coverage for dist/build/tmp-28531/src/Strategy.hs:     1/7  14%
haddock coverage for dist/build/tmp-28531/src/Content/Content.hs:     0/2   0%
haddock coverage for dist/build/tmp-28531/src/Utils/Multiline.hs:     1/2  50%

During interactive linking, GHCi couldn't find the following symbol:
  Allurezm0zi4zi2_UtilsziMultiline_multiline_closure
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session.  Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.
If you suspect the latter, please send a bug report to:
  glasgow-haskell-bugs@haskell.org

The same problem for a library, with or without executables, with the same code. Hiding, in the library, the offending module Multiline does not help. The only thing that helps is eta-expanding the Multiline code as follows:

-multiline  = TQ.QuasiQuoter (TH.litE . TH.stringL) undefined undefined undefined
+multiline  = TQ.QuasiQuoter (\x -> (TH.litE . TH.stringL) x) undefined undefined undefined

and _not_ using the function in the only place where it's used.

Change History

Changed 2 years ago by anonymous

  • milestone 2.10.0 deleted

Milestone 2.10.0 deleted

Changed 15 months ago by duplode

The same problem was met in this module of threepenny-gui, also triggered by a quasiquoter definition:

include = QuasiQuoter
        { quoteExp = f -- only used as an expression,
        , quotePat = undefined -- hence all other use cases undefined
        , quoteType = undefined
        , quoteDec = undefined
        }
    where
    f s = TH.LitE . TH.StringL <$> TH.runIO (readFile $ root ++ s)

As a workaround, adding an otherwise unnecessary TemplateHaskell pragma averted the issue. (Tested with GHC 7.6.3, Cabal 1.16.0.2 and Haddock 2.13.2.)

Note: See TracTickets for help on using tickets.