Bug#856870: arduino-mk: Still a problem in 2024

Akkana Peck dev at shallowsky.com
Wed Apr 24 20:29:25 BST 2024


Package: arduino-mk
Version: 1.5.2-2.1
Followup-For: Bug #856870
X-Debbugs-Cc: dev at shallowsky.com

Dear Maintainer,

This bug is still a problem in April 2024. I built in an old project that used to work with arduino-mk, but now, make-upload fails with:

<charon>- make upload                                       ~/src/arduino/blink
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED]       CURRENT_OS = LINUX
- [AUTODETECTED]       ARDUINO_DIR = /usr/share/arduino
- [COMPUTED]           ARDMK_DIR = /usr/share/arduino (relative to Common.mk)
- [AUTODETECTED]       ARDUINO_VERSION = 1819
- [DEFAULT]            ARCHITECTURE = avr
- [DEFAULT]            ARDMK_VENDOR = arduino
- [AUTODETECTED]       ARDUINO_PREFERENCES_PATH = /home/akkana/.arduino15/preferences.txt
- [AUTODETECTED]       ARDUINO_SKETCHBOOK = /home/akkana/Arduino (from arduino preferences file)
- [BUNDLED]            AVR_TOOLS_DIR = /usr/share/arduino/hardware/tools/avr (in Arduino distribution)
- [COMPUTED]           ARDUINO_LIB_PATH = /usr/share/arduino/libraries (from ARDUINO_DIR)
- [COMPUTED]           ARDUINO_PLATFORM_LIB_PATH = /usr/share/arduino/hardware/arduino/avr/libraries (from ARDUINO_DIR)
- [COMPUTED]           ARDUINO_VAR_PATH = /usr/share/arduino/hardware/arduino/avr/variants (from ARDUINO_DIR)
- [COMPUTED]           BOARDS_TXT = /usr/share/arduino/hardware/arduino/avr/boards.txt (from ARDUINO_DIR)
- [DEFAULT]            USER_LIB_PATH = /home/akkana/Arduino/libraries (in user sketchbook)
- [DEFAULT]            PRE_BUILD_HOOK = pre-build-hook.sh
- [USER]               BOARD_TAG = uno
- [COMPUTED]           CORE = arduino (from build.core)
- [COMPUTED]           VARIANT = standard (from build.variant)
- [COMPUTED]           OBJDIR = build-uno (from BOARD_TAG)
- [COMPUTED]           ARDUINO_CORE_PATH = /usr/share/arduino/hardware/arduino/avr/cores/arduino (from ARDUINO_DIR, BOARD_TAG and boards.txt)
- [ASSUMED]            MONITOR_BAUDRATE = 9600
- [DEFAULT]            OPTIMIZATION_LEVEL = s
- [DEFAULT]            MCU_FLAG_NAME = mmcu
- [DEFAULT]            CFLAGS_STD = -std=gnu11 -flto -fno-fat-lto-objects
- [DEFAULT]            CXXFLAGS_STD = -std=gnu++11 -fno-threadsafe-statics -flto
- [AUTODETECTED]       DEVICE_PATH = /dev/ttyACM0
- [DEFAULT]            FORCE_MONITOR_PORT =
- [AUTODETECTED]       Size utility: AVR-aware for enhanced output
- [COMPUTED]           BOOTLOADER_PARENT = /usr/share/arduino/hardware/arduino/avr/bootloaders (from ARDUINO_DIR)
- [COMPUTED]           ARDMK_VERSION = 1.5
- [COMPUTED]           CC_VERSION = 7.3.0 (avr-gcc)
-------------------------
mkdir -p build-uno
make reset
make[1]: Entering directory '/home/akkana/src/arduino/blink'
/usr/bin/ard-reset-arduino  /dev/ttyACM0
make[1]: Leaving directory '/home/akkana/src/arduino/blink'
make do_upload
make[1]: Entering directory '/home/akkana/src/arduino/blink'
/usr/share/arduino/hardware/tools/avr/bin/avrdude -q -V -p atmega328p -C /usr/share/arduino/hardware/tools/avr/etc/avrdude.conf -D -c arduino -b 115200 -P /dev/ttyACM0 \
		-U flash:w:build-uno/blink_.hex:i
avrdude warning: cannot determine realpath() of config file /usr/share/arduino/hardware/tools/avr/etc/avrdude.conf: No such file or directory
avrdude OS error: cannot determine realpath() of config file (null): Invalid argument
avrdude error: unable to process system wide configuration file (null)
make[1]: *** [/usr/share/arduino/Arduino.mk:1462: do_upload] Error 1
make[1]: Leaving directory '/home/akkana/src/arduino/blink'
make: *** [/usr/share/arduino/Arduino.mk:1455: upload] Error 2

The problem is the same as mentioned earlier in this bug: it's running avrdude with
    -C /usr/share/arduino/hardware/tools/avr/etc/avrdude.conf
when the package actually installs that file as:
       /usr/share/arduino/hardware/tools/avrdude.conf


Running the following command by hand successfully installs the binary:

/usr/share/arduino/hardware/tools/avr/bin/avrdude -q -V -p atmega328p -C /usr/share/arduino/hardware/tools/avrdude.conf  -D -c arduino -b 115200 -P /dev/ttyACM0 -U flash:w:build-uno/blink_.hex:i

The arduino-mk package should be changed to reflect where the arduino package is actually installing avrdude.conf (dpkg -S says it comes from arduino, not from avrdude, oddly enough).

The problematic lines seem to be in Arduino.mk around line 426: it's comparing whether $(ARDUINO_VERSION) is greater than 157, and the logic earlier for calculating $ARDUINO_VERSION is rather complicated, but it ends up doing
    cat /usr/share/arduino/lib/version.txt  | sed -e 's/^[0-9]://g' -e 's/[.]//g' -e 's/\+.*//g' | head -c5
which ends up with ARDUINO_VERSION = 1819, so it's greater than 157, but the path is actually in the place specified for versions less than 157. Maybe it moved, then moved back?

As a workaround, I commented out the version check as follows:

            ifndef AVRDUDE_CONF
                # ifeq ($(shell expr $(ARDUINO_VERSION) '>' 157), 1)
                #     AVRDUDE_CONF = $(AVR_TOOLS_DIR)/etc/avrdude.conf
                #  else
                    AVRDUDE_CONF = $(AVR_TOOLS_DIR)/../avrdude.conf
                # endif
            endif

and now make upload correctly uploads sketches to an Uno.


-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (600, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.7.9-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages arduino-mk depends on:
ii  arduino         2:1.8.19+dfsg1-2
ii  make            4.3-4.1
ii  python3         3.11.8-1
ii  python3-serial  3.5-2

Versions of packages arduino-mk recommends:
pn  screen  <none>

arduino-mk suggests no packages.

-- no debconf information



More information about the debian-science-maintainers mailing list