I have a Bazel project where I want to use rules_rust with rust_bindgen to be able to use Duktape in rust.
I have a cc_library(...) which can successfully compile Duktape, but the rust_bindgen(...) target fails with the following error:
duktape-sys/src/duk_config.h:407:10: fatal error: 'TargetConditionals.h' file not found
duktape-sys/src/duk_config.h:407:10: fatal error: 'TargetConditionals.h' file not found, err: true
thread 'main' panicked at 'Unable to generate bindings: ()', external/rules_rust_bindgen__bindgen__0_58_1/src/main.rs:54:36
duk_config.h:407
When I use clang from _bindgen_clang_repositories ($(bazel info execution_root)/external/bindgen_clang_osx/bin/clang -c duktape-sys/src/duktape.c ) I get indeed this error:
duktape-sys/src/duk_config.h:407:10: fatal error: 'TargetConditionals.h' file not found
However, when using xcrun clang -c duktape-sys/src/duktape.c, it compiles without problems.
Is there a way to teach rust_bindgen to use clang with the includes directories used by xcrun clang?