Circular dependency on `com_github_nelhage_rules_boost`.
optimality opened this issue · 4 comments
When I added the suggested code to my WORKSPACE file and attempted to build, I received the following error:
# bazel build //...
ERROR: Failed to load Starlark extension '@com_github_nelhage_rules_boost//:boost/boost.bzl'.
Cycle in the workspace file detected. This indicates that a repository is used prior to being defined.
The following chain of repository dependencies lead to the missing definition.
- @com_github_nelhage_rules_boost
This could either mean you have to add the '@com_github_nelhage_rules_boost' repository with a statement like `http_archive` in your WORKSPACE file (note that transitive dependencies are not added automatically), or move an existing definition earlier in your WORKSPACE file.
ERROR: cycles detected during target parsing
INFO: Elapsed time: 0.389s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
I was able to resolve this by copying your http_archive
definition of com_github_nelhage_rules_boost
from workspace_setup.bzl
and putting it before the hedron_make_cc_https_easy
invocation in my WORKSPACE file, so that my WORKSPACE looks like this:
http_archive(
name = "com_github_nelhage_rules_boost",
sha256 = "89c3b084702e36e5d4f23e5c6cfb2477a2a3c22b3e42daf0c26f1aa118503246",
strip_prefix = "rules_boost-afde66a455ccf7398c6eaa5f320a72b2974ceaad",
url = "https://github.com/nelhage/rules_boost/archive/afde66a455ccf7398c6eaa5f320a72b2974ceaad.tar.gz",
)
http_archive(
name = "hedron_make_cc_https_easy",
sha256 = "ef582dba347de57810724021c63fe2e6e114eaad3eb9322ab9ffc5145800967f",
strip_prefix = "bazel-make-cc-https-easy-2850c63f2826d2b4f5d520bfc688018e96c1df0b",
url = "https://github.com/hedronvision/bazel-make-cc-https-easy/archive/2850c63f2826d2b4f5d520bfc688018e96c1df0b.tar.gz",
)
load("@hedron_make_cc_https_easy//:workspace_setup.bzl", "hedron_make_cc_https_easy")
hedron_make_cc_https_easy()
I believe you can replicate this easily in an empty project.
I think the underlying issue is that in workspace_setup.bzl
on line 3 you have
load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps")
but rules_boost
hasn't been imported yet; that happens on line 31.
Not sure what a good fix would be or I would've just sent a PR, sorry.
Hey, Austin! Thanks for giving these rules a whirl and reporting the issue. Love the username :)
I use (and help maintain) both together, so 🤦🏻 I hadn't tested this case.
I just pushed up a fix--you'll need to add another short snippet to your WORKSPACE.
(Unfortunately, this just isn't something current Bazel handles very well--pre bzlmod. More details in the commit backlinked above.)
Cheers!
Chris
P.S. Thanks for your willingness to file a PR if/when you see your way to a fix. This one's a weird, tricky bazel edge case, but I'm hoping we'll get to collaborate more in the future.
Thanks for the fix, much appreciated! Big fan of this and your compile commands extractor.
:) My pleasure, man. Thanks for reporting--and replying back.
If you're down to share, I'd love to know what you're building with them! Helps me understand use cases and feel good about building the tools.
Checking back in: Working for you ok @optimality?
One place I'd love your help: Compile commands extractor kinda exploded on its own (in a good way) but this one's been slower on the uptake. Any other ways you can think of to make it more valuable to more people--or other things that'd have helped you find it? (Unblocking usage without boost is huge--I'm wondering if there are other ways I'm accidentally cutting off usage.)