rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
96.23k stars 12.44k forks source link

cant' find crate core and can't find compiler_builtins #114276

Open Omkar19202 opened 1 year ago

Omkar19202 commented 1 year ago

I am actually very new to Rust.I was trying to build the IOS app from the source from the MLC(machine learning compilation).This is the Link https://mlc.ai/mlc-llm/docs/deploy/ios.html. But while doing so I encountered this Bug : Screenshot 2023-07-31 at 11 55 41 AM I have xcode installed. I have tried various solutions such as updating rust and building this entire MLC IOS again from scratch but still it is giving me this error. What exactly is causing this error ? I have no experience with rust hence its taking a tough time to resolve this error.

the8472 commented 1 year ago

Did you follow the instructions from the error, that is installed the target component via rustup, assuming you're using rustup to manage rust?

Omkar19202 commented 1 year ago

Yes, I have, but its showing that aarch64-apple-ios is up to date. Just see the last line in the screenshot.

Omkar19202 commented 1 year ago

I think that it is something related to xcode installation but I am not getting what exactly to do ?

Omkar19202 commented 1 year ago

hi are there any suggestions ?

StaticNonautomatic commented 1 year ago

I have the very same problem. Cannot figure out what's missing...

omkar806 commented 1 year ago

Hey so sorry I resolved this issue by running this command : export PATH=~/.cargo/bin:$PATH

omkar806 commented 1 year ago

Closing this issue now

str4d commented 7 months ago

I've encountered the same issue. I believe that my last working configuration was macOS 13.6 with XCode 15.1; in the last few weeks I upgraded to macOS 14.2 and XCode 15.2 (I upgraded a few weeks ago, but this is the first time I've tried to cross-compile since then). I have XCode installed via the App Store, and Rust 1.75 installed via rustup.

The native target aarch64-apple-darwin compiles fine. All of the following cross-compile targets are installed and rustup says they are available, but none of them work.

As the previous comment suggested, running PATH=~/.cargo/bin:$PATH cargo check --target TARGET fixes the issue. Looking at my PATH variable from the Terminal app (Terminal version 2.14 (452), zsh 5.9 (x86_64-apple-darwin23.0)), I see that it does contain the cargo directory, but at the end of PATH:

% echo $PATH
/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS:/opt/homebrew/opt/python@3.9/libexec/bin:/Users/str4d/go/bin:/Users/str4d/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/str4d/.cargo/bin

Also interestingly, if I use a different shell (specifically Warp v0.2024.01.16.16.31.stable_01), cross-compilation still works fine, even though it shows the same PATH with the cargo folder at the end. EDIT: Nope, the shell just auto-completed the native target instead of the cross-compile one. This shell also needs the cargo folder to be at the front of PATH.

So my hypothesis is that during the upgrade from macOS 13.6 to macOS 14.2, whatever setting rustup configured to add itself to the PATH (when I installed Rust last year) breaks in the upgraded zsh version.