Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust env for bindgen compilation. #916

Merged
merged 5 commits into from
Aug 31, 2021

Conversation

sayrer
Copy link
Contributor

@sayrer sayrer commented Aug 29, 2021

This fixes #899 by putting XCODE_VERSION_OVERRIDE, APPLE_SDK_VERSION_OVERRIDE, APPLE_SDK_PLATFORM in the env.

@google-cla google-cla bot added the cla: yes label Aug 29, 2021
Copy link
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -126,6 +129,9 @@ def _rust_bindgen_impl(ctx):
"LIBCLANG_PATH": libclang_dir,
"RUST_BACKTRACE": "1",
}
cc_toolchain, feature_configuration = find_cc_toolchain(ctx)
_, _, linker_env = get_linker_and_args(ctx, ctx.attr, cc_toolchain, feature_configuration, None)
env.update(**linker_env)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need any special handling in the case of clashes with things we explicitly set? e.g. should we be prepending/appending to the LD_LIBRARY_PATH rather than overwriting it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's that issue, and whether the the system include directories from the cc_toolchain should be added. I'm inclined to leave it as I've written it, and adjust if people have problems with it, since this patch is clearly a step forward.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sounds reasonable - let's see how we go!

@illicitonion
Copy link
Collaborator

Can you push a rebase/merge-main, and I'll merge to main? :)

@sayrer
Copy link
Contributor Author

sayrer commented Aug 31, 2021

We should have the user in #899 contribute their test repo as an example, to get some coverage on this.

@illicitonion illicitonion merged commit 96e2d5b into bazelbuild:main Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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