mirror of
https://gitee.com/openharmony/third_party_rust_bindgen
synced 2025-03-04 20:57:21 +00:00
context: Don't pass --target=rust-target to clang when building for the host.
This will prevent common issues in platforms where the Rust target is not the clang target, like aarch64-apple-darwin (Rust) vs. arm64-apple-darwin. We may want to special-case those too when cross-compiling.
This commit is contained in:
parent
f91c9b6604
commit
d55b063e80
@ -555,7 +555,14 @@ impl BindgenContext {
|
||||
let translation_unit = {
|
||||
let _t =
|
||||
Timer::new("translation_unit").with_output(options.time_phases);
|
||||
let clang_args = if explicit_target {
|
||||
// NOTE: The effective_target == HOST_TARGET check wouldn't be sound
|
||||
// normally in some cases if we were to call a binary (if you have a
|
||||
// 32-bit clang and are building on a 64-bit system for example).
|
||||
// But since we rely on opening libclang.so, it has to be the same
|
||||
// architecture and thus the check is fine.
|
||||
let clang_args = if explicit_target ||
|
||||
effective_target == HOST_TARGET
|
||||
{
|
||||
Cow::Borrowed(&options.clang_args)
|
||||
} else {
|
||||
let mut args = Vec::with_capacity(options.clang_args.len() + 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user