Setting Target esp32s2 Fails

Posts: 2278
Joined: Sun May 08, 2016 4:11 am

Re: Setting Target esp32s2 Fails

Postby ESP_Angus » Tue Jan 19, 2021 10:44 pm

Hi Mark,

Thanks for bearing with us. It seems like the Windows environment variable IDF_TARGET is being set to "esp32" somewhere. We don't have any explanation for why this has happened, though. Setting this environment variable is not required to use ESP-IDF, but it is optional to automatically override the selected target (which is why you keep getting these errors - there's a conflict between the "overridden" value in the environment variable and the target you're asking to build).
  • If you open a clean cmd window and then immediately run "echo %IDF_TARGET%" (before running export.bat or anything else), do you still see esp32?
  • If you "edit system environment variables" and check the list of environment variables for both the system and your user (both lists are in the same window), then do you see IDF_TARGET in the list anywhere? If it's there, please delete it.
  • If that doesn't lead anywhere, could you please post the output of " version" (after running export.bat)?
Thanks again for your patience.

Posts: 16
Joined: Thu Dec 31, 2020 3:34 am

Re: Setting Target esp32s2 Fails

Postby markjuggles » Sat Jan 23, 2021 10:27 pm

When I echo %IDF_TARGET% in a clean CMD window, it does report esp32. I'm pretty sure that I didn't set that myself but it was easy to fix.

After changing the environment through Windows "Advanced System Settings", closing the old CMD window, and opening another, project building works as documented without having to change the IDF_TARGET variable.

Everything seems to be pretty good now.

Thank you Angus!

Posts: 2
Joined: Fri Feb 19, 2021 4:54 pm

Re: Setting Target esp32s2 Fails

Postby kaitlinburke » Fri Feb 19, 2021 5:21 pm

I'm running into this same issue on MacOS and haven't been able to solve it. I can't set the target to esp32. I get the same error message:

Code: Select all

e0499421@USATLWCF5M3LVDL blink % set-target esp32s2
Adding "set-target"'s dependency "fullclean" to list of commands with default set of options.
Executing action: fullclean
Executing action: set-target
Set Target to: esp32s2, new sdkconfig created. Existing sdkconfig renamed to sdkconfig.old.
Running cmake in directory /Users/e0499421/Desktop/blink/build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 -DIDF_TARGET=esp32s2 -DCCACHE_ENABLE=0 /Users/e0499421/Desktop/blink"...
-- Found Git: /usr/bin/git (found version "2.24.3 (Apple Git-128)") 
CMake Error at /Users/e0499421/esp/esp-idf/tools/cmake/targets.cmake:19 (message):
  IDF_TARGET in CMake cache does not match IDF_TARGET environment variable.
  To change the target, clear the build directory and sdkconfig file, and
  build the project again
Call Stack (most recent call first):
  /Users/e0499421/esp/esp-idf/tools/cmake/project.cmake:34 (__target_init)
  CMakeLists.txt:5 (include)

-- Configuring incomplete, errors occurred!
cmake failed with exit code 1
What do I need to change to avoid this error? I've tried following the steps in this thread, but they don't seem to change anything.

Posts: 4396
Joined: Thu Nov 26, 2015 4:08 am

Re: Setting Target esp32s2 Fails

Postby ESP_Sprite » Sat Feb 20, 2021 1:44 am

Possibly your IDF_TARGET variable is set to something. Can you do an 'echo $IDF_TARGET' and post what it says?

Who is online

Users browsing this forum: No registered users and 66 guests