PlatformIO Community

[solved] Github actions fails gcc installation

Hi,

I’m trying out github actions with platformio one of my project on a seperat branch.
Project compiles and run locally very well.

My workflow file is the following (based on your example only added a working directory and changed the pio run command:

name: PlatformIO CI

on: [push]

defaults:
  run:
    working-directory: stm32

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: Set up Python
      uses: actions/setup-python@v1
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install platformio
    - name: Run PlatformIO
      run: pio run

The build fails a the installation of gcc toolchain:

Processing nucleo_l432kc (platform: ststm32; board: nucleo_l432kc; framework: mbed)
--------------------------------------------------------------------------------
Platform Manager: Installing ststm32
Downloading...
Unpacking...
Platform Manager: ststm32 @ 9.0.0 has been installed!
The platform 'ststm32' has been successfully installed!
The rest of the packages will be installed later depending on your build environment.
Tool Manager: Installing platformio/toolchain-gccarmnoneeabi @ ~1.90201.0
Downloading...
Unpacking...
Tool Manager: toolchain-gccarmnoneeabi @ 1.90201.191206 has been installed!
Tool Manager: Installing platformio/framework-mbed @ ~6.60200.0
Downloading...
Unpacking...
Tool Manager: framework-mbed @ 6.60200.200722 has been installed!
Tool Manager: Installing platformio/tool-scons @ ~4.40001.0
Downloading...
Unpacking...
Tool Manager: tool-scons @ 4.40001.0 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/nucleo_l432kc.html
PLATFORM: ST STM32 (9.0.0) > ST Nucleo L432KC
HARDWARE: STM32L432KCU6 80MHz, 64KB RAM, 256KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
PACKAGES: 
 - framework-mbed 6.60200.200722 (6.2.0) 
 - toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
AttributeError: type object 'array.array' has no attribute 'tostring':
  File "/opt/hostedtoolcache/Python/3.9.0/x64/lib/python3.9/site-packages/platformio/builder/main.py", line 170:
    env.SConscript("$BUILD_SCRIPT")
  File "/home/runner/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/Script/SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/home/runner/.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 "/home/runner/.platformio/platforms/ststm32/builder/main.py", line 99:
    target_elf = env.BuildProgram()
  File "/home/runner/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "/opt/hostedtoolcache/Python/3.9.0/x64/lib/python3.9/site-packages/platformio/builder/tools/platformio.py", line 61:
    env.ProcessProgramDeps()
  File "/home/runner/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "/opt/hostedtoolcache/Python/3.9.0/x64/lib/python3.9/site-packages/platformio/builder/tools/platformio.py", line 127:
    env.BuildFrameworks(env.get("PIOFRAMEWORK"))
  File "/home/runner/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "/opt/hostedtoolcache/Python/3.9.0/x64/lib/python3.9/site-packages/platformio/builder/tools/platformio.py", line 342:
    SConscript(env.GetFrameworkScript(f), exports="env")
  File "/home/runner/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/Script/SConscript.py", line 661:
    return method(*args, **kw)
  File "/home/runner/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/Script/SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/home/runner/.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 "/home/runner/.platformio/platforms/ststm32/builder/frameworks/mbed.py", line 35:
    SConscript(
  File "/home/runner/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/Script/SConscript.py", line 661:
    return method(*args, **kw)
  File "/home/runner/.platformio/packages/tool-scons/scons-local-4.0.1/SCons/Script/SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/home/runner/.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 "/home/runner/.platformio/packages/framework-mbed/platformio/platformio-build.py", line 43:
    from pio_mbed_adapter import PlatformioMbedAdapter
  File "/home/runner/.platformio/packages/framework-mbed/platformio/pio_mbed_adapter.py", line 23:
    from tools.build_api import prepare_toolchain, UPDATE_WHITELIST
  File "/home/runner/.platformio/packages/framework-mbed/tools/build_api.py", line 37:
    from .utils import (mkdir, run_cmd, run_cmd_ext, NotSupportedException,
  File "/home/runner/.platformio/packages/framework-mbed/tools/utils.py", line 33:
    from intelhex import IntelHex
  File "/home/runner/.platformio/packages/framework-mbed/platformio/package_deps/py3/intelhex/__init__.py", line 44:
    from intelhex.compat import (
  File "/home/runner/.platformio/packages/framework-mbed/platformio/package_deps/py3/intelhex/compat.py", line 60:
    array_tobytes = getattr(array.array, "tobytes", array.array.tostring)
========================= [FAILED] Took 41.68 seconds =========================
Error: Process completed with exit code 1.

Can you try with a Python 3.8 version instead of Python 3.9?

Alternatively keep Python 3.9 but execute a pio upgrade --dev after installing it via pip – the issue may already be resolved in the latest core.

@maxgerhardt Thanks for the tip! Worked flawlessly now.

Can you say which one of those two options you took for reference? :sweat_smile: