Page 1 of 1

Workflow tip: When to delete <project>/build

Posted: Wed Sep 20, 2017 3:47 am
by kolban
From experimentation, it seems that we are ok to delete the <project>/build directory as it will get rebuilt when we next perform a new compilation. The question then becomes "is it necessary and if yes, under what circumstances?".

These are my empirical experiences:

1. When ever I install a new version of the ESP-IDF, it does no harm.
2. When ever I perform an SDKCONFIG change through "make menuconfig".
3. When ever I see a compilation/linkage fail and the reason appears to be a mystery.

The reason for this post tonight is that I had replace an SDKCONFIG in a BLE project with a newer version that did NOT have "BT Enabled" in it. I perform a build and, of course, the build failed. I then ran "make menuconfig" and switched on Bluetooth Enablement. I then re-compiled the app by running "make" and although I didn't get the same errors as not having BT enabled at all, the errors related to missing includes which I could clearly see existed. I spent about 15 minutes trying to track that down and then, on a hunch, deleted "build" and this time all rebuilt cleanly performing the exact same make. What this seemed to tell me was that doing a "make" with an "SDKCONFIG" that did not include BT resulted in some state being written (into build) that wasn't resolved by changing "SDKCONFIG" to include BT and then re-running make.

It might be that a "make clean" has the same effect as removing "build".

Re: Workflow tip: When to delete <project>/build

Posted: Wed Sep 20, 2017 7:14 am
by ESP_Angus
There seem to be some bugs in the current version of the IDF build system that seem to require "make clean" (or deleting the build dir) more often than should be the case. You shouldn't need to do this when you pull a new IDF version, and definitely not when you change config. Although at the moment it's a good workaround.

I'll post again once this bug is found and taken care of.

Re: Workflow tip: When to delete <project>/build

Posted: Wed Sep 20, 2017 8:30 am
by ESP_Angus
Found the bug, regression introduced a couple of weeks ago. Fix should be in IDF shortly, will update again when this is the case.

There is one remaining time where upgrading IDF from V2.1 (or very early V3.0-dev) to the current master branch (or V3.0 release when it's available) will require a "make clean" or deleting the "build" directory and rebuilding.

The error usually looks something like this:

Code: Select all

make[2]: *** No rule to make target '${IDF_PATH}/components/bootloader/src/main/./flash_qio_mode.c', needed by 'flash_qio_mode.o'.  Stop.
make[1]: *** [/home/gus/esp/32/idf/make/project.mk:421: component-main-build] Error 2
This is because a directory inside the IDF tree (components/bootloader/src) was renamed in a way which the build system can't handle. "make clean" will fix it, and you'll only need to do it once per project after you update IDF.