Page 1 of 1

请教一个cmakelist.txt 编辑问题

Posted: Sun Mar 07, 2021 2:57 pm
by ahtrunuw
尝试把helloworld的函数独立写一个components出来但是遇到以下问题
  1. $ cmake
  2. -- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.30.0.windows.2")
  3. -- The C compiler identification is GNU 8.4.0
  4. -- The CXX compiler identification is GNU 8.4.0
  5. -- The ASM compiler identification is GNU
  6. -- Found assembler: G:/work/esp/esp32/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
  7. -- Check for working C compiler: G:/work/esp/esp32/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe
  8. -- Check for working C compiler: G:/work/esp/esp32/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe -- works
  9. -- Detecting C compiler ABI info
  10. -- Detecting C compiler ABI info - done
  11. -- Detecting C compile features
  12. -- Detecting C compile features - done
  13. -- Check for working CXX compiler: G:/work/esp/esp32/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe
  14. -- Check for working CXX compiler: G:/work/esp/esp32/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe -- works
  15. -- Detecting CXX compiler ABI info
  16. -- Detecting CXX compiler ABI info - done
  17. -- Detecting CXX compile features
  18. -- Detecting CXX compile features - done
  19. -- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.
  20. -- Building ESP-IDF components for target esp32
  21. -- Checking Python dependencies...
  22. Python requirements from g:\work\esp\esp32\esp-idf\requirements.txt are satisfied.
  23. CMake Error at G:/work/esp/esp32/esp-idf/tools/cmake/build.cmake:191 (message):
  24.  Failed to resolve component 'esp_spi_flash'.
  25. Call Stack (most recent call first):
  26.   G:/work/esp/esp32/esp-idf/tools/cmake/build.cmake:217 (__build_resolve_and_add_req)
  27.   G:/work/esp/esp32/esp-idf/tools/cmake/build.cmake:437 (__build_expand_requirements)
  28.   G:/work/esp/esp32/esp-idf/tools/cmake/project.cmake:396 (idf_build_process)
  29.   CMakeLists.txt:6 (project)
红字部分应该如下解决 已经在REQUIRES添加 hi里面cmakelist如下
idf_component_register(SRCS "hi.c"
INCLUDE_DIRS "."
REQUIRES esp_spi_flash
)


main 里面cmakelist 如下
idf_component_register(SRCS "hello_world_main.c"
INCLUDE_DIRS "")


  1. C:.
  2. │  CMakeLists.txt
  3. │  example_test.py
  4. │  Makefile
  5. │  README.md
  6. │  sdkconfig
  7. ├─.vscode
  8. │      c_cpp_properties.json
  9. │      launch.json
  10. │      settings.json
  11. │      tasks.json
  12. ├─components
  13. │  └─hi
  14. │          CMakeLists.txt
  15. │          hi.c
  16. │          hi.h
  17. └─main
  18.         CMakeLists.txt
  19.         component.mk
  20.         hello_world_main.c

Re: 请教一个cmakelist.txt 编辑问题

Posted: Thu Mar 18, 2021 9:39 am
by ESP_Gargamel
红色部分已解决的话,还有什么问题?方便的话,可以提供一个示例工程来分析解决。