PlatformIO Community

Can not initialize Project for Espressif IoT Dev framework

Initialization of a new project (“a”) in VSCode for ESP32 for Arduino Framework works, but choosing “Espressid IoT Development Framework” stalls. A window opens “Could not initialize project” with a lot of text, essentially saying finally:

Configuring incomplete, errors occurred!
Fatal: no Git repository (or some other parent path until mount point.
GIT_DISCOVERY_ACROSS_FILESYSTEM not set

Searching the net for GIT_DISCOVERY_ACROSS_FILESYSTEM didn’t help me to understand what that means or is for (and where this flag has to be set).
I reinstalled the “Espressif framework” which did’nt change anything.
Looking into CMakeOutput.log did’nt help me either as I found no errors listed.

The mentioned file “.pio/build/featheresp32/CMakeFiles/git-data/grabRef.cmake”
has in lines 47-50:
if(NOT HEAD_HASH)
file(READ “/home/kh/pio-projects/a/.pio/build/featheresp32/CMakeFiles/git-data/head-ref” HEAD_HASH LIMIT 1024)
string(STRIP “${HEAD_HASH}” HEAD_HASH)
endif()

which I unfortunately don’t understand either, but the file
“/home/kh/pio-projects/a/.pio/build/featheresp32/CMakeFiles/git-data/head-ref”
does not exist.

So I’m stuck and thankful for suggestions.
Thanks for your time.

Extract of message in pop up box:
\nSee also “/home/kh/pio-projects/a/.pio/build/featheresp32/CMakeFiles/CMakeOutput.log”.\n\nfatal: Kein Git-Repository (oder irgendein Elternverzeichnis bis zum Einhängepunkt /)\nStoppe bei Dateisystemgrenze (GIT_DISCOVERY_ACROSS_FILESYSTEM nicht gesetzt).\nCMake Error at .pio/build/featheresp32/CMakeFiles/git-data/grabRef.cmake:48 (file):\n file failed to open for reading (No such file or directory):\n\n /home/kh/pio-projects/a/.pio/build/featheresp32/CMakeFiles/git-data/head-ref\nCall Stack (most recent call first):\n

env:
debian 10.8, VSCode 1.54.1, PIO Core 5.1.1a3, Home 3.3.4

Can you open a CLI in VSCode, and post the full output of

cd /home/kh/pio-projects/a
pio run

?

Thanks a lot !

Processing featheresp32 (platform: espressif32; board: featheresp32; framework: espidf)
---------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/featheresp32.html
PLATFORM: Espressif 32 (3.1.0) > Adafruit ESP32 Feather
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-espidf 3.40200.210118 (4.2.0) 
 - tool-cmake 3.16.4 
 - tool-esptoolpy 1.30000.201119 (3.0.0) 
 - tool-ninja 1.7.1 
 - toolchain-esp32ulp 1.22851.191205 (2.28.51) 
 - toolchain-xtensa32 2.80400.210211 (8.4.0)
Reading CMake configuration...
-- 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
-- App "a" version: 1
-- Adding linker script /home/kh/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.newlib-time.ld
-- Adding linker script /home/kh/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /home/kh/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /home/kh/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.newlib-data.ld
-- Adding linker script /home/kh/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.syscalls.ld
-- Adding linker script /home/kh/.platformio/packages/framework-espidf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /home/kh/pio-projects/a/.pio/build/featheresp32/esp-idf/esp32/esp32_out.ld
-- Adding linker script /home/kh/.platformio/packages/framework-espidf/components/esp32/ld/esp32.project.ld.in
-- Adding linker script /home/kh/.platformio/packages/framework-espidf/components/esp32/ld/esp32.peripherals.ld
-- Components: __pio_env app_trace app_update asio bootloader bootloader_support bt cbor coap console cxx driver efuse esp-tls esp32 esp_adc_cal esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_ipc esp_local_ctrl esp_netif esp_ringbuf esp_rom esp_serial_slave_link esp_system esp_timer esp_websocket_client esp_wifi espcoredump esptool_py expat fatfs freemodbus freertos heap idf_test jsmn json libsodium log lwip mbedtls mdns mqtt newlib nghttp nvs_flash openssl partition_table perfmon protobuf-c protocomm pthread sdmmc soc spi_flash spiffs src tcp_transport tcpip_adapter tinyusb ulp unity vfs wear_levelling wifi_provisioning wpa_supplicant xtensa
-- Component paths: /home/kh/pio-projects/a/.pio/build/featheresp32/__pio_env /home/kh/.platformio/packages/framework-espidf/components/app_trace /home/kh/.platformio/packages/framework-espidf/components/app_update /home/kh/.platformio/packages/framework-espidf/components/asio /home/kh/.platformio/packages/framework-espidf/components/bootloader /home/kh/.platformio/packages/framework-espidf/components/bootloader_support /home/kh/.platformio/packages/framework-espidf/components/bt /home/kh/.platformio/packages/framework-espidf/components/cbor /home/kh/.platformio/packages/framework-espidf/components/coap /home/kh/.platformio/packages/framework-espidf/components/console /home/kh/.platformio/packages/framework-espidf/components/cxx /home/kh/.platformio/packages/framework-espidf/components/driver /home/kh/.platformio/packages/framework-espidf/components/efuse /home/kh/.platformio/packages/framework-espidf/components/esp-tls /home/kh/.platformio/packages/framework-espidf/components/esp32 /home/kh/.platformio/packages/framework-espidf/components/esp_adc_cal /home/kh/.platformio/packages/framework-espidf/components/esp_common /home/kh/.platformio/packages/framework-espidf/components/esp_eth /home/kh/.platformio/packages/framework-espidf/components/esp_event /home/kh/.platformio/packages/framework-espidf/components/esp_gdbstub /home/kh/.platformio/packages/framework-espidf/components/esp_hid /home/kh/.platformio/packages/framework-espidf/components/esp_http_client /home/kh/.platformio/packages/framework-espidf/components/esp_http_server /home/kh/.platformio/packages/framework-espidf/components/esp_https_ota /home/kh/.platformio/packages/framework-espidf/components/esp_https_server /home/kh/.platformio/packages/framework-espidf/components/esp_ipc /home/kh/.platformio/packages/framework-espidf/components/esp_local_ctrl /home/kh/.platformio/packages/framework-espidf/components/esp_netif /home/kh/.platformio/packages/framework-espidf/components/esp_ringbuf /home/kh/.platformio/packages/framework-espidf/components/esp_rom /home/kh/.platformio/packages/framework-espidf/components/esp_serial_slave_link /home/kh/.platformio/packages/framework-espidf/components/esp_system /home/kh/.platformio/packages/framework-espidf/components/esp_timer /home/kh/.platformio/packages/framework-espidf/components/esp_websocket_client /home/kh/.platformio/packages/framework-espidf/components/esp_wifi /home/kh/.platformio/packages/framework-espidf/components/espcoredump /home/kh/.platformio/packages/framework-espidf/components/esptool_py /home/kh/.platformio/packages/framework-espidf/components/expat /home/kh/.platformio/packages/framework-espidf/components/fatfs /home/kh/.platformio/packages/framework-espidf/components/freemodbus /home/kh/.platformio/packages/framework-espidf/components/freertos /home/kh/.platformio/packages/framework-espidf/components/heap /home/kh/.platformio/packages/framework-espidf/components/idf_test /home/kh/.platformio/packages/framework-espidf/components/jsmn /home/kh/.platformio/packages/framework-espidf/components/json /home/kh/.platformio/packages/framework-espidf/components/libsodium /home/kh/.platformio/packages/framework-espidf/components/log /home/kh/.platformio/packages/framework-espidf/components/lwip /home/kh/.platformio/packages/framework-espidf/components/mbedtls /home/kh/.platformio/packages/framework-espidf/components/mdns /home/kh/.platformio/packages/framework-espidf/components/mqtt /home/kh/.platformio/packages/framework-espidf/components/newlib /home/kh/.platformio/packages/framework-espidf/components/nghttp /home/kh/.platformio/packages/framework-espidf/components/nvs_flash /home/kh/.platformio/packages/framework-espidf/components/openssl /home/kh/.platformio/packages/framework-espidf/components/partition_table /home/kh/.platformio/packages/framework-espidf/components/perfmon /home/kh/.platformio/packages/framework-espidf/components/protobuf-c /home/kh/.platformio/packages/framework-espidf/components/protocomm /home/kh/.platformio/packages/framework-espidf/components/pthread /home/kh/.platformio/packages/framework-espidf/components/sdmmc /home/kh/.platformio/packages/framework-espidf/components/soc /home/kh/.platformio/packages/framework-espidf/components/spi_flash /home/kh/.platformio/packages/framework-espidf/components/spiffs /home/kh/pio-projects/a/src /home/kh/.platformio/packages/framework-espidf/components/tcp_transport /home/kh/.platformio/packages/framework-espidf/components/tcpip_adapter /home/kh/.platformio/packages/framework-espidf/components/tinyusb /home/kh/.platformio/packages/framework-espidf/components/ulp /home/kh/.platformio/packages/framework-espidf/components/unity /home/kh/.platformio/packages/framework-espidf/components/vfs /home/kh/.platformio/packages/framework-espidf/components/wear_levelling /home/kh/.platformio/packages/framework-espidf/components/wifi_provisioning /home/kh/.platformio/packages/framework-espidf/components/wpa_supplicant /home/kh/.platformio/packages/framework-espidf/components/xtensa
-- Configuring incomplete, errors occurred!
See also "/home/kh/pio-projects/a/.pio/build/featheresp32/CMakeFiles/CMakeOutput.log".

fatal: Kein Git-Repository (oder irgendein Elternverzeichnis bis zum Einhängepunkt /)
Stoppe bei Dateisystemgrenze (GIT_DISCOVERY_ACROSS_FILESYSTEM nicht gesetzt).
CMake Error at .pio/build/featheresp32/CMakeFiles/git-data/grabRef.cmake:48 (file):
  file failed to open for reading (No such file or directory):

    /home/kh/pio-projects/a/.pio/build/featheresp32/CMakeFiles/git-data/head-ref
Call Stack (most recent call first):
  /home/kh/.platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:80 (include)
  /home/kh/.platformio/packages/framework-espidf/tools/cmake/third_party/GetGitRevisionDescription.cmake:90 (get_git_head_revision)
  /home/kh/.platformio/packages/framework-espidf/tools/cmake/project.cmake:48 (git_describe)
  /home/kh/.platformio/packages/framework-espidf/tools/cmake/project.cmake:391 (__project_get_revision)
  CMakeLists.txt:3 (project)

Does the output stay the same if you do rm -rf /home/kh/pio-projects/a/.pio/ and then pio run again?

differs, it now has following new content:

15a16,32

– Found Git: /usr/bin/git (found version “2.20.1”)
– The C compiler identification is GNU 8.4.0
– The CXX compiler identification is GNU 8.4.0
– The ASM compiler identification is GNU
– Found assembler: /home/kh/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc
– Check for working C compiler: /home/kh/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc
– Check for working C compiler: /home/kh/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc – 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: /home/kh/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-g++
– Check for working CXX compiler: /home/kh/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-g++ – works
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Detecting CXX compile features
– Detecting CXX compile features - done
17a35,36
– Found PythonInterp: /home/kh/.platformio/penv/bin/python (found version “3.7.3”)
– Found Perl: /usr/bin/perl (found version “5.28.1”)

Do you have any other extensions installed in VSCode besides PlatformIO and C/C++ by microsoft that could interfere, e.g. ESP-IDF or CMake? Try and disable those if yes.

What is the project structure like? (Screenshot of file explorer in VSCode)

There are few google hits on esp-idf file "failed to open for reading" git-data/head-ref.

A few info I could collect

  • If the project has run git init but there are no commits (therefor no revision) the build will fail will the output below

  • updating has helped before (Could Not Import Project Error while Importing Example Project) but you already seem to be using the latest platform version. You can still try and use the upstream version in the platformio.ini
  • try to import an example project by going to PIO Home -> Platforms -> Espressif 32 -> Examples -> espidf-blink -> Import and try and build that

If neither works, please file an issue in https://github.com/platformio/platform-espressif32/issues.

  1. In VSCode I have installed C/C++ , C/C++ Extension Pack, C++ Intellisense, Platformio IDE and Remote Containers. I uninstalled “Remote Conainers”, which did make a change.
  2. “git init” was not run from the current path “~/pio-projects/a/”, but I made that in a previous attempt within an other attempt to get thinks working. Maybe this was a fault?
  3. I tried the upstream version without success
  4. importing espidf-blink threw the same error again.

As you suggested, I’ll file an issue.

Thank you very much for the kind and quick support.

Screenshot_20210311_145402

find filestructure attached

I don’t see an error in the project structure.

Maybe try a completely different path like creating the project in tmp? (Or create a new project normally, then move the project)

Success !
I did a ‘pio settings set projects_dir ~/tmp’
and both, creating a new project as well as import a sample project into that new dir was possible without error.
Should / can i move the project by simply
mv -r ~/tmp/projectname /home/kh/pio-projects/
??

Hm then it might really be a fault in the ESP-IDF scripts not being able to handle the path or whatver is in the way of that.

Is there a way you can undo what has been done here, by e.g. removing the .git folder(s)?

You can try to, but I think it won’t build anymore (if you pio run -t clean and pio run) when in this path if it has something to do with the git init fault above.

There was a ~/pio-projects/.git/.
After
rm -rf ~/pio-projects/.git/
the problem was solved and projects could be imported and created in ~/pio-projects/ dir without errors

Thanks again @maxgerhardt That was great !

1 Like