Description
Describe the problem
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/foobar/.arduino15/packages/adafruit/hardware/avr/1.4.15
Using core 'arduino' from platform in folder: /home/foobar/.arduino15/packages/arduino/hardware/avr/1.8.6
Detecting libraries used...
/home/foobar/.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/foobar/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino
-I/home/foobar/.arduino15/packages/adafruit/hardware/avr/1.4.15/variants/itsybitsy32u4 /tmp/arduino/sketches/5DD7AD486AC39BA7E1BDA250FDC110C8/sketch/itsy-serial.ino.cpp
-o /dev/null
To reproduce
Dockerfile:
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
ARG CLI_SRC_URL=https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh
ARG CLI_VERSION=nightly-latest
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 $CLI_SRC_URL | sh -s $CLI_VERSION && \
ln -s /arduino/bin/arduino-cli /arduino/bin/acli && \
acli core update-index && \
acli core install arduino:avr && \
acli core install adafruit:avr
Expected behavior
I expect USB_VID
, USB_PID
, USB_MANUFACTURER
, and USB_PRODUCT
to be populated into the build chain from boards.txt
Arduino CLI version
nightly-20240131 Commit: 205a6a5 Date: 2024-01-31T01:26:52Z
Operating system
Linux
Operating system version
6.5.0-14-generic #14~22.04.1-Ubuntu
Additional context
$ docker version
Client:
Version: 24.0.5
API version: 1.43
Go version: go1.20.3
Git commit: 24.0.5-0ubuntu1~22.04.1
Built: Mon Aug 21 19:50:14 2023
OS/Arch: linux/amd64
Context: default
Server:
Engine:
Version: 24.0.5
API version: 1.43 (minimum version 1.12)
Go version: go1.20.3
Git commit: 24.0.5-0ubuntu1~22.04.1
Built: Mon Aug 21 19:50:14 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.2
GitCommit:
runc:
Version: 1.1.7-0ubuntu1~22.04.1
GitCommit:
docker-init:
Version: 0.19.0
GitCommit:
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