Skip to content

libclang wants arm64-apple-XX instead of aarch-apple-XX #1868

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

Closed
ArtBlnd opened this issue Aug 11, 2020 · 5 comments
Closed

libclang wants arm64-apple-XX instead of aarch-apple-XX #1868

ArtBlnd opened this issue Aug 11, 2020 · 5 comments

Comments

@ArtBlnd
Copy link

ArtBlnd commented Aug 11, 2020

Input C/C++ Header

Those NSS related headers.
https://github.com/mozilla/neqo/tree/main/neqo-crypto/bindings

Bindgen Invocation

https://github.com/mozilla/neqo/blob/adbdb256ab6444e7906de3afef849eeb9e6204a6/neqo-crypto/build.rs#L228-L285

Actual Results

--- stderr
clang version 10.0.0 
Target: aarch64-apple-ios
Thread model: posix
InstalledDir: 
thread 'main' panicked at 'libclang error; possible causes include:
- Invalid flag syntax
- Unrecognized flags
- Invalid flag arguments
- File I/O errors
- Host vs. target architecture mismatch
If you encounter an error missing from this list, please file an issue or a PR!', /Users/jujunryoung/.cargo/registry/src/jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823/bindgen-0.53.3/src/ir/context.rs:567:13
stack backtrace:
   0:        0x109c0621e - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h26e8f1b884bae128
   1:        0x109c2ce5c - core::fmt::write::ha0b53fc066268c71
   2:        0x109c02977 - std::io::Write::write_fmt::h410b83a4c70c6549
   3:        0x109c08405 - std::panicking::default_hook::{{closure}}::h70c11ad9e0ccd806
   4:        0x109c08142 - std::panicking::default_hook::hd9eda5765f18f021
   5:        0x109c089bd - std::panicking::rust_panic_with_hook::h3fc8a110bc9d166f
   6:        0x109c08592 - rust_begin_unwind
   7:        0x109c3d08f - core::panicking::panic_fmt::h04439fd445b5f690
   8:        0x109c3cf1a - core::option::expect_failed::h2cafbfb636f224cf
   9:        0x109b0e4c9 - bindgen::ir::context::BindgenContext::new::h43977ed84c226e7c
  10:        0x109ae132b - bindgen::Builder::generate::h2b57f01365a8288c
  11:        0x109a7311b - build_script_build::main::hf9e2ed509ece4751
  12:        0x109a6c036 - std::rt::lang_start::{{closure}}::h0f2b4e0c6bd159dc
  13:        0x109c08d49 - std::rt::lang_start_internal::hbec44ff873a30990
  14:        0x109a73f09 - main

see detail explains here: mozilla/neqo#922

@ArtBlnd
Copy link
Author

ArtBlnd commented Aug 11, 2020

This is not build environment related issues. it does same one clean macos one.

@ArtBlnd
Copy link
Author

ArtBlnd commented Aug 18, 2020

If builder does not select target. it will set-up libclang target automatically.
Seems libclang does not recognize aarch64-apple-ios which rust supports.

fn find_effective_target(clang_args: &[String]) -> (String, bool) {
    use std::env;

    let mut args = clang_args.iter();
    while let Some(opt) = args.next() {
        if opt.starts_with("--target=") {
            let mut split = opt.split('=');
            split.next();
            return (split.next().unwrap().to_owned(), true);
        }

        if opt == "-target" {
            if let Some(target) = args.next() {
                return (target.clone(), true);
            }
        }
    }

    // If we're running from a build script, try to find the cargo target.
    if let Ok(t) = env::var("TARGET") {
        return (t, false);
    }

    (HOST_TARGET.to_owned(), false)
}

do I need to generate aarch64-apple-ios bind with apple-clang toolchain?(libclang)

@ArtBlnd ArtBlnd changed the title Failed to generate mozilia NSS cross-compiled bindgen Failed to generate bindgen on aarch64-apple-ios target. Aug 18, 2020
@ArtBlnd
Copy link
Author

ArtBlnd commented Aug 18, 2020

Seems libclang wants arm64-apple-ios instead of aarch64-apple-ios. and rustc is exporting TARGET env as aarch64-apple-ios

@ArtBlnd ArtBlnd changed the title Failed to generate bindgen on aarch64-apple-ios target. libclang wants arm64-apple-XX instead of aarch-apple-XX Aug 18, 2020
@simlay
Copy link
Contributor

simlay commented Aug 18, 2020

This issue looks like a dup of #1211.

@emilio
Copy link
Contributor

emilio commented Aug 18, 2020

Yep, that's #1211.

@emilio emilio closed this as completed Aug 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants