-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in configuring crates_universe when included as a Bazel module #1348
Comments
Hi @tel, have you been able to integrate CXX into a Bazel build? I am very new to Bazel, and would like to add Rust+CXX to maplibre-native, but failing. Mostly I am just struggling with the best approach to integrating it - there seem to be tons of varying docs but none seem to fit. Thx! |
I got furthest when using tag 110, prior to the switch to bzlmod. Haven’t had time to figure it out completely maybe next week. |
@sthornington not sure what you mean by tag 110 - which repo, or is this a version of something? thx! |
@nyurik I did end up getting it working, albeit with in a hacky fashion. Here's some instructions I just wrote up for someone else asking the same thing. I did end up getting it working... though it's not pretty. I'd love for cxx to just support something like bzlmod and end up in a registry, but until that point what I've done is the following:
run_binary(
name = "bridge",
srcs = ["src/ffi.rs"],
outs = [
"ffi.rs.cc",
"ffi.rs.h",
],
args = [
"$(location src/ffi.rs)",
"-o",
"$(location ffi.rs.h)",
"-o",
"$(location ffi.rs.cc)",
],
tool = "//third-party/cxx:codegen",
) Actually getting the cxx outputs properly integrated into Bazel is a bit messy, but at this point you should be able to mostly follow the examples from the repo. I'm happy to share more, but this should be enough to get you started. |
This is awesome, I'll try it shortly. What steps are needed to actually publish cxx as a reusable module? |
@nyurik I'm not sure. |
I'm attempting to include CXX as a Bzlmod module. Since it is not published on the Bazel Central Registry I'm doing so via a
git_override
where the
add_rules_cc_to_cxx.patch
modifies cxx'sMODULE.bazel
file to include an explicit dependency onrules_cc
, something that I found was necessary to allow Bazel to even attempt to build any targets in@cxx.rs//
.Unfortunately, this still fails due to a repo lookup failure that gets memorialized into the
MODULE.bazel.lock
file. The details are available in this minimal reproductionhttps://github.com/tel/cxx_bzlmod_repro
I think this may be an error in
rules_rust
or howcrate_universe
is being configured, but I wanted to start here and escalate if necessary.The text was updated successfully, but these errors were encountered: