Linker fails after PlatformIO update ESP32

I have been working on a project for the last 4 months and had no problem compiling and linking it using the PlatformIO IDE. The project is ESP32 based. Last Monday, I compiled a version in the STAGGING environment. On Friday I recompiled in the RESEARCH environment, which is identical but with a different #define. It failed in the linker with the messages:

Linking .pio\build\esp-wrover-kit-Jlink-RESEARCH\bootloader.elf
/bin/ld.exe: \main\libmain.a(bootloader_start.c.o):(.literal.selected_boot_partition+0x0): undefined reference to bootloader_utility_get_selected_boot_partition' /bin/ld.exe: \main\libmain.a(bootloader_start.c.o):(.literal.selected_boot_partition+0x4): undefined reference to bootloader_common_get_reset_reason’
/bin/ld.exe: \main\libmain.a(bootloader_start.c.o):(.literal.select_partition_number+0x8): undefined reference to bootloader_utility_load_partition_table' /bin/ld.exe: \main\libmain.a(bootloader_start.c.o):(.literal.select_partition_number+0xc): undefined reference to esp_log_timestamp’
/bin/ld.exe: \main\libmain.a(bootloader_start.c.o):(.literal.call_start_cpu0+0x0): undefined reference to bootloader_init' /bin/ld.exe: \main\libmain.a(bootloader_start.c.o):(.literal.call_start_cpu0+0x4): undefined reference to bootloader_reset’
/bin/ld.exe: \main\libmain.a(bootloader_start.c.o):(.literal.call_start_cpu0+0xc): undefined reference to bootloader_utility_load_boot_image' /bin/ld.exe: \main\libmain.a(bootloader_start.c.o): in function selected_boot_partition’: \main/bootloader_start.c:75: undefined reference to bootloader_utility_get_selected_boot_partition' /bin/ld.exe: \main/bootloader_start.c:79: undefined reference to bootloader_common_get_reset_reason’
/bin/ld.exe: \main\libmain.a(bootloader_start.c.o): in function select_partition_number': \main/bootloader_start.c:60: undefined reference to bootloader_utility_load_partition_table’
/bin/ld.exe: \main/bootloader_start.c:67: undefined reference to esp_log_timestamp' /bin/ld.exe: \main\libmain.a(bootloader_start.c.o): in function call_start_cpu0’: \main/bootloader_start.c:33: undefined reference to bootloader_init' /bin/ld.exe: \main/bootloader_start.c:34: undefined reference to bootloader_reset’
/bin/ld.exe: \main/bootloader_start.c:53: undefined reference to bootloader_utility_load_boot_image' /bin/ld.exe: \main/bootloader_start.c:53: undefined reference to bootloader_reset’
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp-wrover-kit-Jlink-RESEARCH\bootloader.elf] Error 1

I then retried the STAGGING environment and it also failed with the exact same errors. There was no code change between Monday and Friday. I did notice that PlatformIO did update itself. God only knows what was updated. Now nothing works. I went to two different colleagues, who compiled without issues. When one of them did the update, he also developed the linker error. The second colleague did not have this problem, using the same code repo, but he was using a MAC. He then used a Windows 10 computer one which he installed PlatformIO, VSCode and ESP32 2.1.0 platform. He also now can reproduce this error.

Please supply a solution ASAP. We have a very important client who is waiting for the STAGGING version of this code to be released to their field units. # different software engineers on 3 different computers are running into the exact same issue. I understand that we can use the MAC to generate the client version, but we need a Windows solution.

Ok, I figured out it broke when it updated to 5.2.4.
I NEED to downgrade to 5.2.2 and kill the auto updates. Please respond to this

Additional details… in our platformio.ini we are using:

platform = espressif32@2.1.0

So as an experiment, I created a new empty project with the above et viola – it fails in the same way we’re seeing. So the reproducible test case is as simple as:

[env:esp-wrover-kit]
platform = espressif32@2.1.0
board = esp-wrover-kit
framework = espidf

and a 1 line main.c:

void app_main() {}

Sorry, one more thing – failure only happens on Windows. MacOS and Linux seem to be fine.

¯_(ツ)_/¯

For professional support on this topic you should open a ticket at https://platformio.org/support.

I am running into the same issue, together with another co.-worker. Can you please give feedback on that issue? We are using espressif32@2.1.0 and cannot migrate to a higher version!

Open an issue at GitHub - platformio/platform-espressif32: Espressif 32: development platform for PlatformIO with the exact error message and platformio.ini configuration, have them uphold backwards compatibility.

How is this an issue of platform-espressif32? We did not change the version here, it seems that cores are the issue. Code was not changed at all, just fails after auto-update of the cores. It is not possible to downgrade.

K, then open one at Issues · platformio/platformio-core · GitHub

Yes it is, you can always manually activate the penv that PlatformIO is installed in and do a pip-uninstall of the old PlatformIO core and a pip-install of a fixed version of the core.

Assuming Linux paths:

# for linux
cd ~/.platformio
source ./bin/activate
pip uninstall platformio
pip install "platformio==5.1.1"

see platformio · PyPI.

Of course you should disable auto-update in the PlatformIO VSCode extension settings then too.

Also see Lib not found with last versión Core change? Home change? Framework? - #2 by maxgerhardt.

Good morning trichl,
We have done extensive work to solve this issue and this is the meat of it:

  • This issue is not present if you compile using a MAC or a Linux VM
  • I have wipe clean my computer, include the registry, and re-install 5.2.3 of PIO but the problem remained

I have traced the problem to the LDF.exe library dependency builder tool. Apparently, it has issues with the path of one of the 2.1.0 library which embeds include header libs in this fashion:
#include <lib\blabla.h>
and it can’t figure out where to look for the header file. The problem with rolling back the core is that it does not roll back the LDF.exe tool since it is provided by Extensa. So after many hours (days) of looking for a solution, I gave up and we decided to migrate the Espressif libs to 3.4.0. To our surprise, the project compiled right up and after extensive testing by us and by our client, there are no issues.

Hope this helps

Still, if you have a reproducable project on Windows for ESP-IDF that fails on a newer core version but works with a lower core version, please open an issue in the core.

Thanks for your update. I could finally workaround the issue, that’s what worked on Windows:

In the VS Code PlatformIO Terminal: pip install “platformio==5.1.1”, like maxgerhardt suggested (thanks a lot). Other downgrades didn’t work. Then restarting VS Code and it worked again.

I cant get it works (Windows 10 SO)

I have done in a VSC terminal

pip uninstall platformio
pip install "platformio==5.1.1

I have restart VSC but Platformio Home show core 5.2.4 home 3.4.0

if I do again "

pip uninstall platformio

and it show “uninstalling platformio==5.1.1”

At extesion manager I only have “platformio IDE” and I have disable auto-update and downgrade to 2.2.1 version but Platformio Home show still core 5.2.4 home 3.4.0

I dont understand what is and where is “Platformio IDE”, “Platformio Core” “Platformio Home”

I have look at for folder “Source” at .platformio folder at it is not , neither /bin, to do “pip” comand directly at folder and not at VSC terminal

My platformio.ini is: (board = esp32dev16 is a custom board for ESP32 with 16MB)

[env:esp32dev]

platform = espressif32@1.12.4

board = esp32dev16

framework = espidf

board_build.partitions = partitions.csv

board_build.embed_files =

src/websitefiles/index.html

src/websitefiles/jquery-3.4.1.min.js

src/websitefiles/favicon.ico

build_flags =

-I "components/cryptoauthlib/cryptoauthlib/lib"

-I "components/cryptoauthlib"

-I "src"

-DMBEDTLS_ECDH_GEN_PUBLIC_ALT 

-DMBEDTLS_ECDH_COMPUTE_SHARED_ALT 

-DMBEDTLS_ECDSA_SIGN_ALT 

-DMBEDTLS_SSL_CIPHERSUITES=MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256

-DSET_TRUSTED_CERT_IN_SAMPLES

upload_port = COM6

You are using the PlatformIO CLI, and not the regular VSCode terminal, right?

This is my terminal

Is not right?

I can’t really deduce from that whether you’ve opened the right terminal. Use the PIO sidebar → Quick Access → PlatformIO core CLI to access the right terminal.

Sorry, I dont have Platformio CLI, only powershell
I’m going to look at how install Platformio CLI.

Thanks

You’re right, you don’t have the PlatformIO extension installed in your screenshot there apparently because it’s not showing up in the sidebar. The “PlatformIO IDE” extension already comes with the CLI, no extra packages needed.

I also suggest temorarily disabling the CMake plugin as that clobbers the lower taskbar.

I’ll try.
At the moment I have update the Platformio IDE to the last v2.3.4 but PlatFormio CLI is not

Thanks

At the end, it works. I got to install core 5.1.1
I have read at Redirecting...

You need to edit system environment variable called Path and append C:\Users\UserName\.platformio\penv\Scripts; path in the beginning of a list (please replace UserName with your account name).

After then ; i have run pip install "platformio==5.1.1 at the terminal “powershell” (there isnt option for Platformio CLI)

I can see at platfomio IDE (home) that the core was change to 5.1.1

I now I can bluid my project

Thanks very much