Skip to content

build union failed #2568

Closed
Closed
@bestgopher

Description

When I built the repo, I got an error.

build env

cargo version -v

cargo 1.70.0 (ec8a8a0ca 2023-04-25)
release: 1.70.0
commit-hash: ec8a8a0cabb0e0cadef58902470f6c7ee7868bdc
commit-date: 2023-04-25
host: aarch64-unknown-linux-gnu
libgit2: 1.6.3 (sys:0.17.0 vendored)
libcurl: 8.0.1-DEV (sys:0.4.61+curl-8.0.1 vendored ssl:OpenSSL/1.1.1t)
os: Ubuntu 23.04 (lunar) [64-bit]

Input C/C++ Header

struct btf_dump_opts {
        union {
                size_t sz;
                void *ctx; /* DEPRECATED: will be gone in v1.0 */
        };
};

Bindgen Invocation

 let bindings = bindgen::Builder::default()
        .header("bindings.h")
        .clang_arg("-Ilibbpf/src")
        .clang_arg("-Ilibbpf/include/uapi")
        .clang_arg("-Ilibbpf/include")
        .allowlist_function("btf_dump__new")
        .allowlist_function("vdprintf")
        .generate()
        .expect("Unable to generate bindings");
    bindings
        .write_to_file(out_path.join("libbpf_bindings.rs"))
        .expect("Couldn't write bindings!");

Actual Results

 thread 'main' panicked at '"btf_dump_opts_union_(anonymous_at_libbpf/src/btf_h_271_2)" is not a valid Ident', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.63/src/fallback.rs:791:9

Expected Results

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions