Skip to content

Bindgen-based build tool that creates self-contained hybrid crates from foreign libraries #2805

Closed
@brson

Description

@brson

When I build bindings to foreign libraries now I prefer to build static native libraries and link them statically into the rust crate. This is a very convenient form for foreign libraries to be in because then you don't have to worry about native dynamic linking rules - everything is a rust crate and follows rust rules. Treating foreign libraries as crates is also potentially convenient for build tools like cargo, which currently has little or no support for them.

The process of constructing this type of hybrid crate is pretty straightforward but there isn't any language or tool support for it.
What I want is a little library that, given the proper configuration, will

  • Run custom build logic to generate a static library archive file at a specific location
  • Run bindgen to generate the rust bindings
  • Output the proper set of attributes to make rust find and link to the static library

This could start out as a standalone build tool, but would need to end up compatible with cargo, and possibly even a rustc plugin that does the building, linking and bindgenating.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions