Skip to content

How to avoid bindgen being out of sync with cc? #2962

Open
@Sympatron

Description

@Sympatron

My understanding is, that it is very common to wrap a C library in a Rust *-sys crate by using bindgen to automatically generate Rust bindings and cc to compile the C code.

As far as I understand it bindgen uses libclang to parse the C headers and cc uses whatever compiler the user provides.

This can lead to problems, because both toolchains don't need to agree on everything. While cross compiling for thumbv6m-none-eabi on Windows, bindgen generated u32 for enums and cc used u8 when possible (-fshort-enums).

This is quite unfortunate and hard to catch. Is there a common workaround for this?

PS: If there is a better place for this issue please tell me.

Metadata

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