Skip to content

rust_bindgen fails on macOS due to fatal error: 'TargetConditionals.h' file not found  #899

Closed
@kiron1

Description

@kiron1

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?

Metadata

Metadata

Assignees

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