Skip to contentSkip to conversation

package/pkg-python: use _CONFIGURE_OPTS for build env

PATCH New Ryan Barnett 3 participants 6 messages Dec 5, 2019 – Dec 22, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/pkg-python: use _CONFIGURE_OPTS for build env

When building host or target python packages, we need to ensure that the build environment utilize {HOST|TARGET}_CONFIGURE_OPTS. This ensures that the correct linker and compiler environment variables are set to compile utilizing either the host or target folders.

It was discovered that when compiling a host-python package, it was using linking against the build machines library folder instead of the host folder because LDFLAGS was not properly set and was improperly detecting whether or not a shared or static library was present in the host folder.

CC Arnout Vandecappelle <[email protected]>

---
Changes v1 -> v2:
- Merged HOST/TARGET_CONFIGURE_OPTS to single commit (suggested by Arnout)
- Added HOST/TARGET_CONFIGURE_OPTS to env for setuptools (suggested by Arnout)

---
 package/pkg-python.mk | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
package/pkg-python.mk +6 -5
index be1ce071df..4ded4fde83 100644
@@ -27,9 +27,7 @@ endef
 # Target distutils-based packages
 PKG_PYTHON_DISTUTILS_ENV = \
 	PATH=$(BR_PATH) \
-	CC="$(TARGET_CC)" \
-	CFLAGS="$(TARGET_CFLAGS)" \
-	LDFLAGS="$(TARGET_LDFLAGS)" \
+	$(TARGET_CONFIGURE_OPTS) \
 	LDSHARED="$(TARGET_CROSS)gcc -shared" \
 	PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \
 	PYTHONNOUSERSITE=1 \
@@ -52,7 +50,8 @@ PKG_PYTHON_DISTUTILS_INSTALL_STAGING_OPTS = \
 # Host distutils-based packages
 HOST_PKG_PYTHON_DISTUTILS_ENV = \
 	PATH=$(BR_PATH) \
-	PYTHONNOUSERSITE=1
+	PYTHONNOUSERSITE=1 \
+	$(HOST_CONFIGURE_OPTS)
 
 HOST_PKG_PYTHON_DISTUTILS_INSTALL_OPTS = \
 	--prefix=$(HOST_DIR)
@@ -61,6 +60,7 @@ HOST_PKG_PYTHON_DISTUTILS_INSTALL_OPTS = \
 PKG_PYTHON_SETUPTOOLS_ENV = \
 	_PYTHON_SYSCONFIGDATA_NAME="$(PKG_PYTHON_SYSCONFIGDATA_NAME)" \
 	PATH=$(BR_PATH) \
+	$(TARGET_CONFIGURE_OPTS) \
 	PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \
 	PYTHONNOUSERSITE=1 \
 	_python_sysroot=$(STAGING_DIR) \
@@ -82,7 +82,8 @@ PKG_PYTHON_SETUPTOOLS_INSTALL_STAGING_OPTS = \
 # Host setuptools-based packages
 HOST_PKG_PYTHON_SETUPTOOLS_ENV = \
 	PATH=$(BR_PATH) \
-	PYTHONNOUSERSITE=1
+	PYTHONNOUSERSITE=1 \
+	$(HOST_CONFIGURE_OPTS)
 
 HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS = \
 	--prefix=$(HOST_DIR) \
Signature · 1 line
2.18.0
#1 lore raw

PATCH 1/1 package/pkg-python: use _CONFIGURE_OPTS for build env

Quoted 20 lines · On Thu, 5 Dec 2019 17:11:02 -0600 Ryan Barnett…

When building host or target python packages, we need to ensure that the build environment utilize {HOST|TARGET}_CONFIGURE_OPTS. This ensures that the correct linker and compiler environment variables are set to compile utilizing either the host or target folders.

It was discovered that when compiling a host-python package, it was using linking against the build machines library folder instead of the host folder because LDFLAGS was not properly set and was improperly detecting whether or not a shared or static library was present in the host folder.

CC Arnout Vandecappelle <[email protected]>

---
Changes v1 -> v2:
- Merged HOST/TARGET_CONFIGURE_OPTS to single commit (suggested by Arnout)
- Added HOST/TARGET_CONFIGURE_OPTS to env for setuptools (suggested by Arnout)

Quoted 3 lines
---
 package/pkg-python.mk | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Applied to master, thanks.

Thomas

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

PATCH 1/1 package/pkg-python: use _CONFIGURE_OPTS for build env

Quoted 29 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

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

Quoted 22 lines · On Thu, 5 Dec 2019 17:11:02 -0600 Ryan Barnett…

When building host or target python packages, we need to ensure that the build environment utilize {HOST|TARGET}_CONFIGURE_OPTS. This ensures that the correct linker and compiler environment variables are set to compile utilizing either the host or target folders.

It was discovered that when compiling a host-python package, it was using linking against the build machines library folder instead of the host folder because LDFLAGS was not properly set and was improperly detecting whether or not a shared or static library was present in the host folder.

CC Arnout Vandecappelle <[email protected]>

---
Changes v1 -> v2:
- Merged HOST/TARGET_CONFIGURE_OPTS to single commit (suggested by Arnout)
- Added HOST/TARGET_CONFIGURE_OPTS to env for setuptools (suggested by Arnout)
---
package/pkg-python.mk | 11 ++++++-----

Quoted 1 line
1 file changed, 6 insertions(+), 5 deletions(-)
Quoted 1 line

Applied to master, thanks.

Hmm, this seems to confuse lirc-tools:

http://autobuild.buildroot.net/results/f7a/f7a9c02add9bde563c7289f7c0be2cb7aefd96b8/build-end.log

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 1/1 package/pkg-python: use _CONFIGURE_OPTS for build env

Quoted 8 lines · On Sat, 07 Dec 2019 14:07:41 +0100 Peter Korsgaard <[email protected]> wrote:
Quoted 4 lines
Quoted 2 lines

package/pkg-python.mk | 11 ++++++-----

1 file changed, 6 insertions(+), 5 deletions(-)  

Applied to master, thanks.

Hmm, this seems to confuse lirc-tools:

http://autobuild.buildroot.net/results/f7a/f7a9c02add9bde563c7289f7c0be2cb7aefd96b8/build-end.log

I think this sort of change was pretty likely to cause some build breakage, so it's good to merge it early.

Ryan, will you take a look at this issue ?

Thanks,

Thomas

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

PATCH 1/1 package/pkg-python: use _CONFIGURE_OPTS for build env

Thomas,

Quoted 9 lines · Thomas Petazzoni
Quoted 5 lines · On Sat, 07 Dec 2019 14:07:41 +0100 Peter Korsgaard <[email protected]> wrote:
Quoted 4 lines
Quoted 2 lines

package/pkg-python.mk | 11 ++++++-----

1 file changed, 6 insertions(+), 5 deletions(-)

Applied to master, thanks.

Quoted 8 lines
Quoted 3 lines

Hmm, this seems to confuse lirc-tools:

http://autobuild.buildroot.net/results/f7a/f7a9c02add9bde563c7289f7c0be2cb7aefd96b8/build-end.log

I think this sort of change was pretty likely to cause some build breakage, so it's good to merge it early.

Ryan, will you take a look at this issue ?

Yes - I'm taking a look at it. Looks like it is due to using double quotes when using PKG_PYTHON_SETUPTOOLS_ENV.

package/lirc-tools/lirc-tools.mk +1 -1
index e468f2a25d..d66f4e9925 100644
@@ -47,7 +47,7 @@ endif
 
 ifeq ($(BR2_PACKAGE_PYTHON3),y)
 LIRC_TOOLS_DEPENDENCIES += python3 host-python3-setuptools
-LIRC_TOOLS_MAKE_ENV += SETUPTOOLS_ENV="$(PKG_PYTHON_SETUPTOOLS_ENV)"
+LIRC_TOOLS_MAKE_ENV += SETUPTOOLS_ENV='$(PKG_PYTHON_SETUPTOOLS_ENV)'
 endif
 
 define LIRC_TOOLS_INSTALL_INIT_SYSV

Working on testing out the change to see if it will build correctly.

Thanks,
-Ryan

#5 lore raw

PATCH 1/1 package/pkg-python: use _CONFIGURE_OPTS for build env

In reply to Ryan Barnett
Quoted 16 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Ryan" == Ryan Barnett <[email protected]> writes:

When building host or target python packages, we need to ensure that the build environment utilize {HOST|TARGET}_CONFIGURE_OPTS. This ensures that the correct linker and compiler environment variables are set to compile utilizing either the host or target folders.

It was discovered that when compiling a host-python package, it was using linking against the build machines library folder instead of the host folder because LDFLAGS was not properly set and was improperly detecting whether or not a shared or static library was present in the host folder.

CC Arnout Vandecappelle <[email protected]>
Quoted 6 lines

---
Changes v1 -> v2:
- Merged HOST/TARGET_CONFIGURE_OPTS to single commit (suggested by Arnout)
- Added HOST/TARGET_CONFIGURE_OPTS to env for setuptools (suggested by Arnout)

Committed to 2019.02.x and 2019.11.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard