Mysterious build failure after PlatformIO update(?)

Hi I am a relative newbie with PlatformIO and its IDE. I am using it on Windows 10, for developing some application using ANT+ on Adafruit nRF52840 Express Feather, using Arduino Wiring framework. With some help of the community I managed to make it work in the spring time. Since then, I “just used” it for incrementel development and everything worked fine, I mostly forgot about the installation hassle. However, in August I had to abandon my project for a few weeks due to lack of time and when I returned to it, say 2 weeks ago, then the build process “just stopped to work”. Obviously, PlatformIO has auto-updated itself at the first start after weeks of not-starting it. The update seemingly broke something in the build system in the process. I tried to reinstall the nRF52 platform in the IDE, it did not help. This is the error message. I am clueless. Any help would be appreciated. Here is the output of the build:

> Executing task in folder ANTplus-PoC: C:\Users\egbozie\.platformio\penv\Scripts\platformio.exe run <

Processing adafruit_feather_nrf52840_s340 (platform: https://github.com/orrmany/platform-nordicnrf52.git#develop-s340; board: adafruit_feather_nrf52840_s340; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing git+https://github.com/orrmany/Adafruit_nRF52_Arduino.git#develop-ant-plus-ble
git version 2.24.1.windows.2
Cloning into 'C:\Users\egbozie\.platformio\.cache\tmp\pkg-installing-ezm00nuj'...
remote: Enumerating objects: 909, done.
remote: Counting objects: 100% (909/909), done.
remote: Compressing objects: 100% (742/742), done.
remote: Total 909 (delta 256), reused 352 (delta 82), pack-reused 0R
Receiving objects: 100% (909/909), 16.25 MiB | 14.75 MiB/s, done.
Resolving deltas: 100% (256/256), done.
Updating files: 100% (726/726), done.
Submodule 'cores/nRF5/TinyUSB/Adafruit_TinyUSB_ArduinoCore' (https://github.com/adafruit/Adafruit_TinyUSB_ArduinoCore.git) registered for path 'cores/nRF5/TinyUSB/Adafruit_TinyUSB_ArduinoCore'
Submodule 'libraries/Adafruit_nRFCrypto' (https://github.com/adafruit/Adafruit_nRFCrypto.git) registered for path 'libraries/Adafruit_nRFCrypto'
Cloning into 'C:/Users/egbozie/.platformio/.cache/tmp/pkg-installing-ezm00nuj/cores/nRF5/TinyUSB/Adafruit_TinyUSB_ArduinoCore'...
remote: Enumerating objects: 193, done.
remote: Counting objects: 100% (193/193), done.
remote: Compressing objects: 100% (128/128), done.
remote: Total 496 (delta 63), reused 115 (delta 36), pack-reused 303
Receiving objects: 100% (496/496), 449.41 KiB | 4.20 MiB/s, done.
Resolving deltas: 100% (200/200), done.
Cloning into 'C:/Users/egbozie/.platformio/.cache/tmp/pkg-installing-ezm00nuj/libraries/Adafruit_nRFCrypto'...
remote: Enumerating objects: 252, done.
remote: Counting objects: 100% (252/252), done.
remote: Compressing objects: 100% (111/111), done.
remote: Total 252 (delta 154), reused 229 (delta 133), pack-reused 0
Receiving objects: 100% (252/252), 344.99 KiB | 3.79 MiB/s, done.
Resolving deltas: 100% (154/154), done.
Submodule path 'cores/nRF5/TinyUSB/Adafruit_TinyUSB_ArduinoCore': checked out '2f485087fd64d3fafffad414f0dc316c685d33d9'
Submodule path 'libraries/Adafruit_nRFCrypto': checked out '48b08a59d11b167c6b3c124db043a6df81cf5007'
Tool Manager: framework-arduinoadafruitnrf52 @ 1.0.0+sha.dda811e has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/adafruit_feather_nrf52840_s340.html
PLATFORM: Nordic nRF52 (4.4.0+sha.ec4dd8d) > Adafruit Feather nRF52840 Express s340
HARDWARE: NRF52840 64MHz, 243KB RAM, 796KB Flash
DEBUG: Current (jlink) External (jlink, stlink)
PACKAGES:
 - framework-arduinoadafruitnrf52 1.0.0+sha.dda811e
 - tool-sreccat 1.164.0 (1.64)
 - toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
AssertionError: :
  File "C:\Users\egbozie\.platformio\penv\lib\site-packages\platformio\builder\main.py", line 169:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\egbozie\.platformio\platforms\nordicnrf52\builder\main.py", line 194:
    target_elf = env.BuildProgram()
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\Users\egbozie\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 61:
    env.ProcessProgramDeps()
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\Users\egbozie\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 127:
    env.BuildFrameworks(env.get("PIOFRAMEWORK"))
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "C:\Users\egbozie\.platformio\penv\lib\site-packages\platformio\builder\tools\platformio.py", line 342:
    SConscript(env.GetFrameworkScript(f), exports="env")
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 661:
    return method(*args, **kw)
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\egbozie\.platformio\platforms\nordicnrf52\builder\frameworks\arduino.py", line 29:
    env.SConscript("arduino/adafruit.py")
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\egbozie\.platformio\packages\tool-scons\scons-local-4.0.1\SCons\Script\SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\egbozie\.platformio\platforms\nordicnrf52\builder\frameworks\arduino\adafruit.py", line 38:
    assert isdir(CORE_DIR)
==================================================================================== [FAILED] Took 37.25 seconds ====================================================================================
The terminal process "C:\Users\egbozie\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

This is the platformio.ini for the project:

;PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:adafruit_feather_nrf52840_s340]
; platform = nordicnrf52
; this custom platform adds the board.json for S340 variant
platform = https://github.com/orrmany/platform-nordicnrf52.git#develop-s340
board = adafruit_feather_nrf52840_s340
framework = arduino
platform_packages = framework-arduinoadafruitnrf52 @ https://github.com/orrmany/Adafruit_nRF52_Arduino.git#develop-ant-plus-ble
build_flags =
;monitor_filters = log2file, default
;lib_deps =
;lib_deps =
  # Using a library name
  #Adafruit BMP3XX Library=
;  5786=https://github.com/orrmany/Adafruit_BMP3XX.git

See migration guide from PIO 4.x to 5 for general information.

However in your specific case there is something else going in:

The platform code is trying to assert here that the core directory (C:\Users\Maxi\.platformio\packages\framework-arduinoadafruitnrf52\cores\nRF5 for me) exists for building the Arduino core.

When I build an example project with your platformio.ini, it downloads the following framework-arduinoadafruitnrf52 for me:

A test sketch for a BLEMidi project. Now that’s not the Arduino core. Thus it fails.

Interesting, not even saying

platform_packages = framework-arduinoadafruitnrf52@https://github.com/orrmany/Adafruit_nRF52_Arduino/archive/develop-ant-plus-ble.zip

will work. It’s like its internally re-directing it to something else. Still installs that midi test package.

Of course, for the PlatformIO 5 core you would have to pio package publish your modified framework, but it’s interesting that this does something unexpected.

Maybe @ivankravets can shed some light on how the above line ends up installing a BLEMidi test sketch with what seems like a NodeJS package.json?

PlatformIO Registry support 3 types of packages:

  • libraries (library.json)
  • platforms (platform.json)
  • toolchains (package.json)

In all cases, PlatformIO Package Managers looks for these manifests. The root of package == directory of the manfiest.

1 Like

But when looking at the original post with

platform_packages = framework-arduinoadafruitnrf52 @ https://github.com/orrmany/Adafruit_nRF52_Arduino.git#develop-ant-plus-ble

and looking at GitHub - orrmany/Adafruit_nRF52_Arduino: Adafruit code for the Nordic nRF52 BLE SoC on Arduino then none of those files are there, but also definitely not that weird BLE Midi sketch.

Ok, thank you. I will need to check that out. Meanwhile, is there any way to downgrade to the previous PlatformIO version? I do not care about 5.0 goodies right now and honestly I couldn’t care less about the migration pain in the middle of my project on top of the ongoing challenges in my daytime work I do for a living… :frowning:
I want my old environment back. It is annoying and frustrating that PlatformIO pushes a non-backward compatible update on me without asking and breaks a previously working setup. Disgusting behavior.

On the other hand I really appreciate your help. Thank you.

Same here. That is why I were/am confused at the first place. :confused:

At the top of that page a big bold sentence claims " PlatformIO Core 5.0 is fully backward compatible with PlatformIO 4.0 projects.". That is obviously not true in my case. :frowning:

@maxgerhardt, My problem occured on my work computer. However, I have another computer at home, which has a PlatformIO setup installed and not started since summer, i.e., still on version 4.x. Is there a way to prevent its auto-update function?
If yes, then I could continue my ANT + development there until this pkg-mgmt bug is shortened out…

Could you direct me to instructions to how to prevent PlatformIO to auto-update itself? Thanks in advance.

See feature request: possibility to disable auto update for certain extensions · Issue #30579 · microsoft/vscode · GitHub and possibly Visual Studio Code Frequently Asked Questions on how to deactivate PIO extension updates in VSCode (to be safe you should also a pre-version-5 core extension such as 1.10.0.

In order to revert the PIO core itself, tell PIO in the extension settings to not use the builtin PIO core (aka use the global one), then use the python pip program to install PIO core 4 as listed in Marlin: Help me ERRROR ModuleNotFoundError - #11 by maxgerhardt.

I’m not sure if it’s possible to downgrade the PIO version for the builtin PIO core module, but if you want that, I guess you can try telling it the bundled pip which should be somewhere C:\Users\<user>\.platformio\penv\Scripts\pip.exe.

1 Like

Thanks @maxgerhardt! I can confirm that with Core 4.3. (IDE 1.10) the build process works, hence it is a bug in the new core. @ivankravets, shall I submit this as bug? I assume so… Where to report?

Sorry, 12 posts and it’s very difficult to understand what do you mean under bug. Please provide a simple PlatformIO project to reproduce this issue and report to https://github.com/platformio/platformio-core/issues

@ivankravets I am having a similar build failure with the same BSP package on a different OS. See Platform_packages not being fetched on build and my project is Open so you can try and build it.

On linux i get the exact same error as @orrmany using my repo

See also Could not initialize project · Issue #1365 · platformio/platformio-home · GitHub

It seems that there is 100+ similar/related issues on platformio-home since August 25 (i.e., more or less since Core5 released), without any reaction.
@ivankravets: do you have any info on why are there so many issues on this topic without reaction?
I read that you proposed to raise issue on platformio-core, but the IDE creates these reports automatically on platformio-home instead…

Thanks, Gábor

Could you provide more details on this issue? How to reproduce it?

@ivankravets, you mean the issue 1365? That is very simple, described in the said issue. Just try to create an empty project…

If you explore the platformio-home issue tracker at Issues · platformio/platformio-home · GitHub you can see that the number of issues have exploded after August 25, with no, or little reaction. Most such issues are about failed library updates, failed builds, etc. If I search for issues created after Aug 25 you will find 200+ such issues now

Well, issue 1365 is solved now, turned to be a OneDrive related problem. Restarting both PlatformIO IDE and the OneDrive agent, then manually deleting some stale platform package helped to solve that problem.

After letting the IDE to upgrade to Platformio Core 5.0.1 and the Nordic nRF52 platform to 4.4.1 from 4.4.0 I have managed to build the BLEUART example of the platform. Next step is to uplift my ANT+ code to this platform and then we will see. I will come back with results, but probably not today due to lack of additional time

Ok, platform-packages still does not work. Creating issue now: https://github.com/platformio/platformio-core/issues/3693