Skip to content
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 (rule 'rust_library') doesn't contain declared provider 'CcInfo' for cargo raze deps #368

Closed
timothyklim opened this issue Jul 3, 2020 · 3 comments · Fixed by #369

Comments

@timothyklim
Copy link

Hello!
I have an issue in my rust library as JNI after upgrading rules_rust to this commit #361:

load("@//:config.bzl", "rustc_flags")
load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library")

rust_library(
    name = "somelib",
    srcs = ["src/lib.rs"],
    crate_root = "src/lib.rs",
    crate_type = "cdylib",
    rustc_flags = rustc_flags,
    deps = [
        "//cargo:jni",
    ],
    visibility = ["//visibility:public"],
)

bazel build:

Traceback (most recent call last):
        File "/home/xxx/Projects/testapp/BUILD.bazel", line 4
                rust_binary(name = 'joiner.so')
        File "/home/xxx/.cache/bazel/_bazel_johndoe/96364899299eda1f2874771f867b1be1/external/io_bazel_rules_rust/rust/private/rust.bzl", line 169, in _rust_binary_impl
                rustc_compile_action(ctx = ctx, <2 more arguments>)
        File "/home/xxx/.cache/bazel/_bazel_johndoe/96364899299eda1f2874771f867b1be1/external/io_bazel_rules_rust/rust/private/rustc.bzl", line 508, in rustc_compile_action
                establish_cc_info(ctx, <4 more arguments>)
        File "/home/xxx/.cache/bazel/_bazel_johndoe/96364899299eda1f2874771f867b1be1/external/io_bazel_rules_rust/rust/private/rustc.bzl", line 551, in establish_cc_info
                dep[CcInfo]
<target //cargo/vendor/jni-0.17.0:jni> (rule 'rust_library') doesn't contain declared provider 'CcInfo'

Dependencies has been generated by cargo-raze v0.3.6.

@damienmg
Copy link
Collaborator

damienmg commented Jul 3, 2020

Yes there is an obvious bug I wonder why it was not caught earlier.

@damienmg
Copy link
Collaborator

damienmg commented Jul 3, 2020

Ok it wasn't caught because it would be triggered only with staticlib / cdylib

damienmg added a commit to damienmg/rules_rust that referenced this issue Jul 3, 2020
The current code is failing for any cdylib or staticlib with
a rust dependency (without CcInfo provider).

Fixes bazelbuild#368.
damienmg added a commit that referenced this issue Jul 3, 2020
The current code is failing for any cdylib or staticlib with
a rust dependency (without CcInfo provider).

Fixes #368.
@timothyklim
Copy link
Author

Now it's working again. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants