espressif / arduino-esp32

Arduino core for the ESP32
GNU Lesser General Public License v2.1
13.71k stars 7.43k forks source link

the arduino core makes build times weirdly insufferable #10603

Closed heavyStuff3000 closed 1 week ago

heavyStuff3000 commented 1 week ago

Related area

arduino core, i2c

Hardware specification

esp32

Is your feature request related to a problem?

How is it possible that simply adding the arduino core to my project(since I have an arduino lib that already work to interact with my sensors) makes any change in the cmake file impossible without waiting for 5 minutes?

I really hate waiting for 5 minutes each time I do a cmake change, since it never works on the first time anyway. this is absolutely insane, how many dependencies does the arduino core have?

Describe the solution you'd like

make the arduino core compile QUICKER

Describe alternatives you've considered

make it possible to just import the wire(i2c) part of the arduino lib because this is insane how much time a cmake change takes

Additional context

this behavior only happens when the arduino core is installed as dependency

I have checked existing list of Feature requests and the Contribution Guide

heavyStuff3000 commented 1 week ago

Am I crazy or this is like really really slow

heavyStuff3000 commented 1 week ago

gpt says:

Pre-build the Arduino Core as a Component:

If you rarely make changes to the Arduino core, you can pre-build it and link it as a static library or component, minimizing rebuild times when working on other parts of your project.

SuGlider commented 1 week ago

Is this about building an Arduino project using Arduino as IDF Component?

SuGlider commented 1 week ago

gpt says:

Pre-build the Arduino Core as a Component:

If you rarely make changes to the Arduino core, you can pre-build it and link it as a static library or component, minimizing rebuild times when working on other parts of your project.

This is exactly what is done when building an application using the Arduino IDE.

SuGlider commented 1 week ago

Am I crazy or this is like really really slow

Today, in particular, it has been very slow to communicate to the ESP32 Registry site in order to check the dependencies.

I have just tried to build a hello_world and it took almost 15 minutes. This is unusual. If your project just needs a few Arduino Libraries, such as Wire, there is a way to reduce the time to build it:

1) Create a folder called components in your project folder. 2) Clone Arduino Core to that folder. 3) There should be a folder like this: yourProject/components/arduino-esp32 with all Arduino files from the repository. 4) Rename arduino-esp32/idf_component.yml to something else, such as arduino-esp32/idf_component.yml.NEW - this will eliminate all IDF components imported by Arduino Core used in many extra libraries. 5) Delete yourProject/managed-components/ folder and the yourProject/dependencies.lock file. 6) Delete yourProject/build folder 7) Execute idf.py menuconfig and go to Menu: (Top) → Arduino Configuration select Include only specific Arduino libraries and unselect all libraries, but Wire (which is used by your Project). Press ESC twice and select SAVE on exit. 8) Execute idf.py build and it will just build IDF and the Arduino Core + minimum set of Libraries way faster.

image

heavyStuff3000 commented 1 week ago

Thank you, by the way the steps are very clear.

heavyStuff3000 commented 1 week ago

(now only if you guys can make the next version of esp idf build the core quicker lol that'd be nice)