Skip to contentSkip to conversation

package: libglib2: explicitly specify host's PYTHON to be used

PATCH New Andrey Smirnov 2 participants 3 messages Jul 17, 2017 – Jul 31, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package: libglib2: explicitly specify host's PYTHON to be used

Unless explicitly told otherwise, libglib2's ./configure step will pick up the first python implementation it finds in ${PATH} as the python to use for code generation scripts executed as a part of build process. Because [host-]python is not specified in any of the _DEPENDENCIES this creates a corner case leading to build failure.

What happens is [host-]libglib2's ./configure, executead after [host-]python is already built, ends up picking up python from ${HOST_DIR}, which, not specified as a dependency will cause partial rebuilds executed as:

cd ${OUTPUT_DIR}
find ${BUILD_DIR} -name ".stamp_host_installed" | xargs rm -f rm -rf ${HOST_DIR}
make host-libglib2-install

to fail, becuase python would not be re-installed to ${HOST_DIR}.

To avoid having this problem completely, specify host's python using --with-python option explicitly.

Cc Arnout Vandecappelle <[email protected]>
---
 package/libglib2/libglib2.mk | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
package/libglib2/libglib2.mk +9 -1
index 47d9f6313..fe53f2d3f 100644
@@ -90,6 +90,12 @@ ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
 LIBGLIB2_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -marm"
 endif
 
+#
+# We explicitly specify --with-python to point to host's python here
+# and in LIBGLIB2_CONF_OPTS to make sure that ./configure does not
+# pick up python from ${HOST_DIR} thus creating a dependency that
+# would have to be specified in _DEPENDENCIES
+#
 HOST_LIBGLIB2_CONF_OPTS = \
 	--disable-coverage \
 	--disable-dtrace \
@@ -98,7 +104,8 @@ HOST_LIBGLIB2_CONF_OPTS = \
 	--disable-selinux \
 	--disable-systemtap \
 	--disable-xattr \
-	--with-pcre=system
+	--with-pcre=system \
+	--with-python=$$(which python)
 
 LIBGLIB2_DEPENDENCIES = \
 	host-pkgconf host-libglib2 host-gettext \
@@ -114,6 +121,7 @@ HOST_LIBGLIB2_DEPENDENCIES = \
 
 LIBGLIB2_CONF_OPTS = \
 	--with-pcre=system
+	--with-python=$$(which python)
 
 ifneq ($(BR2_ENABLE_LOCALE),y)
 LIBGLIB2_DEPENDENCIES += libiconv
Signature · 1 line
2.13.3
#1 lore raw

PATCH 1/1 package: libglib2: explicitly specify host's PYTHON to be used

Hello,

Quoted 20 lines · Andrey Smirnov
package/libglib2/libglib2.mk +8 -1
+#
+# We explicitly specify --with-python to point to host's python here
+# and in LIBGLIB2_CONF_OPTS to make sure that ./configure does not
+# pick up python from ${HOST_DIR} thus creating a dependency that
+# would have to be specified in _DEPENDENCIES
+#
 HOST_LIBGLIB2_CONF_OPTS = \
 	--disable-coverage \
 	--disable-dtrace \
@@ -98,7 +104,8 @@ HOST_LIBGLIB2_CONF_OPTS = \
 	--disable-selinux \
 	--disable-systemtap \
 	--disable-xattr \
-	--with-pcre=system
+	--with-pcre=system \
+	--with-python=$$(which python)
 
 LIBGLIB2_DEPENDENCIES = \
 	host-pkgconf host-libglib2 host-gettext \

package/libglib2/libglib2.mk HOST_LIBGLIB2_DEPENDENCIES = \ · line 124

Quoted 4 lines
package/libglib2/libglib2.mk +1 -0
@@ -114,6 +121,7 @@ HOST_LIBGLIB2_DEPENDENCIES = \
 
 LIBGLIB2_CONF_OPTS = \
 	--with-pcre=system
+	--with-python=$$(which python)

What is Python being used for in the build process of glib2 ? I'm concerned by the fact that we're simply passing the path to the host Python interpreter, even though we're cross-compiling.

It might be correct, if Python is just used to generate some code on the build machine, but it'd be good to understand.

Also, using which python is preferred over $$(which python).

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 package: libglib2: explicitly specify host's PYTHON to be used

Quoted 33 lines · Thomas Petazzoni

Hello,

Quoted 20 lines · Andrey Smirnov
package/libglib2/libglib2.mk +8 -1
+#
+# We explicitly specify --with-python to point to host's python here
+# and in LIBGLIB2_CONF_OPTS to make sure that ./configure does not
+# pick up python from ${HOST_DIR} thus creating a dependency that
+# would have to be specified in _DEPENDENCIES
+#
 HOST_LIBGLIB2_CONF_OPTS = \
      --disable-coverage \
      --disable-dtrace \
@@ -98,7 +104,8 @@ HOST_LIBGLIB2_CONF_OPTS = \
      --disable-selinux \
      --disable-systemtap \
      --disable-xattr \
-     --with-pcre=system
+     --with-pcre=system \
+     --with-python=$$(which python)
 
 LIBGLIB2_DEPENDENCIES = \
      host-pkgconf host-libglib2 host-gettext \

package/libglib2/libglib2.mk HOST_LIBGLIB2_DEPENDENCIES = \ · line 124

Quoted 4 lines
package/libglib2/libglib2.mk +1 -0
@@ -114,6 +121,7 @@ HOST_LIBGLIB2_DEPENDENCIES = \
 
 LIBGLIB2_CONF_OPTS = \
      --with-pcre=system
+     --with-python=$$(which python)

What is Python being used for in the build process of glib2 ? I'm concerned by the fact that we're simply passing the path to the host Python interpreter, even though we're cross-compiling.

Quoted 3 lines

It might be correct, if Python is just used to generate some code on the build machine, but it'd be good to understand.

To the best of my knowledge none of the python code ends up being installed on the target and it is used purely to generate .c and .h files. It appears that all of the auto-generated code will have "Generated by gdbus-codegen" string as a part of file header and quick grep of both "host-libglib" and "libglib" on my configurations comes up with the following files:

gio/xdp-dbus.c
gio/gdbus-daemon-generated.h
gio/xdp-dbus.h
gio/gdbus-daemon-generated.c

Quoted 2 lines

Also, using which python is preferred over $$(which python).

Sure, I'll change that.

Thanks,
Andrey Smirnov