Skip to content

build union failed #2568

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

Closed
bestgopher opened this issue Jun 26, 2023 · 1 comment
Closed

build union failed #2568

bestgopher opened this issue Jun 26, 2023 · 1 comment

Comments

@bestgopher
Copy link

bestgopher commented Jun 26, 2023

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

@bestgopher bestgopher changed the title 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 build union failed Jun 26, 2023
@emilio
Copy link
Contributor

emilio commented Jun 26, 2023

You need to update bindgen, that has been fixed upstream, see #2488.

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

No branches or pull requests

2 participants