Skip to content

Bindgen - Errors with bazelmod for missing targets #3137

Closed
@YuhanunCitgez

Description

@YuhanunCitgez

Hey!

I'm working with bzlmod and these are my files

MODULE.bazel

module(
    name = "aeron",
    version = "0.0.0",
)
bazel_dep(name = "rules_rust_bindgen", version = "0.56.0")
bazel_dep(name = "rules_cc", version = "0.1.0")
bazel_dep(name = "rules_foreign_cc", version = "0.13.0")


### AERON ###
git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

git_repository(
    name = "reallogic_aeron",
    build_file = "//misc:BUILD.aeron.bazel",
    commit = "eb83c224e5dd8e22fce1d4631c4e5b952697f30d",
    remote = "https://github.com/real-logic/aeron.git",
)

misc/BUILD.aeron.bazel

load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")

filegroup(
    name = "all_srcs",
    srcs = glob(["**/**"]),
)

cmake(
    name = "aeron-lib",
    defines = [
        "BUILD_AERON_ARCHIVE_API=OFF",
        "CMAKE_BUILD_TYPE=Release",
        "AERON_BUILD_SAMPLES=OFF",
        "AERON_INSTALL_TARGETS=OFF",
        "AERON_TEST=OFF",
        "AERON_SYSTEM_TEST=OFF",
    ],
    lib_source = ":all_srcs",
    targets = [
        "aeron_static",
    ],
    visibility = ["//visibility:public"],
)

exports_files(
    [
        "aeron-client/src/main/c/aeronc.h",
    ],
)

shared/aeron-sys/BUILD.bazel

load("@rules_rust_bindgen//:defs.bzl", "rust_bindgen_library")


rust_bindgen_library(
    name = "aeron-sys",
    bindgen_flags = [],
    cc_lib = "@reallogic_aeron//:aeron-lib",
    header = "@reallogic_aeron//:aeron-client/src/main/c/aeronc.h",
)

For some reason I get the following error:

ERROR: Traceback (most recent call last):
        File "/private/var/tmp/_bazel_yuhanun.citgez/de3a364b6442aaec3a05b5dfddcde7ea/external/llvm-project+/clang/BUILD.bazel", line 530, column 13, in <toplevel>
                ] + glob([
Error in glob: glob pattern 'lib/Basic/*.c' didn't match anything, but allow_empty is set to False (the default value of allow_empty can be set with --incompatible_disallow_empty_glob).
ERROR: /private/var/tmp/_bazel_yuhanun.citgez/de3a364b6442aaec3a05b5dfddcde7ea/external/llvm-project+/clang/BUILD.bazel: no such target '@@llvm-project+//clang:libclang': target 'libclang' not declared in package 'clang' defined by /private/var/tmp/_bazel_yuhanun.citgez/de3a364b6442aaec3a05b5dfddcde7ea/external/llvm-project+/clang/BUILD.bazel
ERROR: /private/var/tmp/_bazel_yuhanun.citgez/de3a364b6442aaec3a05b5dfddcde7ea/external/rules_rust_bindgen+/BUILD.bazel:34:32: no such target '@@llvm-project+//clang:libclang': target 'libclang' not declared in package 'clang' defined by /private/var/tmp/_bazel_yuhanun.citgez/de3a364b6442aaec3a05b5dfddcde7ea/external/llvm-project+/clang/BUILD.bazel and referenced by '@@rules_rust_bindgen+//:libclang'
ERROR: Analysis of target '//shared/aeron-sys:aeron-sys__bindgen' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.296s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
FAILED: 
    Fetching repository @@rules_cc++cc_configure_extension+local_config_cc; starting

when it's simply setting up the bindgen... not sure what I'm doing wrong.

Let me know if this is an issue internally and whether I can contribute

Metadata

Metadata

Assignees

No one assigned

    Labels

    bindgenRelates to Rust Bindgen: https://rust-lang.github.io/rust-bindgen/

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions