Skip to contentSkip to conversation

package/avrdude: fix readline dependency

PATCH Superseded Yegor Yefremov via buildroot 2 participants 6 messages Oct 23 – Oct 30

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/avrdude: fix readline dependency

avrdude automatically detects and links against readline when it finds libreadline in the sysroot (find_library(HAVE_LIBREADLINE ...) in CMakeLists.txt; AC_CHECK_LIB([readline], [readline]) with the former autotools build system), and there is no option to disable it.

Buildroot never declared this dependency, so the result depended on whether readline happened to be built before avrdude. Even worse, some external toolchains (e.g. the Bootlin ones) ship libreadline in their sysroot. In that case avrdude ends up linked against it without BR2_PACKAGE_READLINE being enabled:

  $ readelf -d target/usr/bin/avrdude | grep readline
   0x0000000000000001 (NEEDED)    Shared library: [libreadline.so.8]

but libreadline is not installed to the target, so avrdude fails to run.

Add readline to the dependencies when it is enabled, and otherwise pass -DHAVE_LIBREADLINE=OFF, so that find_library() skips the search and readline support is disabled.

This issue has been present since commit dc776f0d0546 ("avrdude: new package"), as avrdude has always detected readline automatically. It therefore affects 2014.02 and later, including all maintained branches.

Fixes dc776f0d0546900b22d1552f3e522be2080016c6 ("avrdude: new package")
Assisted-by Claude:claude-opus-5-5
---
 package/avrdude/avrdude.mk | 6 ++++++
 1 file changed, 6 insertions(+)
package/avrdude/avrdude.mk +6 -0
index 8f451a7fdb..6d9ffe8625 100644
@@ -29,4 +29,10 @@ ifeq ($(BR2_PACKAGE_HIDAPI),y)
 AVRDUDE_DEPENDENCIES += hidapi
 endif
 
+ifeq ($(BR2_PACKAGE_READLINE),y)
+AVRDUDE_DEPENDENCIES += readline
+else
+AVRDUDE_CONF_OPTS += -DHAVE_LIBREADLINE=OFF
+endif
+
 $(eval $(cmake-package))
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH v2 1/2 package/avrdude: fix readline dependency

avrdude automatically detects and links against readline when it finds libreadline in the sysroot (find_library(HAVE_LIBREADLINE ...) in CMakeLists.txt; AC_CHECK_LIB([readline], [readline]) with the former autotools build system), and there is no option to disable it.

Buildroot never declared this dependency, so the result depended on whether readline happened to be built before avrdude. Even worse, some external toolchains (e.g. the Bootlin ones) ship libreadline in their sysroot. In that case avrdude ends up linked against it without BR2_PACKAGE_READLINE being enabled:

  $ readelf -d target/usr/bin/avrdude | grep readline
   0x0000000000000001 (NEEDED)    Shared library: [libreadline.so.8]

but libreadline is not installed to the target, so avrdude fails to run.

Add readline to the dependencies when it is enabled, and otherwise pass -DHAVE_LIBREADLINE=OFF, so that find_library() skips the search and readline support is disabled.

This issue has been present since commit dc776f0d0546 ("avrdude: new package"), as avrdude has always detected readline automatically. It therefore affects 2014.02 and later, including all maintained branches.

Fixes dc776f0d0546900b22d1552f3e522be2080016c6 ("avrdude: new package")
Assisted-by Claude:claude-opus-5-5

---
Changes v1 -> v2:
- rebased on master (avrdude 8.3)
- sent as a series together with the libserialport fix

 package/avrdude/avrdude.mk | 6 ++++++
 1 file changed, 6 insertions(+)
package/avrdude/avrdude.mk +6 -0
index 5708fe2017..476f031c99 100644
@@ -29,4 +29,10 @@ ifeq ($(BR2_PACKAGE_HIDAPI),y)
 AVRDUDE_DEPENDENCIES += hidapi
 endif
 
+ifeq ($(BR2_PACKAGE_READLINE),y)
+AVRDUDE_DEPENDENCIES += readline
+else
+AVRDUDE_CONF_OPTS += -DHAVE_LIBREADLINE=OFF
+endif
+
 $(eval $(cmake-package))
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

PATCH v2 2/2 package/avrdude: fix libserialport dependency

Since version 8.0, avrdude automatically detects and links against libserialport when it finds it in the sysroot (find_library(HAVE_LIBSERIALPORT ...) in CMakeLists.txt), and there is no option to disable it.

Buildroot doesn't declare this dependency, so whether avrdude gets libserialport support depends on the build order. With BR2_PACKAGE_LIBSERIALPORT=y, building avrdude before libserialport gives:

HAVE_LIBSERIALPORT:FILEPATH=HAVE_LIBSERIALPORT-NOTFOUND

while building libserialport first links avrdude against it. This makes the build non-reproducible.

Add libserialport to the dependencies when it is enabled, and otherwise pass -DHAVE_LIBSERIALPORT=OFF, so that find_library() skips the search and libserialport support is disabled.

This issue has been present since commit 0e16ff09e953 ("package/avrdude: bump to version 8.0"), as avrdude 8.0 added libserialport detection. It therefore affects 2025.05 and later.

Fixes 0e16ff09e9538d46c9726f8998080d55dfa5d41f ("package/avrdude: bump to version 8.0")
Assisted-by Claude:claude-opus-5-5

---
Changes v1 -> v2:
- new patch

 package/avrdude/avrdude.mk | 6 ++++++
 1 file changed, 6 insertions(+)
package/avrdude/avrdude.mk +6 -0
index 476f031c99..fbad44a191 100644
@@ -25,6 +25,12 @@ else ifeq ($(BR2_PACKAGE_LIBFTDI),y)
 AVRDUDE_DEPENDENCIES += libftdi
 endif
 
+ifeq ($(BR2_PACKAGE_LIBSERIALPORT),y)
+AVRDUDE_DEPENDENCIES += libserialport
+else
+AVRDUDE_CONF_OPTS += -DHAVE_LIBSERIALPORT=OFF
+endif
+
 ifeq ($(BR2_PACKAGE_HIDAPI),y)
 AVRDUDE_DEPENDENCIES += hidapi
 endif
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH v2 2/2] package/avrdude: fix libserialport dependency

In reply of:

Quoted 19 lines

Since version 8.0, avrdude automatically detects and links against libserialport when it finds it in the sysroot (find_library(HAVE_LIBSERIALPORT ...) in CMakeLists.txt), and there is no option to disable it.

Buildroot doesn't declare this dependency, so whether avrdude gets libserialport support depends on the build order. With BR2_PACKAGE_LIBSERIALPORT=y, building avrdude before libserialport gives:

HAVE_LIBSERIALPORT:FILEPATH=HAVE_LIBSERIALPORT-NOTFOUND

while building libserialport first links avrdude against it. This makes the build non-reproducible.

Add libserialport to the dependencies when it is enabled, and otherwise pass -DHAVE_LIBSERIALPORT=OFF, so that find_library() skips the search and libserialport support is disabled.

Quoted 7 lines

This issue has been present since commit 0e16ff09e953 ("package/avrdude: bump to version 8.0"), as avrdude 8.0 added libserialport detection. It therefore affects 2025.05 and later.

Fixes 0e16ff09e9538d46c9726f8998080d55dfa5d41f ("package/avrdude: bump to version 8.0")
Assisted-by Claude:claude-opus-5-5

Applied to 2026.08.x. Thanks

Quoted 14 lines

---
Changes v1 -> v2:
- new patch

 package/avrdude/avrdude.mk | 6 ++++++
 1 file changed, 6 insertions(+)
package/avrdude/avrdude.mk +0 -0
index 476f031c99..fbad44a191 100644
@@ -25,6 +25,12 @@ else ifeq ($(BR2_PACKAGE_LIBFTDI),y)
 AVRDUDE_DEPENDENCIES += libftdi
 endif

package/avrdude/avrdude.mk else ifeq ($(BR2_PACKAGE_LIBFTDI),y) · line 36

Quoted 10 lines
package/avrdude/avrdude.mk +6 -0
 
+ifeq ($(BR2_PACKAGE_LIBSERIALPORT),y)
+AVRDUDE_DEPENDENCIES += libserialport
+else
+AVRDUDE_CONF_OPTS += -DHAVE_LIBSERIALPORT=OFF
+endif
+
 ifeq ($(BR2_PACKAGE_HIDAPI),y)
 AVRDUDE_DEPENDENCIES += hidapi
 endif

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw
In reply to Yegor Yefremov
Quoted 21 lines · Yegor Yefremov

avrdude automatically detects and links against readline when it finds libreadline in the sysroot (find_library(HAVE_LIBREADLINE ...) in CMakeLists.txt; AC_CHECK_LIB([readline], [readline]) with the former autotools build system), and there is no option to disable it.

Buildroot never declared this dependency, so the result depended on whether readline happened to be built before avrdude. Even worse, some external toolchains (e.g. the Bootlin ones) ship libreadline in their sysroot. In that case avrdude ends up linked against it without BR2_PACKAGE_READLINE being enabled:

  $ readelf -d target/usr/bin/avrdude | grep readline
   0x0000000000000001 (NEEDED)    Shared library: [libreadline.so.8]

but libreadline is not installed to the target, so avrdude fails to run.

Add readline to the dependencies when it is enabled, and otherwise pass -DHAVE_LIBREADLINE=OFF, so that find_library() skips the search and readline support is disabled.

Quoted 8 lines

This issue has been present since commit dc776f0d0546 ("avrdude: new package"), as avrdude has always detected readline automatically. It therefore affects 2014.02 and later, including all maintained branches.

Fixes dc776f0d0546900b22d1552f3e522be2080016c6 ("avrdude: new package")
Assisted-by Claude:claude-opus-5-5

Series applied to master, thanks!

Best regards,

Thomas Petazzoni

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw
In reply to Yegor Yefremov

In reply of:

Quoted 21 lines

avrdude automatically detects and links against readline when it finds libreadline in the sysroot (find_library(HAVE_LIBREADLINE ...) in CMakeLists.txt; AC_CHECK_LIB([readline], [readline]) with the former autotools build system), and there is no option to disable it.

Buildroot never declared this dependency, so the result depended on whether readline happened to be built before avrdude. Even worse, some external toolchains (e.g. the Bootlin ones) ship libreadline in their sysroot. In that case avrdude ends up linked against it without BR2_PACKAGE_READLINE being enabled:

  $ readelf -d target/usr/bin/avrdude | grep readline
   0x0000000000000001 (NEEDED)    Shared library: [libreadline.so.8]

but libreadline is not installed to the target, so avrdude fails to run.

Add readline to the dependencies when it is enabled, and otherwise pass -DHAVE_LIBREADLINE=OFF, so that find_library() skips the search and readline support is disabled.

Quoted 8 lines

This issue has been present since commit dc776f0d0546 ("avrdude: new package"), as avrdude has always detected readline automatically. It therefore affects 2014.02 and later, including all maintained branches.

Fixes dc776f0d0546900b22d1552f3e522be2080016c6 ("avrdude: new package")
Assisted-by Claude:claude-opus-5-5

Applied to 2025.02.x, 2026.08.x. Thanks

Quoted 13 lines

---
Changes v1 -> v2:
- rebased on master (avrdude 8.3)
- sent as a series together with the libserialport fix

 package/avrdude/avrdude.mk | 6 ++++++
 1 file changed, 6 insertions(+)
package/avrdude/avrdude.mk +0 -0
index 5708fe2017..476f031c99 100644

package/avrdude/avrdude.mk ifeq ($(BR2_PACKAGE_HIDAPI),y) · line 38

Quoted 10 lines
package/avrdude/avrdude.mk +6 -0
@@ -29,4 +29,10 @@ ifeq ($(BR2_PACKAGE_HIDAPI),y)
 AVRDUDE_DEPENDENCIES += hidapi
 endif
 
+ifeq ($(BR2_PACKAGE_READLINE),y)
+AVRDUDE_DEPENDENCIES += readline
+else
+AVRDUDE_CONF_OPTS += -DHAVE_LIBREADLINE=OFF
+endif
+
 $(eval $(cmake-package))

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot