filipw / strathweb-phi-engine

A cross platform library with C#/Swift/Kotlin/Python bindings for running Phi-3 inference
MIT License
11 stars 1 forks source link

can't find crate for `core` #12

Closed ivanmladek closed 2 months ago

ivanmladek commented 2 months ago

The ./build-xcframework.sh throws weird errors even though the rustup target add aarch64-apple-ios rustup target add aarch64-apple-ios-sim and rustup target add aarch64-apple-darwin were all added

 % ./build-xcframework.sh
   Compiling cfg-if v1.0.0
   Compiling once_cell v1.19.0
   Compiling libc v0.2.153
   Compiling memchr v2.7.2
   Compiling itoa v1.0.11
   Compiling bitflags v2.5.0
   Compiling serde v1.0.197
   Compiling thiserror v1.0.58
error[E0463]: can't find crate for `core`
  |
  = note: the `aarch64-apple-ios` target may not be installed
  = help: consider downloading the target with `rustup target add aarch64-apple-ios`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `libc` (lib) due to 1 previous error
error[E0463]: can't find crate for `std`
  |
  = note: the `aarch64-apple-ios` target may not be installed
  = help: consider downloading the target with `rustup target add aarch64-apple-ios`

error: could not compile `itoa` (lib) due to 1 previous error
error: could not compile `once_cell` (lib) due to 1 previous error
error: could not compile `bitflags` (lib) due to 1 previous error
error: could not compile `thiserror` (lib) due to 1 previous error
error: could not compile `memchr` (lib) due to 1 previous error
error: could not compile `serde` (lib) due to 1 previous error
   Compiling cfg-if v1.0.0
   Compiling once_cell v1.19.0
   Compiling libc v0.2.153
   Compiling itoa v1.0.11
   Compiling memchr v2.7.2
   Compiling serde v1.0.197
   Compiling bitflags v2.5.0
   Compiling thiserror v1.0.58
error[E0463]: can't find crate for `core`
  |
  = note: the `aarch64-apple-ios-sim` target may not be installed
  = help: consider downloading the target with `rustup target add aarch64-apple-ios-sim`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for `std`
  |
  = note: the `aarch64-apple-ios-sim` target may not be installed
  = help: consider downloading the target with `rustup target add aarch64-apple-ios-sim`

error: could not compile `libc` (lib) due to 1 previous error
error: could not compile `once_cell` (lib) due to 1 previous error
error: could not compile `itoa` (lib) due to 1 previous error
error: could not compile `thiserror` (lib) due to 1 previous error
error: could not compile `bitflags` (lib) due to 1 previous error
error: could not compile `memchr` (lib) due to 1 previous error
error: could not compile `serde` (lib) due to 1 previous error
   Compiling cfg-if v1.0.0
   Compiling once_cell v1.19.0
   Compiling libc v0.2.153
   Compiling bitflags v2.5.0
   Compiling itoa v1.0.11
   Compiling memchr v2.7.2
   Compiling serde v1.0.197
   Compiling thiserror v1.0.58
error[E0463]: can't find crate for `core`
  |
  = note: the `aarch64-apple-darwin` target may not be installed
  = help: consider downloading the target with `rustup target add aarch64-apple-darwin`

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `std`
  |
  = note: the `aarch64-apple-darwin` target may not be installed
  = help: consider downloading the target with `rustup target add aarch64-apple-darwin`

error: could not compile `libc` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `cfg-if` (lib) due to 1 previous error
error: could not compile `itoa` (lib) due to 1 previous error
error: could not compile `once_cell` (lib) due to 1 previous error
error: could not compile `bitflags` (lib) due to 1 previous error
error: could not compile `thiserror` (lib) due to 1 previous error
error: could not compile `memchr` (lib) due to 1 previous error
error: could not compile `serde` (lib) due to 1 previous error
error: the path does not point to a valid library: /Users/hhhhgggggg/code/strathweb-phi-engine/strathweb-phi-engine/target/aarch64-apple-ios/release/libstrathweb_phi_engine.a
filipw commented 2 months ago

which host platform are you on? I doubt that this will work (cross-compile) from any other host than arm64 Mac.

But on arm64 Mac it should definitely work, it's now built in the CI too https://github.com/filipw/strathweb-phi-engine/blob/main/.github/workflows/ci.yml#L49-L68

ivanmladek commented 2 months ago

Thank you, it is Mac arm 64. Will check the CI

filipw commented 2 months ago

Try checking rustup show and make sure the targets are there. Then check which cargo and which rustup to make sure they are really the same.

Maybe you have two conflicting Rust installations. Here is a similar issue where the user had brew installed Rust.

The simplest approach is to make sure you only have a single installation, installed via rustup.