diff mbox series

package/pkg-python: use _CONFIGURE_OPTS for build env

Message ID 20191205231103.27778-1-ryan.barnett@rockwellcollins.com
State Accepted
Headers show
Series package/pkg-python: use _CONFIGURE_OPTS for build env | expand

Commit Message

Ryan Barnett Dec. 5, 2019, 11:11 p.m. UTC
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 <arnout@mind.be>
Signed-off-by: Ryan Barnett <ryan.barnett@rockwellcollins.com>

---
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(-)

Comments

Thomas Petazzoni Dec. 6, 2019, 10:35 p.m. UTC | #1
On Thu,  5 Dec 2019 17:11:02 -0600
Ryan Barnett <ryan.barnett@rockwellcollins.com> wrote:

> 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 <arnout@mind.be>
> Signed-off-by: Ryan Barnett <ryan.barnett@rockwellcollins.com>
> 
> ---
> 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(-)

Applied to master, thanks.

Thomas
Peter Korsgaard Dec. 7, 2019, 1:07 p.m. UTC | #2
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

 > On Thu,  5 Dec 2019 17:11:02 -0600
 > Ryan Barnett <ryan.barnett@rockwellcollins.com> wrote:

 >> 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 <arnout@mind.be>
 >> Signed-off-by: Ryan Barnett <ryan.barnett@rockwellcollins.com>
 >> 
 >> ---
 >> 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(-)

 > Applied to master, thanks.

Hmm, this seems to confuse lirc-tools:

http://autobuild.buildroot.net/results/f7a/f7a9c02add9bde563c7289f7c0be2cb7aefd96b8/build-end.log
Thomas Petazzoni Dec. 9, 2019, 3:53 p.m. UTC | #3
On Sat, 07 Dec 2019 14:07:41 +0100
Peter Korsgaard <peter@korsgaard.com> wrote:

>  >> 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
Ryan Barnett Dec. 9, 2019, 4:23 p.m. UTC | #4
Thomas,

On Mon, Dec 9, 2019 at 9:54 AM Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
>
> On Sat, 07 Dec 2019 14:07:41 +0100
> Peter Korsgaard <peter@korsgaard.com> wrote:
>
> >  >> 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 ?

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

diff --git a/package/lirc-tools/lirc-tools.mk b/package/lirc-tools/lirc-tools.mk
index e468f2a25d..d66f4e9925 100644
--- a/package/lirc-tools/lirc-tools.mk
+++ b/package/lirc-tools/lirc-tools.mk
@@ -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
Peter Korsgaard Dec. 22, 2019, 8:31 p.m. UTC | #5
>>>>> "Ryan" == Ryan Barnett <ryan.barnett@rockwellcollins.com> 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 <arnout@mind.be>
 > Signed-off-by: Ryan Barnett <ryan.barnett@rockwellcollins.com>

 > ---
 > 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.
diff mbox series

Patch

diff --git a/package/pkg-python.mk b/package/pkg-python.mk
index be1ce071df..4ded4fde83 100644
--- a/package/pkg-python.mk
+++ b/package/pkg-python.mk
@@ -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) \