Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Unrecognized command line option '--target=xtensa-esp32-espidf' #129

Closed
3d-t opened this issue Nov 18, 2022 · 9 comments
Closed

Unrecognized command line option '--target=xtensa-esp32-espidf' #129

3d-t opened this issue Nov 18, 2022 · 9 comments

Comments

@3d-t
Copy link
Contributor

3d-t commented Nov 18, 2022

When I run 'cargo build' on MacBook pro with Big Sur 11.7 I get the following error:

xtensa-esp32-elf-gcc: error: unrecognized command line option '--target=xtensa-esp32-espidf'
ninja: build stopped: subcommand failed.

@ivmarkov
Copy link
Owner

As a workaround, unset CC=clang from your environment.

@ivmarkov ivmarkov pinned this issue Nov 18, 2022
@3d-t
Copy link
Contributor Author

3d-t commented Nov 18, 2022

Thanks for your quick reply but 'unset CC' did not solve the issue:

Compiling async-net v1.7.0
Compiling async-fs v1.6.0
Compiling uncased v0.9.7
error: failed to run custom build command for esp-idf-sys v0.31.11

Caused by:

  xtensa-esp32-elf-g++: error: unrecognized command-line option '--target=xtensa-esp32-espidf'
  ninja: build stopped: subcommand failed.

@ivmarkov
Copy link
Owner

ivmarkov commented Nov 18, 2022

I'm relatively sure that's the reason. Maybe it is not (only) the CC env variable but some additional ones. Coincidentally, we had another user complaining about this just yesterday and for him it worked by unsetting CC (and maybe a few others).

Can you go to the ESP-RS Matrix chat and search for the relevant messages?

The background of this issue, is that esp-idf-sys internally builds ESP IDF itself, and for that, it must use the xtensa GCC toolchain. However, if the CC env var (and maybe a few others) are set to "clang", CMake (which drives the ESP IDF build) mistakenly assumes that the xtensa GCC compiler is clang (while it is not!) and passes to it the invalid --target option.

@ivmarkov
Copy link
Owner

Yeah, a proper fix might be that we are ourselves unsetting these vars during the esp-idf-sys build somehow, but in the meantime, user unsetting those should help.

@ivmarkov
Copy link
Owner

Here's the relevant message from the forum:
I figured it out 🎉 CXX and CC env variables where confusing cmake, it checked those for default flags and thought it was using clang, not gcc, when I cleared them things worked

@ivmarkov
Copy link
Owner

Ping?

@3d-t
Copy link
Contributor Author

3d-t commented Nov 20, 2022

Thanks for your replies. After unsetting both CXX and CC it now proceeds but there is another error:

Tool doesn't match supported version from list ['esp-2022r1-11.2.0']:
[USER]/.espressif/tools/xtensa-esp32-elf-gcc/8_4_0-esp-2021r2-patch3-x86_64-apple-darwin/bin/xtensa-esp32-elf-gcc


Please try to run 'idf.py fullclean' to solve it.

After running 'idf.py fullclean' the same error message.

@3d-t
Copy link
Contributor Author

3d-t commented Nov 20, 2022 via email

@3d-t
Copy link
Contributor Author

3d-t commented Nov 20, 2022 via email

@ivmarkov ivmarkov unpinned this issue Jun 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants