Xtensa-esp32-elf/bin/ld.exe : Cannot find library

Hello,

I use Visual Studio Code with PlatformIO 2.3.3 with esp-idf and Arduino:

 - framework-arduinoespressif32 0.0.0+sha.3616c2e
 - framework-espidf 3.40001.200521 (4.0.1)
 - tool-cmake 3.16.4
 - tool-esptoolpy 1.20600.0 (2.6.0)
 - tool-idf 1.0.1
 - tool-mconf 1.4060000.20190628 (406.0.0)
 - tool-mkspiffs 2.230.0 (2.30)
 - tool-ninja 1.9.0
 - toolchain-esp32ulp 1.22851.191205 (2.28.51)
 - toolchain-xtensa32 3.80200.200512 (8.2.0)

I got the following error after the compilation of the firmware:

c:/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: cannot find -l.platformiopackagesframework-espidf@3.40001.200521componentsxtensaesp32libhal
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\debug\bootloader.elf] Error 1

How can I resolve the issue?

And with what platformio.ini is that?

[platformio]
src_dir = src

[env]
board = esp32dev

# Use esp-idf version 3.40001.200521
platform = espressif32@1.12.4
framework = arduino, espidf

# 4 MB module version
board_upload.flash_size = 4MB
board_upload.maximum_size = 4194304
board_build.partitions = partitions_4MB.csv

upload_speed = 921600
upload_port = COM4

monitor_speed = 115200
monitor_port = COM4
monitor_filters = esp32_exception_decoder

# 06/05/2021
# This version of the Arduino framework doesn´t support of ESP-IDF versions >4.0
platform_packages =
    framework-arduinoespressif32@https://github.com/marcovannoord/arduino-esp32/tree/idf-release/v4.0
    toolchain-xtensa32@3.80200.200512

[common]
build_flags =
    # ESP32 specific (used by different libraries i. e. BLE)
    -D ESP32
    -D ARDUINO_ARCH_ESP32
    -D ARDUINO_ESP32_DEV

	# Only needed when PSRAM should be supported
    #-D BOARD_HAS_PSRAM

    # Only needed for ESP32 rev v1
    #-mfix-esp32-psram-cache-issue

    # Used by the esp32-camera driver
    -D CONFIG_OV5640_SUPPORT
    -D CONFIG_SCCB_HARDWARE_I2C
    -D CONFIG_SCCB_HARDWARE_I2C_PORT1

    # Used for ArduinoJSON
    -D ARDUINOJSON_ENABLE_ARDUINO_STRING=1

lib_deps_builtin =

lib_deps_external =
    espressif/esp32-camera@^1.0.0
    bblanchon/ArduinoJson@^6.18.0

[env:debug]
build_type = debug

build_flags =
    ${common.build_flags}
    -D DEBUG
    -D ENABLE_DEBUG_PRINT
    -D APP_VERSION_POST='"debug"'

lib_deps =
    ${common.lib_deps_builtin}
    ${common.lib_deps_external}

What that I’m immediately getting

Cloning into ‘C:\Users\Max.platformio.cache\tmp\pkg-installing-8bi9y1af’…
fatal: repository ‘GitHub - marcovannoord/arduino-esp32 at idf-release/v4.0’ not found
Error: VCS: Could not process command [‘git’, ‘clone’, ‘–recursive’, ‘–depth’, ‘1’, ‘GitHub - marcovannoord/arduino-esp32 at idf-release/v4.0’, ‘C:\Users\Max\.platformio\.cache\tmp\pkg-installing-8bi9y1af’]

That can’t be correct. Had to replace it with

Further had to comment out the 4MB partition line because the file was not provided. Once I do that and take as code e.g. I get

Linking .pio\build\debug\firmware.elf
Retrieving maximum program size .pio\build\debug\firmware.elf
Building .pio\build\debug\firmware.bin
Checking size .pio\build\debug\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.0% (used 13016 bytes from 327680 bytes)
Flash: [==        ]  16.7% (used 175069 bytes from 1048576 bytes)
esptool.py v2.6
================= [SUCCESS] Took 25.75 seconds ================= 

So, everything works for me. See GitHub - maxgerhardt/pio-espidf-arduino-repro: (Do not use, only for reproduction).

There seems to be another issue here as well.

If I create a completely empty new project with platformio.ini defined as:

[env:esp32dev]
platform = espressif32@1.12.4
board = esp32dev
framework = espidf

and a c file with an empty app_main() function, I get the same error as in the first post.