[PATCH v2 1/2] Fix python client cross compile

Baruch Siach <[email protected]>
Newsgroups gmane.comp.hardware.lirc
Message-ID <b3559299db3f0952fa6875ff1c8a4c432fe9055e.1504611572.git.baruch@tkos.co.il>
The setup.py setuptools wrapper needs to use a version of python built
specifically for cross compiling to cross compile successfully. Allow
setting that in the environment using the SETUPTOOLS_ENV variable.

Fixes the following build failure:

/usr/bin/ld: skipping incompatible .../lirc-tools-0.10.0/lib/.libs/liblirc_client.so when searching for -llirc_client
/usr/bin/ld: cannot find -llirc_client
collect2: error: ld returned 1 exit status
error: command '/usr/bin/gcc' failed with exit status 1
Makefile:1578: recipe for target 'all-local' failed
---
v2: Add AC_ARG_VAR() for SETUPTOOLS_ENV to improve its visibility
---
 Makefile.am  | 2 ++
 configure.ac | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index c263c71cb35e..afa1f54a8522 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -137,6 +137,7 @@ if HAVE_PYTHON35
 all-local:
 	cd python-pkg; \
 	    CFLAGS="$(PY_PKG_CFLAGS)" LDFLAGS="$(PY_PKG_LDFLAGS)" \
+	    $(SETUPTOOLS_ENV) \
 	    $(PYTHON) setup.py $(if $(VERBOSE),,-q) build
 endif
 
@@ -182,6 +183,7 @@ $(PYTHON_TARBALL): $(abs_builddir)/python-pkg/setup.py
 	cp $(top_builddir)/VERSION $(abs_builddir)/python-pkg
 	cd $(abs_builddir)/python-pkg; \
 	    CFLAGS="$(PY_PKG_CFLAGS)" LDFLAGS="$(PY_PKG_LDFLAGS)" \
+	    $(SETUPTOOLS_ENV) \
 	    $(PYTHON) setup.py -q sdist
 
 $(top_builddir)/python-pkg/VERSION: VERSION
diff --git a/configure.ac b/configure.ac
index dcf9703c3530..2f34d6535e01 100644
--- a/configure.ac
+++ b/configure.ac
@@ -493,6 +493,10 @@ AC_ARG_VAR(HAVE_WORKING_POLL,[
 
 AC_ARG_VAR(SH_PATH, [On cross-compile: Path to shell, typically /bin/sh])
 
+AC_ARG_VAR(SETUPTOOLS_ENV,
+  [For cross-compile: Python setuptools wrapper environment variables]
+)
+
 suffix=$(echo "$VERSION" | sed 's/.*-//')
 AM_CONDITIONAL(DEVEL, [test x$suffix = xdevel])
 
-- 
2.14.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.