Closed aherrmann closed 4 years ago
The issue seems to be that Cabal with --enable-profiling
builds both a profiled and a non-profiled version of the library. Building template Haskell in the non-profiled version will require non-profiled versions of dependencies in scope. As a proof of concept, setting --ghc-options=-prof
works around the issue. Cabal will still produce both a _p.a
and a .a
however since -prof
is set on both, GHC will be able to compile template Haskell using the dependency's _p.a
output in both cases.
The issue seems to be that Cabal with --enable-profiling builds both a profiled and a non-profiled version of the library
I described this behavior in #438.
rules_haskell is currently using an approach to profiling (-fexternal-interpreter
) which is not used by the rest of the world. cabal
is not using it. stack
is not using it. So we are facing a lot of bug because as far as I know, we are the only users of this feature.
May be related: https://gitlab.haskell.org/ghc/ghc/issues/16257#comment:11
Describe the bug Building a Cabal package in profiling mode with GHC using the static RTS fails with an error of the form
To Reproduce
https://github.com/digital-asset/daml.git
at revision 49a66515bde39e3ab56b5a63bcce7cf70936edd9bazel build @stackage//:generics-sop -c dbg
Expected behavior The build should succeed.
Environment
Additional context The build fails on what looks like a GHCi linker error when it tries to link the library for the package
sop-core
. The error message mentionslibHSsop-core-0.4.0.0.so
without the usual GHC version suffix, this usually means that GHC is really looking forlibHSsop-core-0.4.0.0.a
. Looking at the artifacts produced by Cabal buildingsop-core
we see that it produceslibHSsop-core-0.4.0.0.a
andlibHSsop-core-0.4.0.0_p.a
. However, rules_haskell only tracks the_p.a
output in profiling mode meaning that the plain.a
will not be made available to any actions down the line depending onsop-core
. A possible solution might be to track the plain.a
output as well and make it available to the Cabal build action.