Skip to content

Compiling for different board variants in different build-dirs does not reuse already compiled objects #2266

Closed
@n-peugnet

Description

@n-peugnet

Describe the problem

I am trying to build the same sketch for different variants of the nano33ble board. For the sense Rev2 board I added this flag --build-property 'compiler.cpp.extra_flags=-DSENSE_REV2' to include some additional parts of the code. When alternating between two builds (with and without this extra flag) the compilation is very long as all the libraries are recompiled each time. So I tried to set a build dir with --build-cache-path and --build-path options for each configuration, so that the already compiled files can be reused. But it continues to recompile everything each time I switch from one command to another. Am I doing something wrong?

To reproduce

Here are the two compile commands I am using:

arduino-cli compile -b arduino:mbed_nano:nano33ble --build-cache-path build-nano33ble --build-path build-nano33ble
arduino-cli compile -b arduino:mbed_nano:nano33ble --build-cache-path build-nano33blesense2 --build-path build-nano33blesense2 --build-property 'compiler.cpp.extra_flags=-DSENSE_REV2'

And here is a console log:
arduino-cli-compile.log

Expected behavior

When using different --build-path and --build-cache-path, multiple variant of the same sketch for the same board should be able to be built without recompiling everything when switching from one to another.

Arduino CLI version

arduino-cli Version: nightly-20230817 Commit: 459fe76 Date: 2023-08-17T01:23:47Z

Operating system

Linux

Operating system version

Linux SMP PREEMPT_DYNAMIC Debian 6.4.4-2 (2023-07-30) x86_64

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions