如何在ESP32项目中加入libcurl

发布于 2025-02-01 03:24:24 字数 3563 浏览 3 评论 0 原文

我的问题基本上是标题。

我的ESP32项目(我认为重要部分)的目录结构如下:

目录
.VSCODE
组件 curl
ESP32-Wifi-Manager
构建
Main Cmakelists.txt
Main.C
.gitignore
cmakelists.txt
sdkconfig
sdkconfig.old

我为包括libcurl所做的步骤是这些:

  1. git clone https://github.com/curl/curl/curl.git (进入组件文件夹)
  2. ,然后将2个文件移至curl目录
    -lib/curl_config.h
    -component.mk

请参阅 htttps://github.com.com /nkolban/esp32-snippets/tree/master/curl/build_files 或在相关视频中 https://www.youtube.com/watch? = tp4oc_kgmgu& t = 603s

我注意到的唯一差异是控制台和我们用来构建的命令。

我们使用“ ESP-IDF 4.4 CMD”和命令“ IDF.PY构建”。

这是控制台中的输出。


Executing action: all (aliases: build)  
Running ninja in directory c:\users\name\desktop\project\mainproject\build  
Executing "ninja all"...  
[0/1] Re-running CMake...  
-- ccache will be used for faster recompilation  
-- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.  
-- Building ESP-IDF components for target esp32s2
CMake Error at C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/component.cmake:219 (message):
  CMake Warning (dev) at build_properties.temp.cmake:7:

    Syntax Warning in cmake code at column 51



    Argument not separated from preceding token by whitespace.

  Call Stack (most recent call first):

    C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/scripts/component_get_requirements.cmake:3 (include)

  This warning is for project developers.  Use -Wno-dev to suppress it.



  fatal: not a git repository (or any of the parent directories): .git

  CMake Error at
  C:/Users/name/Desktop/project/mainproject/components/curl/CMakeLists.txt:43
  (include):
 
    include could not find requested file:



      Utilities

  Call Stack (most recent call first):

    C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/scripts/component_get_requirements.cmake:106 (include)
    C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/scripts/component_get_requirements.cmake:124 (__component_get_requirements)





Call Stack (most recent call first):
  C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/build.cmake:491 (__component_get_requirements)
  C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/project.cmake:378 (idf_build_process)
  CMakeLists.txt:6 (project)


-- Configuring incomplete, errors occurred!

在cmakelists.txt中,组件/卷曲/包含行似乎不起作用(例如实用程序)。
如果我们尝试一个绝对路径,而不是$ {cmake_current_source_dir}(请参见下方)稍后在“ project(curl c)”行中的错误。然后,错误说:“项目命令不可脚本可供脚本”。

cmake_minimum_required(VERSION 3.2...3.16 FATAL_ERROR)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
include(Utilities)
include(Macros)
include(CMakeDependentOption)
include(CheckCCompilerFlag)

project(CURL C)

My question is basically in the title.

My directory structure of our esp32 project (the important parts i think) is as followed:

Directory
.vscode
components curl
esp32-wifi-manager
build
main CMakeLists.txt
main.c
.gitignore
CMakeLists.txt
sdkconfig
sdkconfig.old

The steps that i did to include libcurl were these:

  1. git clone https://github.com/curl/curl.git (into the components folder)
  2. And then moved 2 files into the curl directory
    -lib/curl_config.h
    -component.mk

See instructions and files at https://github.com/nkolban/esp32-snippets/tree/master/curl/build_files
or at the related video https://www.youtube.com/watch?v=tp4OC_kGMgU&t=603s .

The only diffrence that I noticed would be the console and the commands that we use to build.

We use "ESP-IDF 4.4 CMD" and the command "idf.py build".

This is the output in the console.


Executing action: all (aliases: build)  
Running ninja in directory c:\users\name\desktop\project\mainproject\build  
Executing "ninja all"...  
[0/1] Re-running CMake...  
-- ccache will be used for faster recompilation  
-- Project is not inside a git repository, or git repository has no commits; will not use 'git describe' to determine PROJECT_VER.  
-- Building ESP-IDF components for target esp32s2
CMake Error at C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/component.cmake:219 (message):
  CMake Warning (dev) at build_properties.temp.cmake:7:

    Syntax Warning in cmake code at column 51



    Argument not separated from preceding token by whitespace.

  Call Stack (most recent call first):

    C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/scripts/component_get_requirements.cmake:3 (include)

  This warning is for project developers.  Use -Wno-dev to suppress it.



  fatal: not a git repository (or any of the parent directories): .git

  CMake Error at
  C:/Users/name/Desktop/project/mainproject/components/curl/CMakeLists.txt:43
  (include):
 
    include could not find requested file:



      Utilities

  Call Stack (most recent call first):

    C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/scripts/component_get_requirements.cmake:106 (include)
    C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/scripts/component_get_requirements.cmake:124 (__component_get_requirements)





Call Stack (most recent call first):
  C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/build.cmake:491 (__component_get_requirements)
  C:/Espressif/frameworks/esp-idf-v4.4.1/tools/cmake/project.cmake:378 (idf_build_process)
  CMakeLists.txt:6 (project)


-- Configuring incomplete, errors occurred!

In CMakeLists.txt in components/curl/ the include lines dont seem to work (e.g. Utilities).
If we try an absolute path instead of ${CMAKE_CURRENT_SOURCE_DIR} (see beneath) an error accurs later in the line "project(CURL C)". Then the error says: "project command is not scriptable".

cmake_minimum_required(VERSION 3.2...3.16 FATAL_ERROR)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
include(Utilities)
include(Macros)
include(CMakeDependentOption)
include(CheckCCompilerFlag)

project(CURL C)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文