Skip to contentSkip to conversation

package/avrdude: disable Python support to fix build issues

PATCH Applied Thomas Petazzoni via buildroot 1 participant 3 messages Aug 29, 2025 – Sep 11, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/avrdude: disable Python support to fix build issues

The build of avrdude sometimes fails with:

avrdude: installs files in /home/autobuild/autobuild/instance-1/output-1/target//home/autobuild/autobuild/instance-1/output-1

This is due to an issue in the installation logic for the Python code. However, our avrdude.mk doesn't explicitly support building avrdude's Python support, so it's really only by luck (or lack thereof) that sometimes host-swig and python3 end up built before avrdude, causing avrdude to build its Python support, which installs at the wrong location.

In order to address this, we add a small patch, submitted upstream, that allows to explicitly disable Python support, which we then use in avrdude.mk.

The actual Python issue can be investigated at a later point if someone needs it. But in any case, being able to explicitly disable Python support if not needed is useful.

Fixes:

http://autobuild.buildroot.net/results/f18d47289d8b4dee768275a468c25b4f4399cf8c/

---
 ...s.txt-allow-disabling-Python-support.patch | 59 +++++++++++++++++++
 package/avrdude/avrdude.mk                    |  2 +-
 2 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 package/avrdude/0001-CMakeLists.txt-allow-disabling-Python-support.patch
package/avrdude/0001-CMakeLists.txt-allow-disabling-Python-support.patch new file +59 -0
new file mode 100644
index 0000000000..fc6210c099
@@ -0,0 +1,59 @@
+From 41ee27cf1d31bbc62425aab286b7e524acc64bff Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <[email protected]>
+Date: Fri, 29 Aug 2025 22:21:50 +0200
+Subject: [PATCH] CMakeLists.txt: allow disabling Python support
+
+In some cases, even if Swig is found and Python3 is found, it may not
+be desirable to build Python support in avrdude, so this commit adds
+an ENABLE_PYTHON_SUPPORT option to be able to explicitly disable using
+Python support (unfortunately CMake doesn't allow passing arguments
+that would prevent it from finding Swig/Python 3 if available).
+
+To preserve existing behavior, this option defaults to enabled (ON).
+
+Upstream: https://github.com/avrdudes/avrdude/pull/2051
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ CMakeLists.txt | 19 +++++++++++--------
+ 1 file changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7f3fce92..94263bab 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -34,6 +34,7 @@ option(USE_EXTERNAL_LIBS "Use external libraries from AVRDUDE GitHub repositorie
+ option(USE_LIBUSBWIN32 "Prefer libusb-win32 over libusb" OFF)
+ option(DEBUG_CMAKE "Enable debugging output for this CMake project" OFF)
+ option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
++option(ENABLE_PYTHON_SUPPORT "Enable Python support" ON)
+ 
+ if(WIN32)
+     # Prefer static libraries over DLLs on Windows
+@@ -281,14 +282,16 @@ if(HAVE_LINUXGPIO)
+ endif()
+ 
+ # -------------------------------------
+-# Find SWIG
+-find_package(SWIG 4.0 COMPONENTS python)
+-if(SWIG_FOUND)
+-  find_package(Python3 COMPONENTS Interpreter Development)
+-  if(PYTHON3_FOUND)
+-    set(HAVE_SWIG 1)
+-  else()
+-    message(STATUS "Found SWIG but no Python3 header/library; cannot use SWIG")
++# Find SWIG/Python3 if needed
++if(ENABLE_PYTHON_SUPPORT)
++  find_package(SWIG 4.0 COMPONENTS python)
++  if(SWIG_FOUND)
++    find_package(Python3 COMPONENTS Interpreter Development)
++    if(PYTHON3_FOUND)
++      set(HAVE_SWIG 1)
++    else()
++      message(STATUS "Found SWIG but no Python3 header/library; cannot use SWIG")
++    endif()
+   endif()
+ endif()
+ 
+-- 
+2.50.1
+
package/avrdude/avrdude.mk +1 -1
index 79447a6205..6f19e68341 100644
@@ -9,7 +9,7 @@ AVRDUDE_SITE = $(call github,avrdudes,avrdude,v$(AVRDUDE_VERSION))
 AVRDUDE_LICENSE = GPL-2.0+
 AVRDUDE_LICENSE_FILES = COPYING
 
-AVRDUDE_CONF_OPTS = -DHAVE_LINUXGPIO=ON
+AVRDUDE_CONF_OPTS = -DHAVE_LINUXGPIO=ON -DENABLE_PYTHON_SUPPORT=NO
 AVRDUDE_DEPENDENCIES = elfutils libusb libusb-compat ncurses \
 	host-flex host-bison
 
Signature · 6 lines
2.50.1

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

"Thomas" == Thomas Petazzoni via buildroot <[email protected]> writes:

The build of avrdude sometimes fails with:
avrdude: installs files in /home/autobuild/autobuild/instance-1/output-1/target//home/autobuild/autobuild/instance-1/output-1

This is due to an issue in the installation logic for the Python code. However, our avrdude.mk doesn't explicitly support building avrdude's Python support, so it's really only by luck (or lack thereof) that sometimes host-swig and python3 end up built before avrdude, causing avrdude to build its Python support, which installs at the wrong location.

In order to address this, we add a small patch, submitted upstream, that allows to explicitly disable Python support, which we then use in avrdude.mk.

The actual Python issue can be investigated at a later point if someone needs it. But in any case, being able to explicitly disable Python support if not needed is useful.

Quoted 5 lines

Fixes:

http://autobuild.buildroot.net/results/f18d47289d8b4dee768275a468c25b4f4399cf8c/

Committed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Thomas Petazzoni via buildroot

In reply of:

Quoted 19 lines

The build of avrdude sometimes fails with:

avrdude: installs files in /home/autobuild/autobuild/instance-1/output-1/target//home/autobuild/autobuild/instance-1/output-1

This is due to an issue in the installation logic for the Python code. However, our avrdude.mk doesn't explicitly support building avrdude's Python support, so it's really only by luck (or lack thereof) that sometimes host-swig and python3 end up built before avrdude, causing avrdude to build its Python support, which installs at the wrong location.

In order to address this, we add a small patch, submitted upstream, that allows to explicitly disable Python support, which we then use in avrdude.mk.

The actual Python issue can be investigated at a later point if someone needs it. But in any case, being able to explicitly disable Python support if not needed is useful.

Quoted 5 lines

Fixes:

http://autobuild.buildroot.net/results/f18d47289d8b4dee768275a468c25b4f4399cf8c/

Applied to 2025.02.x & 2025.05.x. Thanks

Quoted 91 lines
---
 ...s.txt-allow-disabling-Python-support.patch | 59 +++++++++++++++++++
 package/avrdude/avrdude.mk                    |  2 +-
 2 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 package/avrdude/0001-CMakeLists.txt-allow-disabling-Python-support.patch
package/avrdude/0001-CMakeLists.txt-allow-disabling-Python-support.patch new file +59 -0
new file mode 100644
index 0000000000..fc6210c099
@@ -0,0 +1,59 @@
+From 41ee27cf1d31bbc62425aab286b7e524acc64bff Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <[email protected]>
+Date: Fri, 29 Aug 2025 22:21:50 +0200
+Subject: [PATCH] CMakeLists.txt: allow disabling Python support
+
+In some cases, even if Swig is found and Python3 is found, it may not
+be desirable to build Python support in avrdude, so this commit adds
+an ENABLE_PYTHON_SUPPORT option to be able to explicitly disable using
+Python support (unfortunately CMake doesn't allow passing arguments
+that would prevent it from finding Swig/Python 3 if available).
+
+To preserve existing behavior, this option defaults to enabled (ON).
+
+Upstream: https://github.com/avrdudes/avrdude/pull/2051
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ CMakeLists.txt | 19 +++++++++++--------
+ 1 file changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7f3fce92..94263bab 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -34,6 +34,7 @@ option(USE_EXTERNAL_LIBS "Use external libraries from AVRDUDE GitHub repositorie
+ option(USE_LIBUSBWIN32 "Prefer libusb-win32 over libusb" OFF)
+ option(DEBUG_CMAKE "Enable debugging output for this CMake project" OFF)
+ option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
++option(ENABLE_PYTHON_SUPPORT "Enable Python support" ON)
+ 
+ if(WIN32)
+     # Prefer static libraries over DLLs on Windows
+@@ -281,14 +282,16 @@ if(HAVE_LINUXGPIO)
+ endif()
+ 
+ # -------------------------------------
+-# Find SWIG
+-find_package(SWIG 4.0 COMPONENTS python)
+-if(SWIG_FOUND)
+-  find_package(Python3 COMPONENTS Interpreter Development)
+-  if(PYTHON3_FOUND)
+-    set(HAVE_SWIG 1)
+-  else()
+-    message(STATUS "Found SWIG but no Python3 header/library; cannot use SWIG")
++# Find SWIG/Python3 if needed
++if(ENABLE_PYTHON_SUPPORT)
++  find_package(SWIG 4.0 COMPONENTS python)
++  if(SWIG_FOUND)
++    find_package(Python3 COMPONENTS Interpreter Development)
++    if(PYTHON3_FOUND)
++      set(HAVE_SWIG 1)
++    else()
++      message(STATUS "Found SWIG but no Python3 header/library; cannot use SWIG")
++    endif()
+   endif()
+ endif()
+ 
+-- 
+2.50.1
+
package/avrdude/avrdude.mk +1 -1
index 79447a6205..6f19e68341 100644
@@ -9,7 +9,7 @@ AVRDUDE_SITE = $(call github,avrdudes,avrdude,v$(AVRDUDE_VERSION))
 AVRDUDE_LICENSE = GPL-2.0+
 AVRDUDE_LICENSE_FILES = COPYING
 
-AVRDUDE_CONF_OPTS = -DHAVE_LINUXGPIO=ON
+AVRDUDE_CONF_OPTS = -DHAVE_LINUXGPIO=ON -DENABLE_PYTHON_SUPPORT=NO
 AVRDUDE_DEPENDENCIES = elfutils libusb libusb-compat ncurses \
 	host-flex host-bison
 
Signature · 6 lines
2.50.1

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

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