I'm attempting to compile a program with the CLI via docker, but I'm getting errors because it isn't populating the preprocessor definitions from boards.txt.
The specific error is a byproduct of that, but in case someone is searching for it later, the error: USB_VID was not declared in this scope
from cores/arduino/USBCore.cpp
I see the following when running the exact same command in and out of docker, note all the definitions from boards.txt when outside of docker.
(Only the first command is shown and line breaks added for clarity)
In docker
FQBN: adafruit:avr:itsybitsy32u4_5V
Using board 'itsybitsy32u4_5V' from platform in folder: /arduino/data/packages/adafruit/hardware/avr/1.4.15
Using core 'arduino' from platform in folder: /arduino/data/packages/arduino/hardware/avr/1.8.6
Detecting libraries used...
/arduino/data/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=atmega32u4
-DF_CPU=16000000L -DARDUINO=10607
-DARDUINO_AVR_ITSYBITSY32U4_5V -DARDUINO_ARCH_AVR
-I/arduino/data/packages/arduino/hardware/avr/1.8.6/cores/
arduino -I/arduino/data/packages/adafruit/hardware/avr/1.4.15/variants/itsybitsy32u4 /tmp/arduino/sketches/25FEAC7B78438B08E47BECDAC46A201D/sketch/itsy-serial.ino.cpp
-o /dev/null
Out of docker
FQBN: adafruit:avr:itsybitsy32u4_5V
Using board 'itsybitsy32u4_5V' from platform in folder: /home/null/.arduino15/packages/adafruit/hardware/avr/1.4.15
Using core 'arduino' from platform in folder: /home/null/.arduino15/packages/arduino/hardware/avr/1.8.6
Detecting libraries used...
/home/null/.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=atmega32u4
-DF_CPU=16000000L -DARDUINO=10607
-DARDUINO_AVR_ITSYBITSY32U4_5V -DARDUINO_ARCH_AVR
-DUSB_VID=0x239A -DUSB_PID=0x800E
-DUSB_MANUFACTURER="Adafruit"
-DUSB_PRODUCT="ItsyBitsy 32u4 5V 16MHz"
-I/home/null/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino
-I/home/null/.arduino15/packages/adafruit/hardware/avr/1.4.15/variants/itsybitsy32u4 /tmp/arduino/sketches/5DD7AD486AC39BA7E1BDA250FDC110C8/sketch/itsy-serial.ino.cpp
-o /dev/null
I tried checking the source code to see if I'm missing an env variable or something of the like, but go is not my forte and it's tough to trace the chain of execution.
Anyone have any suggestions?
FWIW the Dockerfile is:
FROM ubuntu:jammy
ENV ARDUINO_DIRECTORIES_USER=/arduino/user
ENV ARDUINO_DIRECTORIES_DOWNLOADS=/arduino/staging
ENV ARDUINO_DIRECTORIES_DATA=/arduino/data
ENV ARDUINO_BOARD_MANAGER_ADDITIONAL_URLS=https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
ENV PATH=/arduino/bin:$PATH
RUN apt update && \
apt upgrade -y && \
apt install -y --no-install-recommends \
curl \
ca-certificates && \
mkdir -p /arduino/bin /arduino/data /arduino/staging /arduino/user && \
export BINDIR=/arduino/bin && \
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh && \
ln -s /arduino/bin/arduino-cli /arduino/bin/acli && \
acli core update-index && \
acli core install arduino:avr && \
acli core install adafruit:avr