arduino / arduino-cli

Arduino command line tool
https://arduino.github.io/arduino-cli/latest/
GNU General Public License v3.0
4.32k stars 373 forks source link

Sketch re-compiled when unnecessary #1996

Open weswitt opened 1 year ago

weswitt commented 1 year ago

Describe the problem

When using make & makefiles a build followed immediately by another build causes nothing to be compiled or linked because make honors timestamps when building the dependency graph. The arduino-cli does not seem to do this. If i do a compile and then immediately another compile it rebuild the binary the second time. This is unnecessary and consumes time & processing power. Arduido-cli should behave like make.

To reproduce

Do a compile and the immediately another compile.

Expected behavior

The second compile should exit without doing anything.

Arduino CLI version

arduino-cli Version: 0.29.0 Commit: 76251df9 Date: 2022-11-17T09:21:37Z

Operating system

Windows

Operating system version

Windows 11

Additional context

Additional reports

Issue checklist

scottchiefbaker commented 1 year ago

What's the status on this? I'm getting bit by this also.

umbynos commented 1 year ago

Actually the compile process does compile different "parts" of a sketch:

The first two already use a caching mechanism. The sketch currently does not have this behavior. Unfortunately, it's not that easy because the library detection can't be cached.

weswitt commented 1 year ago

can't? i don't think so. it's amazing how make has done this for decades.

cmaglie commented 1 year ago

can't? i don't think so. it's amazing how make has done this for decades.

Just to give some context: the slow part is the automatic library detection, the difference between a Makefile and a sketch is that with a Makefile the used libraries are given (it's the user's duty to write the paths manually or with the aid of other tools like cmake/automake). With a sketch, the libraries are automatically discovered.

Moving to a more pragmatic example, this is how a clean compile looks like:

~/Arduino/Blink$ LANG=en arduino-cli compile -b arduino:avr:uno --clean -v
FQBN: arduino:avr:uno
Using board 'uno' from platform in folder: /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6
Using core 'arduino' from platform in folder: /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6

Detecting libraries used...
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp -o /dev/null
Alternatives for Wire.h: [Arduino_Threads@0.0.1 Wire@1.0]
ResolveLibrary(Wire.h)
  -> candidates: [Arduino_Threads@0.0.1 Wire@1.0]
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp -o /dev/null
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src/Wire.cpp -o /dev/null
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src/utility/twi.c -o /dev/null
Generating function prototypes...
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/preproc/sketch_merged.cpp
/home/megabug/.arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/preproc/sketch_merged.cpp
Compiling sketch...
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp.o
Compiling libraries...
Compiling library "Wire"
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src/Wire.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/libraries/Wire/Wire.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src/utility/twi.c -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/libraries/Wire/utility/twi.c.o
Compiling core...
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/HardwareSerial0.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/HardwareSerial0.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/IPAddress.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/IPAddress.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/HardwareSerial.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/HardwareSerial.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/HardwareSerial2.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/HardwareSerial2.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/CDC.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/CDC.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/PluggableUSB.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/PluggableUSB.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/HardwareSerial3.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/HardwareSerial3.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/HardwareSerial1.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/HardwareSerial1.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/Tone.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/Tone.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/Print.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/Print.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/Stream.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/Stream.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/USBCore.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/USBCore.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/WInterrupts.c -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/WInterrupts.c.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/WMath.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/WMath.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/WString.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/WString.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/abi.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/abi.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/hooks.c -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/hooks.c.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/main.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/main.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/new.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/new.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/wiring.c -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/wiring.c.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/wiring_analog.c -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/wiring_analog.c.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/wiring_digital.c -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/wiring_digital.c.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -c -g -x assembler-with-cpp -flto -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/wiring_pulse.S -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/wiring_pulse.S.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/wiring_pulse.c -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/wiring_pulse.c.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -c -g -Os -w -std=gnu11 -ffunction-sections -fdata-sections -MMD -flto -fno-fat-lto-objects -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino/wiring_shift.c -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/wiring_shift.c.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/CDC.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/HardwareSerial.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/HardwareSerial0.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/HardwareSerial1.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/HardwareSerial2.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/HardwareSerial3.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/IPAddress.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/PluggableUSB.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/Print.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/Stream.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/Tone.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/USBCore.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/WInterrupts.c.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/WMath.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/WString.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/abi.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/hooks.c.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/main.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/new.cpp.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/wiring.c.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/wiring_analog.c.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/wiring_digital.c.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/wiring_pulse.S.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/wiring_pulse.c.o
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc-ar rcs /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/wiring_shift.c.o
Archiving built core (caching) in: /tmp/arduino/cores/arduino_avr_uno_12e4cfbdc0590d50ab9cd20e50a4c3c5/core.a
Linking everything together...
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.elf /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp.o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/libraries/Wire/Wire.cpp.o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/libraries/Wire/utility/twi.c.o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/core/core.a -L/tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3 -lm
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.elf /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.eep
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy -O ihex -R .eeprom /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.elf /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.hex
Multiple libraries were found for "Wire.h"
  Used: /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire
  Not used: /home/megabug/Workspace/Arduino_Threads
Using library Wire at version 1.0 in folder: /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire 
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-size -A /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.elf
Sketch uses 1636 bytes (5%) of program storage space. Maximum is 32256 bytes.
Global variables use 122 bytes (5%) of dynamic memory, leaving 1926 bytes for local variables. Maximum is 2048 bytes.

Used library Version Path                                                                       
Wire         1.0     /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire

Used platform Version Path                                                        
arduino:avr   1.8.6   /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6
~/Arduino/Blink$

and this is the same compile after immediately re-running it:

~/Arduino/Blink$ LANG=en arduino-cli compile -b arduino:avr:uno -v
FQBN: arduino:avr:uno
Using board 'uno' from platform in folder: /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6
Using core 'arduino' from platform in folder: /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6

Detecting libraries used...
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp -o /dev/null
Alternatives for Wire.h: [Arduino_Threads@0.0.1 Wire@1.0]
ResolveLibrary(Wire.h)
  -> candidates: [Arduino_Threads@0.0.1 Wire@1.0]
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp -o /dev/null
Using cached library dependencies for file: /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src/Wire.cpp
Using cached library dependencies for file: /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src/utility/twi.c
Generating function prototypes...
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/preproc/sketch_merged.cpp
/home/megabug/.arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/preproc/sketch_merged.cpp
Compiling sketch...
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/standard -I/home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire/src /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp.o
Compiling libraries...
Compiling library "Wire"
Using previously compiled file: /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/libraries/Wire/utility/twi.c.o
Using previously compiled file: /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/libraries/Wire/Wire.cpp.o
Compiling core...
Using precompiled core: /tmp/arduino/cores/arduino_avr_uno_12e4cfbdc0590d50ab9cd20e50a4c3c5/core.a
Linking everything together...
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.elf /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/sketch/Blink.ino.cpp.o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/libraries/Wire/Wire.cpp.o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/libraries/Wire/utility/twi.c.o /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/../../cores/arduino_avr_uno_12e4cfbdc0590d50ab9cd20e50a4c3c5/core.a -L/tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3 -lm
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.elf /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.eep
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy -O ihex -R .eeprom /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.elf /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.hex
Multiple libraries were found for "Wire.h"
  Used: /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire
  Not used: /home/megabug/Workspace/Arduino_Threads
Using library Wire at version 1.0 in folder: /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire 
/home/megabug/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-size -A /tmp/arduino/sketches/002050EAA7EFB9A4FC451CDFBC0FA2D3/Blink.ino.elf
Sketch uses 1636 bytes (5%) of program storage space. Maximum is 32256 bytes.
Global variables use 122 bytes (5%) of dynamic memory, leaving 1926 bytes for local variables. Maximum is 2048 bytes.

Used library Version Path                                                                       
Wire         1.0     /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6/libraries/Wire

Used platform Version Path                                                        
arduino:avr   1.8.6   /home/megabug/.arduino15/packages/arduino/hardware/avr/1.8.6

The second run is resuing almost everything from the cache except on:

  1. The Detecting libraries used... phase. This is the slowest. It's also not easy to fully cache and/or parallelize, because it actually requires running gcc -E on the sketch to check if there are missing includes (the installed libraries may have changed in the meantime). The same process must be done on all the compilation units in the included libraries: this may become very long if there are hundreds of files.
  2. The sketch itself is compiled and linked again even if there are no changes.

About problem 2: this could be surely improved even if the gain is very little compared to the overall compilation time. I opened #2204 to track this one.

About problem 1: there is an interesting tentative here https://github.com/arduino/arduino-cli/pull/1735 but it's flaky, BTW it gave some ideas to work on to actually get to a correct solution, I made a preparatory PR here https://github.com/arduino/arduino-cli/pull/1766 to clean up the library resolution code in preparation of a bigger refactoring.

weswitt commented 1 year ago

and i consider the automatic library detection a gimmick and unnecessary. as the author of the code i know exactly which libraries i'm using can can easily declare their use. have a faster, more efficient build is WAY more important than library detection.

apos commented 1 year ago

THIS IS SO ANNOYING. Really. Together with the exhaustive compilation times, not just on Windows, also on Linux for V. 2x - this is not acceptable.

Wherever I can, I use now PlatformIO. Unfortunately, this is not possible with every Arduino project.

This problem persists now a long time. Sorry - this can not be accepted. The Arduino IDE is for beginners and should not sugest, C compiling takes forever. I am doing programming now for a long time (decades), but I never saw such a poor implementation. Normally, I would not post such negative thoughts. But the problem is: this simple facts, which EVERY other IDE has solved for ages, still exists.

ubidefeo commented 1 year ago

@apos Arduino IDE has to keep a long-standing legacy which allows not having to worry about a lot of things that advanced users know how to do.

With Arduino CLI and IDE 2 we have brought these helpers into a more modern enhanced experience. These same complaints are valid for IDE 1.x, and if we were to change/bypass/remove a crucial step such as automatic library discovery we'd be hindering the correct functioning of processes which have made the success of Arduino.

Please consider @cmaglie 's above comments

About problem 2: this could be surely improved even if the gain is very little compared to the overall compilation time. I opened https://github.com/arduino/arduino-cli/issues/2204 to track this one.

About problem 1: there is an interesting tentative here https://github.com/arduino/arduino-cli/pull/1735 but it's flaky, BTW it gave some ideas to work on to actually get to a correct solution, I made a preparatory PR here https://github.com/arduino/arduino-cli/pull/1766 to clean up the library resolution code in preparation of a bigger refactoring.

I always try to highlight the reasons why some things take time or are not at all possible, and the fact is that we have a very small team (substantially 3 to 5 depending on other tasks) that works every day to make this better and address users' needs and suggestions. In my 25 years of experience I have learned that rarely harsh comments bear faster/better results 🙂

This is an Open-Source project and some users strive to submit PRs which require us to look into and figure out if they break 3 things to fix one.

I consider myself an advanced user and I've had a few years on PlatformIO before joining the Arduino team. I respect its advantages, and really like how some things have been thought, but here we try to make things easier for everyone with the main requirement being "do not break things", and unfortunately we have to keep into account that aforementioned long-standing legacy and countless users whose projects might break or exhibit strange compilation errors.

Sadly every category of user has to deal with some drawbacks. We're just here to try and reduce the friction for the widest user base, hope you'll understand 🙏🏼

u.