
#9012: HPC is broken (relocation R_386_GOTOFF against undefined symbol can not be used when making a shared object) -------------------------------------+------------------------------------ Reporter: Feuerbach | Owner: Type: bug | Status: patch Priority: high | Milestone: 7.8.4 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by rwbarton): Replying to [comment:12 Feuerbach]:
Try `regex-applicative`. E.g.: `cabal install --enable-library-coverage --run-tests regex-applicative`. (Assuming you have cabal-install 1.20.) That should build the package, run the tests, and generate the hpc report.
Obviously I can't test these instructions because of the very bug we're discussing...
Great, thanks. I did this: {{{ cabal install --only-dep --run-tests -w $HOME/ghc/inplace/bin/ghc-stage2 regex-applicative cabal get regex-applicative cd regex-applicative* cabal configure --enable-library-coverage --enable-tests -w $HOME/ghc/inplace/bin/ghc-stage2 --ghc-option=-XFlexibleContexts # see #8883 cabal test }}} and it seems to have worked fine: {{{ [... building ...] Running 1 test suites... Test suite test-regex-applicative: RUNNING... Test suite test-regex-applicative: PASS Test suite logged to: dist/test/regex-applicative-0.3.0.2-test-regex-applicative.log Writing: regex- applicative-0.3.0.2/Text.Regex.Applicative.StateQueue.hs.html Writing: regex-applicative-0.3.0.2/Text.Regex.Applicative.Compile.hs.html Writing: regex-applicative-0.3.0.2/Text.Regex.Applicative.Types.hs.html Writing: regex- applicative-0.3.0.2/Text.Regex.Applicative.Interface.hs.html Writing: regex- applicative-0.3.0.2/Text.Regex.Applicative.Reference.hs.html Writing: regex-applicative-0.3.0.2/Text.Regex.Applicative.Object.hs.html Writing: hpc_index.html Writing: hpc_index_fun.html Writing: hpc_index_alt.html Writing: hpc_index_exp.html Test coverage report written to dist/hpc/html/test-regex-applicative/hpc_index.html 1 of 1 test suites (1 of 1 test cases) passed. Writing: regex- applicative-0.3.0.2/Text.Regex.Applicative.StateQueue.hs.html Writing: regex-applicative-0.3.0.2/Text.Regex.Applicative.Compile.hs.html Writing: regex-applicative-0.3.0.2/Text.Regex.Applicative.Types.hs.html Writing: regex- applicative-0.3.0.2/Text.Regex.Applicative.Interface.hs.html Writing: regex- applicative-0.3.0.2/Text.Regex.Applicative.Reference.hs.html Writing: regex-applicative-0.3.0.2/Text.Regex.Applicative.Object.hs.html Writing: hpc_index.html Writing: hpc_index_fun.html Writing: hpc_index_alt.html Writing: hpc_index_exp.html Package coverage report written to dist/hpc/html/regex-applicative-0.3.0.2/hpc_index.html }}} The report looks fine, too. (I tried the your first set of instructions first, and I got the same successful messages, but as far as I can tell Cabal didn't save the coverage report anywhere!) However, if I also install the dependencies (test frameworks) with `--enable-library-coverage`, then things break: {{{ [...] Running 1 test suites... Test suite test-regex-applicative: RUNNING... Test suite test-regex-applicative: PASS Test suite logged to: dist/test/regex-applicative-0.3.0.2-test-regex-applicative.log hpc: can not find HUnit-1.2.5.2/Test.HUnit.Lang in ["./.hpc","./dist/hpc/mix/regex-applicative-0.3.0.2","./dist/hpc/mix/test- regex-applicative"] }}} The test executable is not using shared libraries at all, though, so I suspect this case has always been broken. If I make the test executable dynamic, with the first set of steps, I get a report that includes two additional modules, `Text.Regex.Applicative` and `Text.Regex.Applicative.Common`, which have no coverage. I suspect this is due to static linking not linking those object files since they're not needed, while dynamic linking is monolithic. I also get a slightly different error with the second set of steps, possibly due to the same cause. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9012#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler