Build samba4 for a target that also needs Python3
cover Build samba4 for a target that also needs Python3
This patch is necessary to build samba for a target that also needs Python 3. The python 3 installation overwrites the symbolic links for the python target and staging directories. The samba4 waf build tool cannot yet cope with python3.
This patch is meant as a starting point for discussion as I am not sure whether this is the Right Way to do this. Hacking the waf script itself is rather ugly, I have not found a way to make env pick up any other hint to evaluate it as a python2 script. Same goes for the MAKE_ENV manipulation.
Suggestions welcome as always.
King regards,
Christian
Christian Kellermann (1):
samba4: Make python2 dependency for waf explicit
...ake-python-2.7-dependency-in-waf-explicit.patch | 27 ++++++++++++++++++++++ package/samba4/samba4.mk | 5 +++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 package/samba4/0002-Make-python-2.7-dependency-in-waf-explicit.patch
Signature · 1 line
2.12.1
PATCH 1/1 samba4: Make python2 dependency for waf explicit
Without this patch the build environment will pick up python3 if it is a dependency for other packages. Currently waf does not support python3.
--- ...ake-python-2.7-dependency-in-waf-explicit.patch | 27 ++++++++++++++++++++++ package/samba4/samba4.mk | 5 +++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 package/samba4/0002-Make-python-2.7-dependency-in-waf-explicit.patch
package/samba4/0002-Make-python-2.7-dependency-in-waf-explicit.patch new file +27 -0
@@ -0,0 +1,27 @@ +From f7295def3f04d8d8c2d62d9525c0f741ef2f964b Mon Sep 17 00:00:00 2001 +From: Christian Kellermann <[email protected]> +Date: Wed, 18 Oct 2017 14:00:36 +0200 +Subject: [PATCH] Make python 2.7 dependency in waf explicit + +This prevents picking the wrong python during build as a Python3 +dependency will clobber the python symlink. Python3 is not +supported (yet) in the samba4 build system. + +Signed-off-by: Christian Kellermann <[email protected]> +--- + buildtools/bin/waf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/buildtools/bin/waf b/buildtools/bin/waf +index 1b0f4662a56..f66b992e78c 100755 +--- a/buildtools/bin/waf ++++ b/buildtools/bin/waf +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python2 + # encoding: ISO-8859-1 + # Thomas Nagy, 2005-2010 + +-- +2.12.1 +
package/samba4/samba4.mk +4 -1
@@ -89,11 +89,12 @@ define SAMBA4_CONFIGURE_CMDS cp package/samba4/samba4-cache.txt $(@D)/cache.txt; echo 'Checking uname machine type: $(BR2_ARCH)' >>$(@D)/cache.txt; (cd $(@D); \ - PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python-config" \ + PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python2-config" \ python_LDFLAGS="" \ python_LIBDIR="" \ $(TARGET_CONFIGURE_OPTS) \ $(SAMBA4_CONF_ENV) \ + PYTHON=python2 \ ./buildtools/bin/waf configure \ --prefix=/usr \ --sysconfdir=/etc \
@@ -115,6 +116,8 @@ define SAMBA4_CONFIGURE_CMDS ) endef +TARGET_MAKE_ENV += PYTHON=python2 \ + define SAMBA4_BUILD_CMDS $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) endef
Signature · 1 line
2.12.1
PATCH 1/1 samba4: Make python2 dependency for waf explicit
Hello,
Quoted 3 lines · Christian Kellermann
Without this patch the build environment will pick up python3 if it is a dependency for other packages. Currently waf does not support python3.
Are we talking about host python or target python here ?
package/samba4/0002-Make-python-2.7-dependency-in-waf-explicit.patch line 21
Quoted 7 lines
package/samba4/0002-Make-python-2.7-dependency-in-waf-explicit.patch new file +7
-0+diff --git a/buildtools/bin/waf b/buildtools/bin/waf +index 1b0f4662a56..f66b992e78c 100755 +--- a/buildtools/bin/waf ++++ b/buildtools/bin/waf +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python2
This runs on the host, so this is about host python, and matches your description of "waf needs python2".
package/samba4/samba4.mk define SAMBA4_CONFIGURE_CMDS · line 92
Quoted 2 lines
package/samba4/samba4.mk +1
-1- PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python-config" \ + PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python2-config" \
This is related to the *target* python, so how is this related to the waf problem ?
package/samba4/samba4.mk define SAMBA4_CONFIGURE_CMDS · line 119
Quoted 13 lines
package/samba4/samba4.mk +2
-0python_LDFLAGS="" \ python_LIBDIR="" \ $(TARGET_CONFIGURE_OPTS) \ $(SAMBA4_CONF_ENV) \ + PYTHON=python2 \ ./buildtools/bin/waf configure \ --prefix=/usr \ --sysconfdir=/etc \@@ -115,6 +116,8 @@ define SAMBA4_CONFIGURE_CMDS ) endef +TARGET_MAKE_ENV += PYTHON=python2 \
Are all of these PYTHON=python2 necessary?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/1 samba4: Make python2 dependency for waf explicit
Without this patch the build environment will pick up host-python3 binaries if host-python3 is a dependency for other packages. Currently waf does not support python3.
---
Changelog: v0 -> v1
- Patch samba Makefile to explicitly use python2 instead of patching samba4.mk
--- ...ake-python-2.7-dependency-in-waf-explicit.patch | 27 +++++++++++++++++++++ .../samba4/0003-Force-python2-in-Makefile.patch | 28 ++++++++++++++++++++++ package/samba4/samba4.mk | 3 ++- 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 package/samba4/0002-Make-python-2.7-dependency-in-waf-explicit.patch create mode 100644 package/samba4/0003-Force-python2-in-Makefile.patch
package/samba4/0002-Make-python-2.7-dependency-in-waf-explicit.patch new file +27 -0
@@ -0,0 +1,27 @@ +From f7295def3f04d8d8c2d62d9525c0f741ef2f964b Mon Sep 17 00:00:00 2001 +From: Christian Kellermann <[email protected]> +Date: Wed, 18 Oct 2017 14:00:36 +0200 +Subject: [PATCH] Make python 2.7 dependency in waf explicit + +This prevents picking the wrong python during build as a Python3 +dependency will clobber the python symlink. Python3 is not +supported (yet) in the samba4 build system. + +Signed-off-by: Christian Kellermann <[email protected]> +--- + buildtools/bin/waf | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/buildtools/bin/waf b/buildtools/bin/waf +index 1b0f4662a56..f66b992e78c 100755 +--- a/buildtools/bin/waf ++++ b/buildtools/bin/waf +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python2 + # encoding: ISO-8859-1 + # Thomas Nagy, 2005-2010 + +-- +2.12.1 +
package/samba4/0003-Force-python2-in-Makefile.patch new file +28 -0
@@ -0,0 +1,28 @@ +From 716d7a780ba2403f84c6ea4220305d698c6a14f4 Mon Sep 17 00:00:00 2001 +From: Christian Kellermann <[email protected]> +Date: Tue, 24 Oct 2017 10:19:01 +0200 +Subject: [PATCH] Force python2 in Makefile + +waf does not work with python3-host packages, so make it use python2 +explicitly. + +Signed-off-by: Christian Kellermann <[email protected]> +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 5cc90771000..1496918b6de 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,6 +1,6 @@ + # simple makefile wrapper to run waf + +-PYTHON?=python ++PYTHON?=python2 + WAF_BINARY=$(PYTHON) ./buildtools/bin/waf + WAF=WAF_MAKE=1 $(WAF_BINARY) + +-- +2.12.1 +
package/samba4/samba4.mk +2 -1
@@ -89,11 +89,12 @@ define SAMBA4_CONFIGURE_CMDS cp package/samba4/samba4-cache.txt $(@D)/cache.txt; echo 'Checking uname machine type: $(BR2_ARCH)' >>$(@D)/cache.txt; (cd $(@D); \ - PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python-config" \ + PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python2-config" \ python_LDFLAGS="" \ python_LIBDIR="" \ $(TARGET_CONFIGURE_OPTS) \ $(SAMBA4_CONF_ENV) \ + PYTHON=python2 \ ./buildtools/bin/waf configure \ --prefix=/usr \ --sysconfdir=/etc \
Signature · 1 line
2.12.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 samba4: Make python2 dependency for waf explicit
Hello,
Please don't reply to me only, keep the mailing list in Cc so that everybody can participate to the discussion.
Quoted 9 lines · Christian Kellermann
Quoted 6 lines · Thomas Petazzoni
Quoted 3 lines · Christian Kellermann
Without this patch the build environment will pick up python3 if it is a dependency for other packages. Currently waf does not support python3.
Are we talking about host python or target python here ?
host-python, sorry for being imprecise.
OK.
Quoted 8 lines
Quoted 5 lines
package/samba4/samba4.mk define SAMBA4_CONFIGURE_CMDS · line 92
Quoted 2 lines
package/samba4/samba4.mk +1
-1- PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python-config" \ + PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python2-config" \This is related to the *target* python, so how is this related to the waf problem ?
It needs to pick up the python headers. Without this I get the error:
?Could not find the python development headers?
I don't see how this modification changes anything. BR2_PACKAGE_SAMBA4 selects BR2_PACKAGE_PYTHON, and BR2_PACKAGE_PYTHON3 depends on !BR2_PACKAGE_PYTHON.
So if you have samba4 enabled, the python version enabled for the target is always Python 2.x, and therefore python-config and python2-config in staging should be the same thing.
So we need to understand if this change is really necessary, and if it is, why is it that it creates a difference.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
PATCH 1/1 samba4: Make python2 dependency for waf explicit
Hello,
Quoted 13 lines · Thomas Petazzoni
Quoted 8 lines
Quoted 5 lines
package/samba4/samba4.mk define SAMBA4_CONFIGURE_CMDS · line 92
Quoted 2 lines
package/samba4/samba4.mk +1
-1- PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python-config" \ + PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python2-config" \This is related to the *target* python, so how is this related to the waf problem ?
It needs to pick up the python headers. Without this I get the error:
?Could not find the python development headers?I don't see how this modification changes anything.
BR2_PACKAGE_SAMBA4selectsBR2_PACKAGE_PYTHON, andBR2_PACKAGE_PYTHON3depends on !BR2_PACKAGE_PYTHON.
Quoted 6 lines
So if you have samba4 enabled, the python version enabled for the target is always Python 2.x, and therefore python-config and python2-config in staging should be the same thing.
So we need to understand if this change is really necessary, and if it is, why is it that it creates a difference.
Since you did not give further feedback, and I still don't understand what problem this patch is solving, I've marked your patch as Rejected in our patch tracking system.
Do not hesitate to send an updated version with an improved explanation (for example with a defconfig that allows to reproduce the problem, and some answers to the questions I've asked).
Thanks a lot!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com