PlatformIO Community

Build compiles all source files every time

Hi,

I’m using PlatformIO IDE with the mbed framework.
Everytime I run a build command, every files get compiled, even if I change nothing. All the mbed framework is compiled everytime.
If I run two times the compile command, both will compile everything, without any editing in the meantime.

What do I miss?

My platformio.ini files look like that:

[env:disco_f746ng]
platform = ststm32
board = disco_f746ng
framework = mbed
debug_tool = stlink
debug_load_mode = always
upload_protocol = stlink
build_flags =
    -D LV_CONF_INCLUDE_SIMPLE
    -D PIO_FRAMEWORK_MBED_RTOS_PRESENT
    -I src
    -I drivers
    -w
lib_deps =
    lvgl
src_filter = +<*> +<../drivers>

Thanks for your help

By looking at the Debug Console, I found the following error:

*** [.pio/build/disco_f746ng/FrameworkMbed/targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_hal_cryp_ex.o] /Users/username/src/projectname/gsboard-v2/.pio/build/disco_f746ng/FrameworkMbed/targets/TARGET_STM/TARGET_STM32F7/device/stm32f7xx_hal_cryp_ex.o: No such file or directory
FileNotFoundError: [Errno 2] No such file or directory: '/Users/username/src/projectname/gsboard-v2/.pio/build/disco_f746ng/.sconsign.py37.dblite':
  File "/Users/username/.platformio/packages/tool-scons/script/../engine/SCons/Script/Main.py", line 1374:
    _exec_main(parser, values)

And that could refer to this anomaly, as my project is quite big:

But I don’t know how to apply this config to platformIo

Problem

Please check that you use THE SAME Python interpreter for IDE and CLI. If you are on Windows, remove multiple Pythons from a system and use the latest Python 3.7. See instruction https://docs.platformio.org/en/latest/faq.html#install-python-interpreter


So I found the file I needed to modify.

I modified the line 144 of the file .platformio/penv/lib/python3.7/site-packages/platformio/builder/main.py
And I replaced:
env.SConsignFile( join("$BUILD_DIR", ".sconsign.py%d%d" % (sys.version_info[0], sys.version_info[1])) )
by
env.SConsignFile( join("$BUILD_DIR", ".sconsign.dblite") )

And now it’s working.
I think this is a bug because the mbed framework contains many many files.

1 Like

Please post this exact thing to https://github.com/platformio/platformio-core/issues as the file originates from there (source ), and @ivankravets can have a look at it :slight_smile:

Could you add

import sys
print(sys.version)
env.SConsignFile(...

Do you see the same Python version?

@nmathon this worked for me too, thanks !

@ivankravets print(sys.version) gives
3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)]
But I am not seeing the same error, the system was creating a file .sconsign.py37.dblite, no obvious error message

Why do you need a fix by @nmathon? If you see the same Python every build you should not have any problems. Please try again to repeat multiple times build process and check print(sys.version). Do yo use PlatformIO IDE for VSCode? Maybe, it uses different Python that you use in CLI.

@ivankravets For info this not fixed anymore.
I am back to full rebuild of mbed libraries at every upload.
The python verion does not change.

What else can I check ?

What is your OS? Do you use the latest PlatformIO Core + dev-platform? pio upgrade + pio update.

1 Like

Windows 10 (up to date)
I don’t know the exact version of Mbed, it was packaged with PIO (version 5 at least)
New PC installation (had the same problem on the old PC)

image

image

Could you provide a remote session under tour control to debug this issue on your machine? If yes, please write directly to @valeros and he will provide further instructions.

1 Like