rust-bindgen icon indicating copy to clipboard operation
rust-bindgen copied to clipboard

BINDGEN_EXTRA_CLANG_ARGS_<TARGET> does not document how can be formatted the TARGET

Open jadinm opened this issue 8 months ago • 0 comments

Hello :)

At the moment, Bindgen does not document in its readme that <TARGET> in BINDGEN_EXTRA_CLANG_ARGS_<TARGET> is either the target value or the target with hyphens replaced by underscores.

This is confusing because without any indication, we are tempted to think that bindgen works like cargo config (see https://doc.rust-lang.org/cargo/reference/config.html#environment-variables) but that's not the case.

For instance, the following does not work (while it would for cargo):

$ BINDGEN_EXTRA_CLANG_ARGS_X86_64_UNKNOWN_LINUX_GNU=-v bindgen ...

What bindgen supports is:

$ BINDGEN_EXTRA_CLANG_ARGS_x86_64_unknown_linux_gnu=-v bindgen ...

It would be nice if you could document the <TARGET> format in the README :-)

Maybe it would also be cool to support uppercase targets by modifying get_target_dependent_env_var().

jadinm avatar Apr 03 '25 09:04 jadinm