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

Possible issue on M1? #1

Open
walkert opened this issue Sep 16, 2022 · 1 comment
Open

Possible issue on M1? #1

walkert opened this issue Sep 16, 2022 · 1 comment

Comments

@walkert
Copy link

walkert commented Sep 16, 2022

Hi there,

If I try and run your example code on my M1 macbook I get this output:

❯ cargo build --example sample
   Compiling tid-rs v0.1.1 (tid-rs)
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-arch" "arm64" "
..
..
  = note: ld: file too small (length=8) file 'tid-rs/target/debug/build/tid-rs-3e035e2da80b90bd/out/libtest.a' for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: could not compile `tid-rs` due to previous error

Interestingly, if I use your crate in my own project and essentially copy the function from your readme I get:

note: Undefined symbols for architecture arm64:
            "_set_localized_cancel_title", referenced from:
                tid::LAContext::set_localized_cancel_title::h55b4e6d4d6a45629 in libtid-75eef23574f5b0ea.rlib(tid-75eef23574f5b0ea.tid.bd52d9c1-cgu.0.rcgu.o)
            "_drop_la_context", referenced from:
                _$LT$tid..LAContext$u20$as$u20$core..ops..drop..Drop$GT$::drop::h0eec580ffe93b8b2 in libtid-75eef23574f5b0ea.rlib(tid-75eef23574f5b0ea.tid.bd52d9c1-cgu.0.rcgu.o)
            "_can_evaluate_policy", referenced from:
                tid::LAContext::can_evaluate_policy::h10f49ce258699dd4 in libtid-75eef23574f5b0ea.rlib(tid-75eef23574f5b0ea.tid.bd52d9c1-cgu.0.rcgu.o)
            "_create_la_context", referenced from:
                tid::LAContext::new::h74e9106ddd97332d in libtid-75eef23574f5b0ea.rlib(tid-75eef23574f5b0ea.tid.bd52d9c1-cgu.0.rcgu.o)
            "_evaluate_policy", referenced from:
                tid::LAContext::evaluate_policy::_$u7b$$u7b$closure$u7d$$u7d$::hd72bfa3c10f42bb5 in touchid-16168130c8666de6.54mxwc64loy1apiu.rcgu.o
               (maybe you meant: tid::LAContext::can_evaluate_policy::h10f49ce258699dd4)
          ld: symbol(s) not found for architecture arm64
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

Am I missing something locally? Thanks!

@Zack-Xb
Copy link

Zack-Xb commented Jul 8, 2023

  1. Add [build-dependencies] cc = "1.0.79" in Cargo.toml
  2. Change build.rs to
  use std::env;
  use std::process::Command;
  use cc;

  fn main() {


   println!("cargo:rustc-link-lib=framework=Foundation");
   println!("cargo:rustc-link-lib=framework=LocalAuthentication");
   println!("cargo:rerun-if-changed=foreign/tid.m");
   println!("cargo:rerun-if-changed=foreign/tid.h");
  
  
        cc::Build::new()
        .file("foreign/tid.m")
        .include("foreign/tid.h")
        .pic(true)
        .compile("tid");
    }
        

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

2 participants