Skip to content

Allow configuring BINDGEN_EXTRA_CLANG_ARGS per target #2009

Closed
@roblabla

Description

@roblabla

I'm currently trying to generate bindings for libyara in a cross-compilation setup: Generating bindings for Windows-MSVC while running on Linux.

To do so, I have a complete cross-compilation toolchain: The full MSVC SDK is installed on my linux machine, and clang/lld are configured to find the appropriate headers and link the appropriate libs automatically. The problem is, bindgen doesn't appear to offer a way to set-up per-target environment variables to tell it which clang binary to use, or where to find the includes.

For comparison, the cc crate has a handful of environment variables that can be set per target to configure your toolchain. For instance, you can set CC_X86_64_PC_WINDOWS_MSVC to specify the path to cc only when building for the x86_64-pc-windows-msvc target.

Bindgen has the BINDGEN_EXTRA_CLANG_ARGS environment variable, but it can't be set per-target. Ideally, we should have BINDGEN_EXTRA_CLANG_ARGS_X86_64_PC_WINDOWS_MSVC, allowing us to set up the system includes when building for that specific target.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions