VisualGDB中使用LVGL托管组件无法离线编译的问题求助
离线编译VisualGDB中托管LVGL组件的解决方案
问题说明
在VisualGDB中使用托管组件LVGL时,仅能在联网状态下完成编译,离线时会触发如下错误:
ERROR: Cannot establish a connection to the component registry. Are you connected to the internet?
失败构建日志
Removing c:\projects\PowerBridge/build/VisualGDB/Debug... Reconfiguring project due to missing Makefile... Running CMake: C:\Users\admin\AppData\Local\VisualGDB\CMake\bin\cmake.exe ../../.. -G "Ninja" -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_MAKE_PROGRAM=C:/SysGCC/esp32/tools/ninja/1.10.2/ninja.exe -DESP_PLATFORM=1 -DCCACHE_ENABLE=0 -DIDF_TARGET=esp32 -- Found Git: C:/Program Files/Git/bin/git.exe (found version "2.41.0.windows.3") -- The C compiler identification is GNU 12.2.0 -- The CXX compiler identification is GNU 12.2.0 -- The ASM compiler identification is GNU -- Found assembler: C:/SysGCC/esp32/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/SysGCC/esp32/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/SysGCC/esp32/tools/xtensa-esp32-elf/esp-12.2.0_20230208/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- 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 esp32 -- Checking Python dependencies... Python requirements are satisfied. C:\SysGCC\esp32\esp-idf\v5.1\tools\check_python_dependencies.py:12: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html import pkg_resources Constraint file: C:\Users\admin\.espressif\espidf.constraints.v5.1.txt Requirement files: - C:\SysGCC\esp32\esp-idf\v5.1\tools\requirements\requirements.core.txt Python being checked: C:\Users\admin\.espressif\python_env\\idf5.1_py3.8_env\Scripts\python.exe -- Configuring incomplete, errors occurred! CMake Error at C:/SysGCC/esp32/esp-idf/v5.1/tools/cmake/build.cmake:540 (message): ERROR: Cannot establish a connection to the component registry. Are you connected to the internet? Call Stack (most recent call first): C:/SysGCC/esp32/esp-idf/v5.1/tools/cmake/project.cmake:548 (idf_build_process) CMakeLists.txt:4 (project) See also "C:/projects/PowerBridge/build/VisualGDB/Debug/CMakeFiles/CMakeOutput.log". Run "C:\SysGCC\esp32\tools\ninja\1.10.2\ninja.exe " in directory "c:\projects\PowerBridge/build/VisualGDB/Debug" on local computer C:\SysGCC\esp32\tools\ninja\1.10.2\ninja.exe ninja: error: loading 'build.ninja': The system cannot find the file specified. ------------------------------------------------------------- Command exited with code 1 Executable: C:\SysGCC\esp32\tools\ninja\1.10.2\ninja.exe Arguments: Directory: c:\projects\PowerBridge/build/VisualGDB/Debug Command-line action failed ========== Project Rebuild Summary ========== EmbeddedProject1 rebuilt in 00:05 ========== Rebuild: 0 Succeeded, 1 Failed, 0 Skipped ==========
成功构建日志(联网状态)
Run "C:\SysGCC\esp32\tools\ninja\1.10.2\ninja.exe " in directory "c:\projects\PowerBridge/build/VisualGDB/Debug" on local computer C:\SysGCC\esp32\tools\ninja\1.10.2\ninja.exe [1/9] Performing build step for 'bootloader' [1/1] cmd.exe /C "cd /D C:\projects\PowerBridge\build\VisualGDB\Debug\bootloader\esp-idf\esptool_py && python C:/SysGCC/esp32/esp-idf/v5.1/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 C:/projects/PowerBridge/build/VisualGDB/Debug/bootloader/bootloader.bin" Bootloader binary size 0x6820 bytes. 0x7e0 bytes (7%) free. [2/7] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/lvgl_demo_ui.c.obj [3/7] Linking C static library esp-idf\main\libmain.a [4/7] Generating ld/sections.ld [5/7] Linking CXX executable PowerBridge.elf [6/7] Generating binary image from built executable esptool.py v4.7.dev1 Creating esp32 image... Merged 2 ELF sections Successfully created esp32 image. Generated C:/projects/PowerBridge/build/VisualGDB/Debug/PowerBridge.bin [7/7] cmd.exe /C "cd /D C:\projects\PowerBridge\build\VisualGDB\Debug\esp-idf\esptool_py && python C:/SysGCC/esp32/esp-idf/v5.1/components/partition_table/check_sizes.py --offset 0x8000 partition --type app C:/projects/PowerBridge/build/VisualGDB/Debug/partition_table/partition-table.bin C:/projects/PowerBridge/build/VisualGDB/Debug/PowerBridge.bin" PowerBridge.bin binary size 0x82fa0 bytes. Smallest app partition is 0x100000 bytes. 0x7d060 bytes (49%) free. ------------------- Memory utilization report ------------------- Used DATA_FLASH: 188KB out of 8192KB (2%) Used INSTR_FLASH: 271KB out of 3264KB (8%) Used INSTR_RAM: 55KB out of 128KB (43%) Used DATA_RAM: 44KB out of 320KB (13%) Used Unknown: 24 bytes ========== Project Build Summary ========== EmbeddedProject1 built in 00:07 ========== Build: 1 Succeeded, 0 Failed, 0 Skipped ==========
解决方案
- 禁用组件注册表检查:在CMake配置中添加参数
-DCOMPONENT_REGISTRY_DISABLE=1,或在项目根目录的CMakeLists.txt中添加set(COMPONENT_REGISTRY_DISABLE ON),阻止构建时尝试连接远程组件注册表。 - 本地化LVGL组件:联网状态下完成一次完整编译,确保LVGL组件已下载到本地缓存(路径通常为
C:\Users\admin\.espressif\components)。将缓存中的LVGL相关文件夹复制到项目本地的components目录下,让CMake直接从本地读取组件。 - 配置VisualGDB组件源:打开VisualGDB的组件管理器,将LVGL组件的来源切换为“本地目录”,指向项目内的LVGL组件文件夹,关闭“自动更新”选项,避免触发远程拉取。
- 验证离线编译:断开网络,删除项目的
build目录,重新执行CMake配置和编译,确认不再出现网络连接错误。
内容的提问来源于stack exchange,提问作者Doug Sisco
相关产品推荐
相关产品推荐

