Platformio running on a windows gitlab runner crashes during compilation with error code 3221225595 (0xC000 007B)

Hello there! I’m working on a group project that will run on an atmega2560. I’m installing a gitlab runner so that software guys can run tests on the board while I do other stuff, since I’m in a different country than them.

However, when we push a build to gitlab and the runner starts executing platformio, it crashes. It seems to be able to identify the required libraries and installs them correctly, but during compilation everything fails with error code 3221225595. Looking around, it seems to be a missing DLL somewhere, but I don’t know how to debug or identify which DLL is missing.

Before I used to get a different error code at the same step, 3221225781. I proceeded to (re-)install Microsoft Visual Code C++ Redistributable 2015-2022, and then the error changed to the one mentioned before.

So far I’ve tried:

  • Reinstalling VC Redistributable
  • Reinstalling gitlab runner on the C drive, where my windows installation is (previously was on D:)
  • Uninstalled and reinstalled platformio from python directly from the command line.

Any ideas? Thank you!

Console Output
Running with gitlab-runner 16.2.1 (674e0e29)
  on jairo zo_XtwQyL, system ID: s_54216c29359c
Preparing the "shell" executor 00:00
Using Shell (pwsh) executor...
Preparing environment 00:01
Running on JAIRO2023...
Getting source from Git repository 00:09
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in C:/gitlab-runner/builds/zo_XtwQyL/0/birds-x-tecspace/flight-software/.git/
Checking out e5eff959 as detached HEAD (ref is main)...
Removing .pio/
git-lfs/3.3.0 (GitHub; windows amd64; go 1.19.3; git 77deabdf)
Updating/initializing submodules recursively with git depth set to 20...
Synchronizing submodule url for 'lib/libSFSF'
Synchronizing submodule url for 'lib/libSFSF/extern/Unity'
Entering 'lib/libSFSF'
Entering 'lib/libSFSF/extern/Unity'
Entering 'lib/libSFSF'
HEAD is now at 566dbba UPDATE load_table_line method.
Entering 'lib/libSFSF/extern/Unity'
HEAD is now at 1b9199e Merge pull request #684 from detly/expose_assert_options
Entering 'lib/libSFSF'
Entering 'lib/libSFSF/extern/Unity'
git-lfs/3.3.0 (GitHub; windows amd64; go 1.19.3; git 77deabdf)
Entering 'lib/libSFSF'
Entering 'lib/libSFSF/extern/Unity'
Restoring cache 00:02
Version:      16.2.1
Git revision: 674e0e29
Git branch:   refs/pipelines/963421208
GO version:   go1.20.5
Built:        2023-08-11T14:12:07+0000
OS/Arch:      windows/amd64
Checking cache for default-protected...
Runtime platform                                    arch=amd64 os=windows pid=23236 revision=674e0e29 version=16.2.1
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted. 
Successfully extracted cache
Executing "step_script" stage of the job script 00:41
$ python -m pip install platformio
Collecting platformio
  Downloading platformio-6.1.10-py3-none-any.whl (416 kB)
     -------------------------------------- 416.9/416.9 kB 2.9 MB/s eta 0:00:00
Requirement already satisfied: uvicorn<0.24,>=0.16 in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from platformio) (0.22.0)
Requirement already satisfied: bottle==0.12.* in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from platformio) (0.12.25)
Requirement already satisfied: ajsonrpc==1.2.* in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from platformio) (1.2.0)
Requirement already satisfied: semantic-version==2.10.* in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from platformio) (2.10.0)
Requirement already satisfied: marshmallow==3.* in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from platformio) (3.19.0)
Requirement already satisfied: colorama in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from platformio) (0.4.6)
Requirement already satisfied: pyelftools==0.29 in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from platformio) (0.29)
Requirement already satisfied: pyserial==3.5.* in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from platformio) (3.5)
Requirement already satisfied: wsproto==1.* in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from platformio) (1.2.0)
Requirement already satisfied: click<=8.2,>=8.0.4 in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from platformio) (8.1.6)
Requirement already satisfied: starlette<0.32,>=0.19 in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from platformio) (0.28.0)
Requirement already satisfied: tabulate==0.* in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from platformio) (0.9.0)
Requirement already satisfied: requests==2.* in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from platformio) (2.31.0)
Requirement already satisfied: packaging>=17.0 in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from marshmallow==3.*->platformio) (23.1)
Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from requests==2.*->platformio) (3.2.0)
Requirement already satisfied: urllib3<3,>=1.21.1 in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from requests==2.*->platformio) (2.0.4)
Requirement already satisfied: idna<4,>=2.5 in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from requests==2.*->platformio) (3.4)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from requests==2.*->platformio) (2023.7.22)
Requirement already satisfied: h11<1,>=0.9.0 in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from wsproto==1.*->platformio) (0.14.0)
Requirement already satisfied: anyio<5,>=3.4.0 in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from starlette<0.32,>=0.19->platformio) (3.7.1)
Requirement already satisfied: sniffio>=1.1 in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from anyio<5,>=3.4.0->starlette<0.32,>=0.19->platformio) (1.3.0)
Requirement already satisfied: exceptiongroup in c:\users\jairo\appdata\local\programs\python\python310\lib\site-packages (from anyio<5,>=3.4.0->starlette<0.32,>=0.19->platformio) (1.1.2)
Installing collected packages: platformio
  WARNING: The scripts pio.exe, piodebuggdb.exe and platformio.exe are installed in 'C:\Users\jairo\AppData\Local\Programs\Python\Python310\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed platformio-6.1.10
[notice] A new release of pip available: 22.3.1 -> 23.2.1
[notice] To update, run: python.exe -m pip install --upgrade pip
$ python -m  platformio run -e megaatmega2560
Please wait while upgrading PlatformIO...
PlatformIO has been successfully upgraded to 6.1.10!
********************************************************************************
If you like PlatformIO, please:
- star it on GitHub > https://github.com/platformio/platformio-core
- follow us on LinkedIn to stay up-to-date on the latest project news > https://www.linkedin.com/company/platformio/
- try PlatformIO IDE for embedded development > https://platformio.org/platformio-ide
********************************************************************************
Processing megaatmega2560 (platform: atmelavr; board: megaatmega2560; framework: arduino)
--------------------------------------------------------------------------------
Library Manager: Installing adafruit/Adafruit SPIFlash @ ^4.1.1
Unpacking 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Library Manager: Adafruit SPIFlash@4.2.0 has been installed!
Library Manager: Resolving dependencies...
Library Manager: Installing Adafruit NeoPixel
Unpacking 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Library Manager: Adafruit NeoPixel@1.11.0 has been installed!
Library Manager: Installing SdFat - Adafruit Fork
Unpacking 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Library Manager: SdFat - Adafruit Fork@2.2.1 has been installed!
Library Manager: Installing paulstoffregen/OneWire @ ^2.3.7
Unpacking 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Library Manager: OneWire@2.3.7 has been installed!
Library Manager: Installing contrem/arduino-timer @ ^3.0.1
Unpacking 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Library Manager: arduino-timer@3.0.1 has been installed!
Library Manager: Installing git+https://gitlab.com/olmanqj/embedded-cli-pio
git version 2.40.0.windows.1
Cloning into 'C:\Windows\system32\config\systemprofile\.platformio\.cache\tmp\pkg-installing-_kyoeu4v'...
warning: redirecting to https://gitlab.com/olmanqj/embedded-cli-pio.git/
Submodule 'embedded-cli' (https://github.com/funbiscuit/embedded-cli) registered for path 'embedded-cli'
Cloning into 'C:/Windows/System32/config/systemprofile/.platformio/.cache/tmp/pkg-installing-_kyoeu4v/embedded-cli'...
Submodule path 'embedded-cli': checked out '0fbfb77dbf946941c84f1c14a6e9ba321b41bf42'
Submodule 'deps/catch2' (https://github.com/catchorg/Catch2.git) registered for path 'embedded-cli/deps/catch2'
Cloning into 'C:/Windows/System32/config/systemprofile/.platformio/.cache/tmp/pkg-installing-_kyoeu4v/embedded-cli/deps/catch2'...
Submodule path 'embedded-cli/deps/catch2': checked out 'c837cb4a8aaa2064f63e67ed0a7f7055dbf159c5'
Library Manager: embedded-cli-pio@0.1.2+sha.3180ea8 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/megaatmega2560.html
PLATFORM: Atmel AVR (4.2.0) > Arduino Mega or Mega 2560 ATmega2560 (Mega 2560)
HARDWARE: ATMEGA2560 16MHz, 8KB RAM, 248KB Flash
DEBUG: Current (avr-stub) External (avr-stub, simavr)
PACKAGES: 
 - framework-arduino-avr @ 5.1.0 
 - toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 12 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Adafruit SPIFlash @ 4.2.0
|-- OneWire @ 2.3.7
|-- arduino-timer @ 3.0.1
|-- embedded-cli-pio @ 0.1.2+sha.3180ea8
|-- libSFSF
|-- SdFat - Adafruit Fork @ 2.2.1
Building in release mode
Compiling .pio\build\megaatmega2560\libc29\embedded-cli-pio\embedded_cli.c.o
Compiling .pio\build\megaatmega2560\src\cli\cli.cpp.o
Compiling .pio\build\megaatmega2560\src\cli\cli_fs.cpp.o
Compiling .pio\build\megaatmega2560\src\cli\cli_modes.cpp.o
Compiling .pio\build\megaatmega2560\src\cli\cli_param.cpp.o
Compiling .pio\build\megaatmega2560\src\cli\cli_sys.cpp.o
Compiling .pio\build\megaatmega2560\src\cli\cli_tnc.cpp.o
Compiling .pio\build\megaatmega2560\src\flash_mem\flash_mem.cpp.o
Compiling .pio\build\megaatmega2560\src\main.cpp.o
Compiling .pio\build\megaatmega2560\src\modes\digipeater.cpp.o
Compiling .pio\build\megaatmega2560\src\modes\safe.cpp.o
Compiling .pio\build\megaatmega2560\src\modes\science.cpp.o
Compiling .pio\build\megaatmega2560\src\modes\self_test.cpp.o
Compiling .pio\build\megaatmega2560\src\modes\store_and_soward.cpp.o
Compiling .pio\build\megaatmega2560\src\param_table.c.o
Compiling .pio\build\megaatmega2560\src\sensors\thermo.cpp.o
Compiling .pio\build\megaatmega2560\src\stop\param_callbacks.cpp.o
Compiling .pio\build\megaatmega2560\src\sys\init.cpp.o
Compiling .pio\build\megaatmega2560\src\sys\rst.cpp.o
*** [.pio\build\megaatmega2560\libc29\embedded-cli-pio\embedded_cli.c.o] Error 3221225595
Compiling .pio\build\megaatmega2560\src\sys\sys_hooks.cpp.o
*** [.pio\build\megaatmega2560\src\cli\cli.cpp.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\cli\cli_fs.cpp.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\cli\cli_modes.cpp.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\cli\cli_param.cpp.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\cli\cli_sys.cpp.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\cli\cli_tnc.cpp.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\flash_mem\flash_mem.cpp.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\main.cpp.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\modes\digipeater.cpp.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\modes\safe.cpp.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\modes\science.cpp.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\modes\self_test.cpp.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\modes\store_and_soward.cpp.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\param_table.c.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\sensors\thermo.cpp.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\stop\param_callbacks.cpp.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\sys\init.cpp.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\sys\rst.cpp.o] Error 3221225595
*** [.pio\build\megaatmega2560\src\sys\sys_hooks.cpp.o] Error 3221225595
========================= [FAILED] Took 33.41 seconds =========================
Cleaning up project directory and file based variables 00:01
ERROR: Job failed: exit status 1

Woah. The user that PlatformIO is running under is the system administrator? It should have picked some C:\Users\<user>\.platformio directory here. Any chance you can

  1. Make the gitlab-runner use a regular user account
  2. Remote desktop into that Windows instance and execute the compiler exe yourself to see what maybe more readable error message comes up? ( C:/Windows/System32/config/systemprofile/.platformio/packages/toolchain-atmelavr/bin/avr-gcc or similiar)