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

menuconfig fail on idf 4.0 #8

Closed
F99 opened this issue Jun 8, 2020 · 9 comments · Fixed by #10
Closed

menuconfig fail on idf 4.0 #8

F99 opened this issue Jun 8, 2020 · 9 comments · Fixed by #10

Comments

@F99
Copy link

F99 commented Jun 8, 2020

In order to make the lib on IDF 4.0.1, I cloned this branch, but got errors:


CMake Error at C:/Users/F70/000-KL/FarmControlRoom/ESP_IDF_401/tools/cmake/component.cmake:280 (foreach):
  Syntax error in cmake code at

    C:/Users/F70/000-KL/FarmControlRoom/ESP_IDF_401/tools/cmake/component.cmake:280

  when parsing string

    C:/Users/F70/000-KL/FarmControlRoom/ESP32_TFT_library/main;C:\Users\F70\000-KL\FarmControlRoom\ESP_IDF_401/components

  Invalid character escape '\U'.
Call Stack (most recent call first):
  C:/Users/F70/000-KL/FarmControlRoom/ESP_IDF_401/tools/cmake/component.cmake:447 (__component_add_include_dirs)
  main/CMakeLists.txt:2 (idf_component_register)


-- Configuring incomplete, errors occurred!
See also "C:/Users/F70/000-KL/FarmControlRoom/ESP32_TFT_library/build/CMakeFiles/CMakeOutput.log".
cmake failed with exit code 1

not sure where to go from here.
Log for reference.
I've recently moved from IDF 3.3 to 4.0.1. On 3.3 I've built the master branch sucessfully with the demo app. I am not too deep into the build mechanics and git yet, accepting recommendations. system: win7
Regards, F99
CMakeOutput.log

@jeremyjh
Copy link
Owner

jeremyjh commented Jun 8, 2020

You are getting an error on a file that is part of IDF, not even getting to the code in this repo. Can you build the samples that come with IDF 4.0.1 ?

@F99
Copy link
Author

F99 commented Jun 8, 2020

Yes, I checked that first with the hello_world example. Also, I use esp-adf (on top of esp-idf) and the play_mp3 sample worked as well. If you want me to do more testing, I'll do that.
Thanks for your quick response!
--> at the moment my best guess is, I did something non-standard with the paths, on the other hand, it's about idf_component_register in main/CMakeLists.txt
Here, you have "$ENV{IDF_PATH}/components" , which possibly somehow expands to
C:/Users/F70/000-KL/FarmControlRoom/ESP32_TFT_library/main;C:\Users\F70\000-KL\FarmControlRoom\ESP_IDF_401/components
which contains the '\U' as part of 'C:\Users'
which in turn mixed up two different directory naming styles that seemingly can't work together in the make context. Really, I don't know how to resolve the Issue, please advise.

I paste the terminal output before the error here for reference:

C:\Users\F70\000-KL\FarmControlRoom\ESP32_TFT_library>idf.py menuconfig
Checking Python dependencies...
Python requirements from C:\Users\F70\000-KL\FarmControlRoom\ESP_IDF_401\requirements.txt are satisfied.
Executing action: menuconfig
Running cmake in directory c:\users\f70\000-kl\farmcontrolroom\esp32_tft_library\build
Executing "cmake -G Ninja -DPYTHON_DEPS_CHECKED=1 -DESP_PLATFORM=1 --warn-uninitialized -DWARN_UNINITIALIZED=1 -DCCACHE_ENABLE=1 c:\users\f70\000-kl\farmcontrol
room\esp32_tft_library"...
Warn about uninitialized values.
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.21.0.windows.1")
-- mconf-idf version mconf-v4.6.0.0-idf-20190628-win32
-- IDF_TARGET not set, using default target: esp32
-- ccache will be used for faster recompilation
-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/Users/F70/000-KL/FarmControlRoom/ESP_IDF_TOOLS/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
-- Check for working C compiler: C:/Users/F70/000-KL/FarmControlRoom/ESP_IDF_TOOLS/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf
-gcc.exe
-- Check for working C compiler: C:/Users/F70/000-KL/FarmControlRoom/ESP_IDF_TOOLS/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf
-gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Users/F70/000-KL/FarmControlRoom/ESP_IDF_TOOLS/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-e
lf-g++.exe
-- Check for working CXX compiler: C:/Users/F70/000-KL/FarmControlRoom/ESP_IDF_TOOLS/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-e
lf-g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Project version: a06a578
-- Building ESP-IDF components for target esp32
Loading defaults file C:/Users/F70/000-KL/FarmControlRoom/ESP32_TFT_library/sdkconfig.defaults...
C:/Users/F70/000-KL/FarmControlRoom/ESP32_TFT_library/sdkconfig.defaults:9 CONFIG_MAIN_TASK_STACK_SIZE was replaced with CONFIG_ESP_MAIN_TASK_STACK_SIZE
C:/Users/F70/000-KL/FarmControlRoom/ESP32_TFT_library/sdkconfig.defaults:10 CONFIG_TASK_WDT_TIMEOUT_S was replaced with CONFIG_ESP_TASK_WDT_TIMEOUT_S
-- Found PythonInterp: C:/Users/F70/000-KL/FarmControlRoom/ESP_IDF_TOOLS/python_env/idf4.0_py3.7_env/Scripts/python.exe (found version "3.7.3")
-- Could NOT find Perl (missing: PERL_EXECUTABLE)
-- Adding linker script C:/Users/F70/000-KL/FarmControlRoom/ESP32_TFT_library/build/esp-idf/esp32/esp32_out.ld
-- Adding linker script C:/Users/F70/000-KL/FarmControlRoom/ESP_IDF_401/components/esp32/ld/esp32.project.ld.in
-- Adding linker script C:/Users/F70/000-KL/FarmControlRoom/ESP_IDF_401/components/esp32/ld/esp32.peripherals.ld
-- Adding linker script C:/Users/F70/000-KL/FarmControlRoom/ESP_IDF_401/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script C:/Users/F70/000-KL/FarmControlRoom/ESP_IDF_401/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script C:/Users/F70/000-KL/FarmControlRoom/ESP_IDF_401/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script C:/Users/F70/000-KL/FarmControlRoom/ESP_IDF_401/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script C:/Users/F70/000-KL/FarmControlRoom/ESP_IDF_401/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
CMake Error at C:/Users/F70/000-KL/FarmControlRoom/ESP_IDF_401/tools/cmake/component.cmake:280 (foreach):

@F99
Copy link
Author

F99 commented Jun 8, 2020

Seems they have or had the problem elsewhere:
espressif/esp-idf#4658
Now still unsure, what to do ;)

@LeandroTE
Copy link

Hello F99, did you manage to compile the code with IDF 4.0.1? I am trying to compile the code but with no sucess, I kwon the have something to do with the CMakelist.txt, bucause there is a project which is based on the same project of this one which compile and the only difference is that all the code is in the main folder, not in the component folder

@jeremyjh
Copy link
Owner

jeremyjh commented Jun 15, 2020

@LeandroTE are you also on Windows? I haven't tried to compile on Windows.

@F99
Copy link
Author

F99 commented Jun 15, 2020

It's probably a bug within esp-idf but requires component.cmake to be invoked, as indicated by the link above.

@LeandroTE
Copy link

@jeremyjh yes I am on windows, and I manage to compile, just I replaced the CMakelist.txt under main folder with the following and compiled fine:

set(COMPONENT_SRCDIRS ".")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()

I think Windows have a problem with the path of the varible to send to idf, but with the CMakelist above it works, thank you very much for your support!!

@jeremyjh
Copy link
Owner

jeremyjh commented Jun 16, 2020

@LeandroTE I wonder if the problem is this line $ENV{IDF_PATH}/components

Can you try building with this in your main\CmakeList.txt?

set(SOURCES tft_demo.c)
idf_component_register(
        SRCS ${SOURCES}
        INCLUDE_DIRS
          ${CMAKE_CURRENT_LIST_DIR}
          $ENV{IDF_PATH}\components
        REQUIRES
            tft
            spiffs

Hard coding the path separator like that can be a compatibility problem for windows. Windows will accept slashes, but I think the IDF_PATH must be using back slashes because we see the combined path like this C:\Users\F70\000-KL\FarmControlRoom\ESP_IDF_401/components

That might be a problem to have both back and forward slashes? I can't readily test on windows unfortunately.

I'm not sure what the best fix would be, we might have to have check if $ENV{IDF_PATH} contains back slashes and then append the path with a backslash instead of slash.

@projectgus
Copy link

projectgus commented Jun 24, 2020

Hi @jeremyjh & @F99,

Came here from the linked ESP-IDF issue.

There a couple of things going on here:

CMake always uses "CMake paths" internally which use / as the delimiter, there are functions to convert "platform paths" to "CMake Paths". CMake also supports backslash-escaping in strings, which is why it chokes on Windows-style paths sometimes.

This means that $ENV{IDF_PATH} here won't work. A quick fix is:

idf_build_get_property(idf_path IDF_PATH)

idf_component_register( ... ${idf_path}/components ...)

... because the build property has already been converted into a CMake path.

However, it shouldn't necessary to pass an absolute path to an include directory like this. That itself looks to me like a "quick fix" so that it's possible to have #include "nvs_flash/include/nvs_flash.h". The ESP-IDF build system has a requirements system which is designed to avoid the need for this kind of hack.

See the linked PR for the fix (it was easier to make it and verify everything builds OK than to guess this was it.)

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

Successfully merging a pull request may close this issue.

4 participants