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

Target not found issue in mac. #228

Closed
yashwanthsinghm opened this issue Jul 27, 2023 · 21 comments
Closed

Target not found issue in mac. #228

yashwanthsinghm opened this issue Jul 27, 2023 · 21 comments

Comments

@yashwanthsinghm
Copy link

Hi I'm trying to compile code esp32 in rust on Mac
I have installed espup on machine by following commands, I have used the following commands.

  1. git clone https://github.com/esp-rs/espup
  2. cargo install espup
  3. espup install
  4. chmod a+x $HOME/export-esp.sh
  5. $HOME/export-esp.sh
  6. espup install -t all

I’m trying to compile example esp32 code I’m getting the following error.

how to add target?

 error: failed to run `rustc` to learn about target-specific information
Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -C link-arg=-Tlinkall.x -C link-arg=-Trom_functions.x --target xtensa-esp32-none-elf --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 1)
  --- stderr
  error: Error loading target specification: Could not find specification for target "xtensa-esp32-none-elf". Run `rustc --print target-list` for a list of built-in targets 
@SergioGasquez
Copy link
Member

Hi! Do you mind sharing where did you find those instructions and which project are you trying to build? I would suggest following these instructions and then generating a project from a template

@yashwanthsinghm
Copy link
Author

Hi, i got my instructions from here https://github.com/esp-rs/espup and i'm trying to compile this project in mac : https://github.com/esp-rs/esp-hal/tree/main/esp32-hal.

@SergioGasquez
Copy link
Member

SergioGasquez commented Jul 27, 2023

Try following my suggestions and have a look at https://esp-rs.github.io/book/troubleshooting/index.html#using-the-wrong-rust-toolchain

@yashwanthsinghm
Copy link
Author

Thank you i will follow this and see.

@SergioGasquez
Copy link
Member

Let me know how it goes!

@yashwanthsinghm
Copy link
Author

yashwanthsinghm commented Jul 27, 2023

I have added $HOME/export-esp.sh into .bashrc and .profile & .bashrc and sourced them, the restarted the terminal. Still i'm getting the same error. This issue I'm facing only in mac, in linux its working fine i was able to build the project etc.

I have attached my .profile

Screenshot 2023-07-27 at 5 02 12 PM

Also i'm getting these error too.

error: Package test v0.0.0 (/Users/yashwanthsingh/.rustup/toolchains/esp/lib/rustlib/src/rust/library/test) does not have the feature backtrace

@SergioGasquez
Copy link
Member

It looks like it's something wrong in your Mac environment. Can you share the exact commands that I would need to do to reproduce this?

@yashwanthsinghm
Copy link
Author

cat $HOME/export-esp.sh >> ~/.profile
vim .profile
source ~/.profile

same goes for bashrc too

@SergioGasquez
Copy link
Member

cat $HOME/export-esp.sh >> ~/.profile vim .profile source ~/.profile

same goes for bashrc too

Please, share all the instructions, including how do you install the environment, and how do you build the project that you are trying to build.

Have you tried overriding the toolchain (cargo +esp build)?

@SergioGasquez
Copy link
Member

Hi, I will be closing the issue as it's inactive, feel free to reopen if the issue persists

@Bulalu
Copy link

Bulalu commented Feb 29, 2024

i'm getting the same error and I'm also on mac

i basically followed everything here
https://esp-rs.github.io/book/installation/riscv-and-xtensa.html

@SergioGasquez
Copy link
Member

Please, share all the instructions, including how do you install the environment, and how do you build the project that you are trying to build.

Looks like your not using the proper toolchain. Please, share all the instructions, including how do you install the environment, and how do you build the project that you are trying to build.

@Bulalu
Copy link

Bulalu commented Mar 4, 2024

suree
here's how i install the environment
cargo install espup
espup install
cargo install ldproxy
. $HOME/export-esp.sh

cargo install cargo-generate

then i create a project from the templates
cargo generate esp-rs/esp-template

i choose the esp32 one, then on doing cargo-build i get this error

Screenshot 2024-03-04 at 00 13 37

@SergioGasquez
Copy link
Member

What happens if you do: cargo +esp build?

@Bulalu
Copy link

Bulalu commented Mar 4, 2024

i get this

@Bulalu
Copy link

Bulalu commented Mar 4, 2024

Screenshot 2024-03-04 at 13 46 21

@SergioGasquez
Copy link
Member

Please, run the following: rustc +esp --print target-list | grep xtensa and also, are you sourcing the . $HOME/export-esp.sh file in this terminal?

@Bulalu
Copy link

Bulalu commented Mar 4, 2024

yes i am
Screenshot 2024-03-04 at 13 59 06

@Bulalu
Copy link

Bulalu commented Mar 4, 2024

but with with this i seem to be getting the output
Screenshot 2024-03-04 at 14 01 24

@SergioGasquez
Copy link
Member

The fact that you cant override channels with + <channel> looks very werid to me. You should be able to use rustc +esp --print target-list | grep xtensa and `cargo +:

~
❯ cargo +esp --version
cargo 1.76.0-nightly (c84b36747 2024-01-18)

~
❯ rustc +esp --print target-list | grep xtensa
xtensa-esp32-espidf
xtensa-esp32-none-elf
xtensa-esp32s2-espidf
xtensa-esp32s2-none-elf
xtensa-esp32s3-espidf
xtensa-esp32s3-none-elf
xtensa-esp8266-none-elf

Maybe something is wrong with your Rust installation? Did you installed it using https://www.rust-lang.org/tools/install or using a pacakge manager?

@Bulalu
Copy link

Bulalu commented Mar 4, 2024

ahh yeah found the little devil, it was indeed how i installed rust on my machine, i used homebrew before so i had to uninstall that and install from the rust site and seemed to solve everything.

thank you so much man 🫡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants