rts dependency in cc_library no longer works (can't find HsFFI.h)
iphydf opened this issue · 5 comments
Describe the bug
I have a cc_library
with a file that includes HsFFI.h
. It depends on the rts
haskell_toolchain_library
. As of some commit around the range of the two commits below, that include fails:
c-toxcore-hs/src/hsbracket.c:1:10: fatal error: 'HsFFI.h' file not found
To Reproduce
Commit d14584e is fine.
Commit 895a4a2 is broken.
Environment
- OS name + version: NixOS 23.11
- Bazel version: 6.4.0
- Version of the rules: See above.
Additional context
I tried roughly bisecting the git history but didn't investigate a lot. The git history is very non-linear, so the linear github view is a bit confusing. I didn't look at the actual git repo.
Thank you for the report! Which version of GHC are you using? And which revision of nixpkgs are you at (assuming you're using rules_nixpkgs)?
Perhaps you can create a minimal reproducible example, since we ensure this works for GHC 9.2.8, 9.4.6 and 9.6.2 in https://github.com/tweag/rules_haskell/tree/master/rules_haskell_tests/tests/cc_haskell_import ?
- My BUILD.bazel: https://github.com/TokTok/c-toxcore-hs/blob/1394e667b39ce6079289720fd1ed6276f80add60/BUILD.bazel
- rts import: https://github.com/TokTok/toktok-stack/blob/master/third_party/haskell/BUILD.bazel#L75
- rules_haskell load: https://github.com/TokTok/toktok-stack/blob/master/WORKSPACE#L111
I don't have a small repro yet. I can probably look into that later this week, maybe in the weekend. Is there any debug info I can provide that would help pinpoint the issue?
Could you run bazel cquery --output build @rules_haskell_ghc_nixpkgs_haskell_toolchain//:rts
and post the output?
Working (old version): https://gist.github.com/iphydf/7acc533910257c2a2c2e1e046176c9bd
Not working (current master): https://gist.github.com/iphydf/b34dad2d4a4dc82fac58a4910e4abf0e
Thank you! It's now pretty obvious why it cannot work, since the includes
and hdrs
attributes are all empty in the output:
# /home/builder/.cache/bazel/_bazel_builder/a08c2e4811c846650b733c6fc815a920/external/rules_haskell_ghc_nixpkgs_haskell_toolchain/BUILD:1365:15
haskell_import(
name = "rts",
visibility = ["//visibility:public"],
id = "rts",
version = "1.0.2",
deps = [],
static_libraries = [],
shared_libraries = [],
static_profiling_libraries = [],
linkopts = ...,
hdrs = [],
includes = [],
haddock_interfaces = [],
)
Maybe this is related to using ghcWithPackages
, which we do not yet test against. I'll have a look.