Skip to contentSkip to conversation

qemu: add support for python3

PATCH New Adam Duskett 5 participants 10 messages Sep 4, 2018 – Sep 10, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 qemu: add support for python3

qemu 2.12.0 now supports building against python3.
see: https://wiki.qemu.org/ChangeLog/2.12#Build_Dependencies

---
Changes v1 -> v2:
- Split the python version check into two seperate checks for readability, one for the target, one for the host.
- Fix location of the python version check for target and host.

 package/qemu/qemu.mk | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)
package/qemu/qemu.mk +22 -5
index afb2aa92f6..6dd9ce4a62 100644
@@ -16,7 +16,7 @@ QEMU_LICENSE_FILES = COPYING COPYING.LIB
 #-------------------------------------------------------------
 # Target-qemu
 
-QEMU_DEPENDENCIES = host-pkgconf host-python libglib2 zlib pixman
+QEMU_DEPENDENCIES = host-pkgconf libglib2 zlib pixman
 
 # Need the LIBS variable because librt and libm are
 # not automatically pulled. :-(
@@ -25,9 +25,19 @@ QEMU_LIBS = -lrt -lm
 QEMU_OPTS =
 
 QEMU_VARS = \
-	LIBTOOL=$(HOST_DIR)/bin/libtool \
-	PYTHON=$(HOST_DIR)/bin/python2 \
+	LIBTOOL=$(HOST_DIR)/bin/libtool
+
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+QEMU_DEPENDENCIES += host-python3
+QEMU_VARS += \
+	PYTHON=$(HOST_DIR)/bin/python3 \
+	PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages
+else
+QEMU_DEPENDENCIES += host-python
+QEMU_VARS += \
+	PYTHON=$(HOST_DIR)/bin/python \
 	PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
+endif
 
 # If we want to specify only a subset of targets, we must still enable all
 # of them, so that QEMU properly builds its list of default targets, from
@@ -150,7 +160,7 @@ $(eval $(generic-package))
 #-------------------------------------------------------------
 # Host-qemu
 
-HOST_QEMU_DEPENDENCIES = host-pkgconf host-python host-zlib host-libglib2 host-pixman
+HOST_QEMU_DEPENDENCIES = host-pkgconf host-zlib host-libglib2 host-pixman
 
 #       BR ARCH         qemu
 #       -------         ----
@@ -263,12 +273,19 @@ define HOST_QEMU_CONFIGURE_CMDS
 		--interp-prefix=$(STAGING_DIR) \
 		--cc="$(HOSTCC)" \
 		--host-cc="$(HOSTCC)" \
-		--python=$(HOST_DIR)/bin/python2 \
 		--extra-cflags="$(HOST_CFLAGS)" \
 		--extra-ldflags="$(HOST_LDFLAGS)" \
 		$(HOST_QEMU_OPTS)
 endef
 
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+HOST_QEMU_DEPENDENCIES += host-python3
+HOST_QEMU_CONFIGURE_CMDS += --python=$(HOST_DIR)/bin/python3
+else
+HOST_QEMU_DEPENDENCIES += host-python
+HOST_QEMU_CONFIGURE_CMDS += --python=$(HOST_DIR)/bin/python2
+endif
+
 define HOST_QEMU_BUILD_CMDS
 	$(HOST_MAKE_ENV) $(MAKE) -C $(@D)
 endef
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/1 qemu: add support for python3

Hi Adam,

Quoted 35 lines · Adam Duskett

qemu 2.12.0 now supports building against python3.
see: https://wiki.qemu.org/ChangeLog/2.12#Build_Dependencies

---
Changes v1 -> v2:
- Split the python version check into two seperate checks for readability, one for the target, one for the host.
- Fix location of the python version check for target and host.

 package/qemu/qemu.mk | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)
package/qemu/qemu.mk +4 -3
index afb2aa92f6..6dd9ce4a62 100644
@@ -16,7 +16,7 @@ QEMU_LICENSE_FILES = COPYING COPYING.LIB
 #-------------------------------------------------------------
 # Target-qemu
 
-QEMU_DEPENDENCIES = host-pkgconf host-python libglib2 zlib pixman
+QEMU_DEPENDENCIES = host-pkgconf libglib2 zlib pixman
 
 # Need the LIBS variable because librt and libm are
 # not automatically pulled. :-(
@@ -25,9 +25,19 @@ QEMU_LIBS = -lrt -lm
 QEMU_OPTS =
 
 QEMU_VARS = \
-	LIBTOOL=$(HOST_DIR)/bin/libtool \
-	PYTHON=$(HOST_DIR)/bin/python2 \
+	LIBTOOL=$(HOST_DIR)/bin/libtool
+
+ifeq ($(BR2_PACKAGE_PYTHON3),y)

package/qemu/qemu.mk QEMU_LIBS = -lrt -lm · line 40

Quoted 10 lines
package/qemu/qemu.mk +9 -0
+QEMU_DEPENDENCIES += host-python3
+QEMU_VARS += \
+	PYTHON=$(HOST_DIR)/bin/python3 \
+	PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages
+else
+QEMU_DEPENDENCIES += host-python
+QEMU_VARS += \
+	PYTHON=$(HOST_DIR)/bin/python \
 	PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
+endif

Can't we use the host installed python? Python is already a dependency of Buildroot.

baruch

Quoted 32 lines
package/qemu/qemu.mk +9 -2
 # If we want to specify only a subset of targets, we must still enable all
 # of them, so that QEMU properly builds its list of default targets, from
@@ -150,7 +160,7 @@ $(eval $(generic-package))
 #-------------------------------------------------------------
 # Host-qemu
 
-HOST_QEMU_DEPENDENCIES = host-pkgconf host-python host-zlib host-libglib2 host-pixman
+HOST_QEMU_DEPENDENCIES = host-pkgconf host-zlib host-libglib2 host-pixman
 
 #       BR ARCH         qemu
 #       -------         ----
@@ -263,12 +273,19 @@ define HOST_QEMU_CONFIGURE_CMDS
 		--interp-prefix=$(STAGING_DIR) \
 		--cc="$(HOSTCC)" \
 		--host-cc="$(HOSTCC)" \
-		--python=$(HOST_DIR)/bin/python2 \
 		--extra-cflags="$(HOST_CFLAGS)" \
 		--extra-ldflags="$(HOST_LDFLAGS)" \
 		$(HOST_QEMU_OPTS)
 endef
 
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+HOST_QEMU_DEPENDENCIES += host-python3
+HOST_QEMU_CONFIGURE_CMDS += --python=$(HOST_DIR)/bin/python3
+else
+HOST_QEMU_DEPENDENCIES += host-python
+HOST_QEMU_CONFIGURE_CMDS += --python=$(HOST_DIR)/bin/python2
+endif
+
 define HOST_QEMU_BUILD_CMDS
 	$(HOST_MAKE_ENV) $(MAKE) -C $(@D)
 endef
Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#2 lore raw

PATCH v2 1/1 qemu: add support for python3

I'm not sure;

We support Distributions as old as CentOS6, which have very very old versions of Python...

Quoted 92 lines · Baruch Siach

Hi Adam,

Quoted 35 lines · Adam Duskett

qemu 2.12.0 now supports building against python3.
see: https://wiki.qemu.org/ChangeLog/2.12#Build_Dependencies

---
Changes v1 -> v2:
- Split the python version check into two seperate checks for readability, one for the target, one for the host.
- Fix location of the python version check for target and host.

 package/qemu/qemu.mk | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)
package/qemu/qemu.mk +4 -3
index afb2aa92f6..6dd9ce4a62 100644
@@ -16,7 +16,7 @@ QEMU_LICENSE_FILES = COPYING COPYING.LIB
 #-------------------------------------------------------------
 # Target-qemu
 
-QEMU_DEPENDENCIES = host-pkgconf host-python libglib2 zlib pixman
+QEMU_DEPENDENCIES = host-pkgconf libglib2 zlib pixman
 
 # Need the LIBS variable because librt and libm are
 # not automatically pulled. :-(
@@ -25,9 +25,19 @@ QEMU_LIBS = -lrt -lm
 QEMU_OPTS =
 
 QEMU_VARS = \
-     LIBTOOL=$(HOST_DIR)/bin/libtool \
-     PYTHON=$(HOST_DIR)/bin/python2 \
+     LIBTOOL=$(HOST_DIR)/bin/libtool
+
+ifeq ($(BR2_PACKAGE_PYTHON3),y)

package/qemu/qemu.mk QEMU_LIBS = -lrt -lm · line 40

Quoted 10 lines
package/qemu/qemu.mk +9 -0
+QEMU_DEPENDENCIES += host-python3
+QEMU_VARS += \
+     PYTHON=$(HOST_DIR)/bin/python3 \
+     PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages
+else
+QEMU_DEPENDENCIES += host-python
+QEMU_VARS += \
+     PYTHON=$(HOST_DIR)/bin/python \
      PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
+endif

Can't we use the host installed python? Python is already a dependency of Buildroot.

baruch

Quoted 22 lines
package/qemu/qemu.mk +2 -2
 # If we want to specify only a subset of targets, we must still enable all
 # of them, so that QEMU properly builds its list of default targets, from
@@ -150,7 +160,7 @@ $(eval $(generic-package))
 #-------------------------------------------------------------
 # Host-qemu
 
-HOST_QEMU_DEPENDENCIES = host-pkgconf host-python host-zlib host-libglib2 host-pixman
+HOST_QEMU_DEPENDENCIES = host-pkgconf host-zlib host-libglib2 host-pixman
 
 #       BR ARCH         qemu
 #       -------         ----
@@ -263,12 +273,19 @@ define HOST_QEMU_CONFIGURE_CMDS
              --interp-prefix=$(STAGING_DIR) \
              --cc="$(HOSTCC)" \
              --host-cc="$(HOSTCC)" \
-             --python=$(HOST_DIR)/bin/python2 \
              --extra-cflags="$(HOST_CFLAGS)" \
              --extra-ldflags="$(HOST_LDFLAGS)" \
              $(HOST_QEMU_OPTS)
 endef
 
+ifeq ($(BR2_PACKAGE_PYTHON3),y)

package/qemu/qemu.mk define HOST_QEMU_CONFIGURE_CMDS · line 291

Quoted 10 lines
package/qemu/qemu.mk +7 -0
+HOST_QEMU_DEPENDENCIES += host-python3
+HOST_QEMU_CONFIGURE_CMDS += --python=$(HOST_DIR)/bin/python3
+else
+HOST_QEMU_DEPENDENCIES += host-python
+HOST_QEMU_CONFIGURE_CMDS += --python=$(HOST_DIR)/bin/python2
+endif
+
 define HOST_QEMU_BUILD_CMDS
      $(HOST_MAKE_ENV) $(MAKE) -C $(@D)
 endef

--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

#3 lore raw

PATCH v2 1/1 qemu: add support for python3

Hi Adam,

Quoted 4 lines · Adam Duskett

I'm not sure;

We support Distributions as old as CentOS6, which have very very old versions of Python...

Buildroot requires Python version 2.6 or newer:

https://buildroot.org/downloads/manual/manual.html#requirement-mandatory

Can Python 2.6 build qemu?

baruch

Quoted 85 lines · Baruch Siach
Quoted 84 lines
Quoted 35 lines · Adam Duskett

qemu 2.12.0 now supports building against python3.
see: https://wiki.qemu.org/ChangeLog/2.12#Build_Dependencies

---
Changes v1 -> v2:
- Split the python version check into two seperate checks for readability, one for the target, one for the host.
- Fix location of the python version check for target and host.

 package/qemu/qemu.mk | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)
package/qemu/qemu.mk +4 -3
index afb2aa92f6..6dd9ce4a62 100644
@@ -16,7 +16,7 @@ QEMU_LICENSE_FILES = COPYING COPYING.LIB
 #-------------------------------------------------------------
 # Target-qemu
 
-QEMU_DEPENDENCIES = host-pkgconf host-python libglib2 zlib pixman
+QEMU_DEPENDENCIES = host-pkgconf libglib2 zlib pixman
 
 # Need the LIBS variable because librt and libm are
 # not automatically pulled. :-(
@@ -25,9 +25,19 @@ QEMU_LIBS = -lrt -lm
 QEMU_OPTS =
 
 QEMU_VARS = \
-     LIBTOOL=$(HOST_DIR)/bin/libtool \
-     PYTHON=$(HOST_DIR)/bin/python2 \
+     LIBTOOL=$(HOST_DIR)/bin/libtool
+
+ifeq ($(BR2_PACKAGE_PYTHON3),y)

package/qemu/qemu.mk QEMU_LIBS = -lrt -lm · line 40

Quoted 10 lines
package/qemu/qemu.mk +9 -0
+QEMU_DEPENDENCIES += host-python3
+QEMU_VARS += \
+     PYTHON=$(HOST_DIR)/bin/python3 \
+     PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages
+else
+QEMU_DEPENDENCIES += host-python
+QEMU_VARS += \
+     PYTHON=$(HOST_DIR)/bin/python \
      PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
+endif

Can't we use the host installed python? Python is already a dependency of Buildroot.

baruch

Quoted 32 lines
package/qemu/qemu.mk +9 -2
 # If we want to specify only a subset of targets, we must still enable all
 # of them, so that QEMU properly builds its list of default targets, from
@@ -150,7 +160,7 @@ $(eval $(generic-package))
 #-------------------------------------------------------------
 # Host-qemu
 
-HOST_QEMU_DEPENDENCIES = host-pkgconf host-python host-zlib host-libglib2 host-pixman
+HOST_QEMU_DEPENDENCIES = host-pkgconf host-zlib host-libglib2 host-pixman
 
 #       BR ARCH         qemu
 #       -------         ----
@@ -263,12 +273,19 @@ define HOST_QEMU_CONFIGURE_CMDS
              --interp-prefix=$(STAGING_DIR) \
              --cc="$(HOSTCC)" \
              --host-cc="$(HOSTCC)" \
-             --python=$(HOST_DIR)/bin/python2 \
              --extra-cflags="$(HOST_CFLAGS)" \
              --extra-ldflags="$(HOST_LDFLAGS)" \
              $(HOST_QEMU_OPTS)
 endef
 
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+HOST_QEMU_DEPENDENCIES += host-python3
+HOST_QEMU_CONFIGURE_CMDS += --python=$(HOST_DIR)/bin/python3
+else
+HOST_QEMU_DEPENDENCIES += host-python
+HOST_QEMU_CONFIGURE_CMDS += --python=$(HOST_DIR)/bin/python2
+endif
+
 define HOST_QEMU_BUILD_CMDS
      $(HOST_MAKE_ENV) $(MAKE) -C $(@D)
 endef
Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#4 lore raw

PATCH v2 1/1 qemu: add support for python3

Hey Baruch;

How would I test this? I am used to having BuildRoot handle the paths for such dependencies.

Quoted 107 lines · Baruch Siach

Hi Adam,

Quoted 4 lines · Adam Duskett

I'm not sure;

We support Distributions as old as CentOS6, which have very very old versions of Python...

Buildroot requires Python version 2.6 or newer:

https://buildroot.org/downloads/manual/manual.html#requirement-mandatory

Can Python 2.6 build qemu?

baruch

Quoted 74 lines · Baruch Siach
Quoted 73 lines
Quoted 35 lines · Adam Duskett

qemu 2.12.0 now supports building against python3.
see: https://wiki.qemu.org/ChangeLog/2.12#Build_Dependencies

---
Changes v1 -> v2:
- Split the python version check into two seperate checks for readability, one for the target, one for the host.
- Fix location of the python version check for target and host.

 package/qemu/qemu.mk | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)
package/qemu/qemu.mk +4 -3
index afb2aa92f6..6dd9ce4a62 100644
@@ -16,7 +16,7 @@ QEMU_LICENSE_FILES = COPYING COPYING.LIB
 #-------------------------------------------------------------
 # Target-qemu
 
-QEMU_DEPENDENCIES = host-pkgconf host-python libglib2 zlib pixman
+QEMU_DEPENDENCIES = host-pkgconf libglib2 zlib pixman
 
 # Need the LIBS variable because librt and libm are
 # not automatically pulled. :-(
@@ -25,9 +25,19 @@ QEMU_LIBS = -lrt -lm
 QEMU_OPTS =
 
 QEMU_VARS = \
-     LIBTOOL=$(HOST_DIR)/bin/libtool \
-     PYTHON=$(HOST_DIR)/bin/python2 \
+     LIBTOOL=$(HOST_DIR)/bin/libtool
+
+ifeq ($(BR2_PACKAGE_PYTHON3),y)

package/qemu/qemu.mk QEMU_LIBS = -lrt -lm · line 40

Quoted 10 lines
package/qemu/qemu.mk +9 -0
+QEMU_DEPENDENCIES += host-python3
+QEMU_VARS += \
+     PYTHON=$(HOST_DIR)/bin/python3 \
+     PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages
+else
+QEMU_DEPENDENCIES += host-python
+QEMU_VARS += \
+     PYTHON=$(HOST_DIR)/bin/python \
      PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
+endif

Can't we use the host installed python? Python is already a dependency of Buildroot.

baruch

Quoted 21 lines
package/qemu/qemu.mk +1 -2
 # If we want to specify only a subset of targets, we must still enable all
 # of them, so that QEMU properly builds its list of default targets, from
@@ -150,7 +160,7 @@ $(eval $(generic-package))
 #-------------------------------------------------------------
 # Host-qemu
 
-HOST_QEMU_DEPENDENCIES = host-pkgconf host-python host-zlib host-libglib2 host-pixman
+HOST_QEMU_DEPENDENCIES = host-pkgconf host-zlib host-libglib2 host-pixman
 
 #       BR ARCH         qemu
 #       -------         ----
@@ -263,12 +273,19 @@ define HOST_QEMU_CONFIGURE_CMDS
              --interp-prefix=$(STAGING_DIR) \
              --cc="$(HOSTCC)" \
              --host-cc="$(HOSTCC)" \
-             --python=$(HOST_DIR)/bin/python2 \
              --extra-cflags="$(HOST_CFLAGS)" \
              --extra-ldflags="$(HOST_LDFLAGS)" \
              $(HOST_QEMU_OPTS)
 endef
 
Quoted 11 lines
Quoted 11 lines

package/qemu/qemu.mk define HOST_QEMU_CONFIGURE_CMDS · line 291

Quoted 11 lines
package/qemu/qemu.mk +8 -0
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+HOST_QEMU_DEPENDENCIES += host-python3
+HOST_QEMU_CONFIGURE_CMDS += --python=$(HOST_DIR)/bin/python3
+else
+HOST_QEMU_DEPENDENCIES += host-python
+HOST_QEMU_CONFIGURE_CMDS += --python=$(HOST_DIR)/bin/python2
+endif
+
 define HOST_QEMU_BUILD_CMDS
      $(HOST_MAKE_ENV) $(MAKE) -C $(@D)
 endef

--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

#5 lore raw

PATCH v2 1/1 qemu: add support for python3

Hi Adam,

Quoted 2 lines · Adam Duskett

How would I test this? I am used to having BuildRoot handle the paths for such dependencies.

Just send RFC patch that you tested on your host with whatever Python version you have installed. There are a number of participants in this list that have access to hosts running RHEL6 or its derivatives.

With host installed Python being used there might be no need to explicitly set the path of the Python executable, isn't it?

baruch

Quoted 91 lines · Baruch Siach
Quoted 90 lines

Hi Adam,

Quoted 4 lines · Adam Duskett

I'm not sure;

We support Distributions as old as CentOS6, which have very very old versions of Python...

Buildroot requires Python version 2.6 or newer:

https://buildroot.org/downloads/manual/manual.html#requirement-mandatory

Can Python 2.6 build qemu?

baruch

Quoted 74 lines · Baruch Siach
Quoted 73 lines
Quoted 35 lines · Adam Duskett

qemu 2.12.0 now supports building against python3.
see: https://wiki.qemu.org/ChangeLog/2.12#Build_Dependencies

---
Changes v1 -> v2:
- Split the python version check into two seperate checks for readability, one for the target, one for the host.
- Fix location of the python version check for target and host.

 package/qemu/qemu.mk | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)
package/qemu/qemu.mk +4 -3
index afb2aa92f6..6dd9ce4a62 100644
@@ -16,7 +16,7 @@ QEMU_LICENSE_FILES = COPYING COPYING.LIB
 #-------------------------------------------------------------
 # Target-qemu
 
-QEMU_DEPENDENCIES = host-pkgconf host-python libglib2 zlib pixman
+QEMU_DEPENDENCIES = host-pkgconf libglib2 zlib pixman
 
 # Need the LIBS variable because librt and libm are
 # not automatically pulled. :-(
@@ -25,9 +25,19 @@ QEMU_LIBS = -lrt -lm
 QEMU_OPTS =
 
 QEMU_VARS = \
-     LIBTOOL=$(HOST_DIR)/bin/libtool \
-     PYTHON=$(HOST_DIR)/bin/python2 \
+     LIBTOOL=$(HOST_DIR)/bin/libtool
+
+ifeq ($(BR2_PACKAGE_PYTHON3),y)

package/qemu/qemu.mk QEMU_LIBS = -lrt -lm · line 40

Quoted 10 lines
package/qemu/qemu.mk +9 -0
+QEMU_DEPENDENCIES += host-python3
+QEMU_VARS += \
+     PYTHON=$(HOST_DIR)/bin/python3 \
+     PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages
+else
+QEMU_DEPENDENCIES += host-python
+QEMU_VARS += \
+     PYTHON=$(HOST_DIR)/bin/python \
      PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
+endif

Can't we use the host installed python? Python is already a dependency of Buildroot.

baruch

Quoted 21 lines
package/qemu/qemu.mk +1 -2
 # If we want to specify only a subset of targets, we must still enable all
 # of them, so that QEMU properly builds its list of default targets, from
@@ -150,7 +160,7 @@ $(eval $(generic-package))
 #-------------------------------------------------------------
 # Host-qemu
 
-HOST_QEMU_DEPENDENCIES = host-pkgconf host-python host-zlib host-libglib2 host-pixman
+HOST_QEMU_DEPENDENCIES = host-pkgconf host-zlib host-libglib2 host-pixman
 
 #       BR ARCH         qemu
 #       -------         ----
@@ -263,12 +273,19 @@ define HOST_QEMU_CONFIGURE_CMDS
              --interp-prefix=$(STAGING_DIR) \
              --cc="$(HOSTCC)" \
              --host-cc="$(HOSTCC)" \
-             --python=$(HOST_DIR)/bin/python2 \
              --extra-cflags="$(HOST_CFLAGS)" \
              --extra-ldflags="$(HOST_LDFLAGS)" \
              $(HOST_QEMU_OPTS)
 endef
 
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

package/qemu/qemu.mk define HOST_QEMU_CONFIGURE_CMDS · line 291

Quoted 11 lines
package/qemu/qemu.mk +8 -0
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+HOST_QEMU_DEPENDENCIES += host-python3
+HOST_QEMU_CONFIGURE_CMDS += --python=$(HOST_DIR)/bin/python3
+else
+HOST_QEMU_DEPENDENCIES += host-python
+HOST_QEMU_CONFIGURE_CMDS += --python=$(HOST_DIR)/bin/python2
+endif
+
 define HOST_QEMU_BUILD_CMDS
      $(HOST_MAKE_ENV) $(MAKE) -C $(@D)
 endef

--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

#6 lore raw

PATCH v2 1/1 qemu: add support for python3

Hello,

+Hollis, Matt.

Quoted 7 lines · Baruch Siach
Quoted 2 lines · Adam Duskett

How would I test this? I am used to having BuildRoot handle the paths for such dependencies.

Just send RFC patch that you tested on your host with whatever Python version you have installed. There are a number of participants in this list that have access to hosts running RHEL6 or its derivatives.

It would actually be useful if Hollis (or Matt ?) could provide a Docker container to easily access a RHEL6.5 system, so that people can try out what happens on such an old system. I guess RHEL6.5 itself is not easy to access because it's only for Redhat customers, but perhaps there is an equivalent version of CentOS that would do the job ?

https://hub.docker.com/_/centos/ has a CentOS 6.6 docker image, but not CentOS 6.5. However, CentOS 6.6 also has Python 2.6 by default:

$ sudo docker run -i -t centos:6.6 /bin/bash
[...]
[root at f7e0f2f6d7af /]# python
Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Quoted 1 line
Quoted 1 line
Quoted 1 line

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#7 lore raw

PATCH v2 1/1 qemu: add support for python3

Quoted 21 lines · Thomas Petazzoni

Hello,

+Hollis, Matt.

Quoted 6 lines · Baruch Siach
Quoted 2 lines · Adam Duskett

How would I test this? I am used to having BuildRoot handle the paths for such dependencies.

Just send RFC patch that you tested on your host with whatever Python version you have installed. There are a number of participants in this list that have access to hosts running RHEL6 or its derivatives.

It would actually be useful if Hollis (or Matt ?) could provide a Docker container to easily access a RHEL6.5 system, so that people can try out what happens on such an old system. I guess RHEL6.5 itself is not easy to access because it's only for Redhat customers, but perhaps there is an equivalent version of CentOS that would do the job ?

https://hub.docker.com/_/centos/ has a CentOS 6.6 docker image, but not CentOS 6.5. However, CentOS 6.6 also has Python 2.6 by default:

Quoted 6 lines
$ sudo docker run -i -t centos:6.6 /bin/bash
[...]
[root at f7e0f2f6d7af /]# python
Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

Right, I can't distribute any Docker images.

I'm sure there are some differences from 6.5, but CentOS 6.6 would be a good testing ground.

Hollis Blanchard
Mentor Graphics Emulation Division

#8 lore raw

PATCH v2 1/1 qemu: add support for python3

In reply to Adam Duskett

Hello,

Quoted 9 lines · Adam Duskett

qemu 2.12.0 now supports building against python3.
see: https://wiki.qemu.org/ChangeLog/2.12#Build_Dependencies

---
Changes v1 -> v2:
- Split the python version check into two seperate checks for readability, one for the target, one for the host.
- Fix location of the python version check for target and host.

I've marked as Changes Requested following the request from Baruch to test if the system-provided Python can be used instead of building our own.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#9 lore raw

PATCH v2 1/1 qemu: add support for python3

In reply to Adam Duskett
Quoted 12 lines · Adam Duskett

qemu 2.12.0 now supports building against python3.
see: https://wiki.qemu.org/ChangeLog/2.12#Build_Dependencies

---
Changes v1 -> v2:
- Split the python version check into two seperate checks for readability, one for the target, one for the host.
- Fix location of the python version check for target and host.

package/qemu/qemu.mk define HOST_QEMU_CONFIGURE_CMDS · line 287

Quoted 7 lines
package/qemu/qemu.mk +7 -0
+ifeq ($(BR2_PACKAGE_PYTHON3),y)
+HOST_QEMU_DEPENDENCIES += host-python3
+HOST_QEMU_CONFIGURE_CMDS += --python=$(HOST_DIR)/bin/python3
+else
+HOST_QEMU_DEPENDENCIES += host-python
+HOST_QEMU_CONFIGURE_CMDS += --python=$(HOST_DIR)/bin/python2
+endif

This will mean that if the target system does not have python at all, then one is forced to use host python 2.

Which is an existing buildroot problem. But I wish it could be fixed instead of further ingraining the concept of "host python version is target python version or python 2 if no target python." Because that concept just isn't right.