Bug#1010218: armnn FTCBFS: multiple reasons

2023-09-05 Thread Helmut Grohne
Hi Emanuele,

On Tue, Sep 05, 2023 at 10:51:17AM +0200, Emanuele Rocca wrote:
> On 2022-04-26 05:33, Helmut Grohne wrote:
> > armnn fails to cross build from source for a fair number of reasons.
> 
> This does not seem to be the case anymore with 23.08-3 from
> testing/unstable, at least judging from sbuild --host=arm64 on a x86
> machine: https://people.debian.org/~ema/armnn_23.08-3_arm64.build
> 
> Any other test to perform before claiming victory?

I strongly suspect that you have qemu-user installed and configured for
binfmt. If you had not the python3 would fail to install. I'd call this
an emulated build, but not a cross build.

So yeah, there's still things to do.

You may also check https://crossqa.debian.net/src/armnn when in doubt.
There you can see that the package is considered bd-uninstallable for
all architectures. On the cross build, I am removing the foreign python
interpreters from the set of available packages, because they are known
to fail postinst. As a result, most architectures are reported as
missing python3.11-minimal.

Helmut



Bug#1010218: armnn FTCBFS: multiple reasons

2023-09-05 Thread Emanuele Rocca
Hi Helmut,

On 2022-04-26 05:33, Helmut Grohne wrote:
> armnn fails to cross build from source for a fair number of reasons.

This does not seem to be the case anymore with 23.08-3 from
testing/unstable, at least judging from sbuild --host=arm64 on a x86
machine: https://people.debian.org/~ema/armnn_23.08-3_arm64.build

Any other test to perform before claiming victory?

Thanks,
  Emanuele



Bug#1010218: armnn FTCBFS: multiple reasons

2022-04-26 Thread Helmut Grohne
Source: armnn
Version: 20.08-10
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: cross-satisfiability ftcbfs

armnn fails to cross build from source for a fair number of reasons. The
majority of them are issues with Build-Depends. Beyond that, setup.py
needs to be told to perform a cross build and it needs to avoid
importing the cross built extension module. Please consider applying the
attached patch.

Helmut
--- armnn-20.08/debian/changelog
+++ armnn-20.08/debian/changelog
@@ -1,3 +1,16 @@
+armnn (20.08-10.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
++ Multiarchify python Build-Depends.
++ Drop python3-all as it only builds for the default python.
++ Annotate python3-numpy build dependency with :native.
++ Export cross compilation variables for setup.py
++ Let dpkg's architecture.mk initialize architecture variables.
++ Patch setup.py to avoid importing the cross built _pyarmnn_version.
+
+ -- Helmut Grohne   Tue, 26 Apr 2022 17:28:39 +0200
+
 armnn (20.08-10) unstable; urgency=medium
 
   * Build with gcc-11 (Closes: #983969)
--- armnn-20.08/debian/control
+++ armnn-20.08/debian/control
@@ -8,8 +8,8 @@
   libboost-log-dev (>= 1.64), libboost-program-options-dev (>= 1.64), 
   cmake, debhelper-compat (= 12), valgrind, libflatbuffers-dev, 
   libarm-compute-dev [arm64 armhf],
-  swig (>= 4.0.1-5), dh-python, python3-all, python3-setuptools,
-  python3-dev, python3-numpy, xxd, flatbuffers-compiler, chrpath
+  swig (>= 4.0.1-5), dh-python, python3-setuptools,
+  libpython3-dev, python3-dev:any, python3-numpy:native, xxd, 
flatbuffers-compiler, chrpath
 Standards-Version: 4.5.0
 Vcs-Git: https://salsa.debian.org/deeplearning-team/armnn.git
 Vcs-Browser: https://salsa.debian.org/deeplearning-team/armnn
--- armnn-20.08/debian/patches/cross.patch
+++ armnn-20.08/debian/patches/cross.patch
@@ -0,0 +1,21 @@
+--- a/python/pyarmnn/setup.py
 b/python/pyarmnn/setup.py
+@@ -29,9 +29,6 @@
+ INCLUDE_ENV_NAME = "ARMNN_INCLUDE"
+ 
+ 
+-def check_armnn_version(*args):
+-pass
+-
+ __current_dir = os.path.dirname(os.path.realpath(__file__))
+ 
+ exec(open(os.path.join(__current_dir, 'src', 'pyarmnn', '_version.py'), 
encoding="utf-8").read())
+@@ -63,8 +60,6 @@
+ 
+ if ext.name == 'pyarmnn._generated._pyarmnn_version':
+ sys.path.append(os.path.abspath(os.path.join(self.build_lib, 
str(Path(ext._file_name).parent
+-from _pyarmnn_version import GetVersion
+-check_armnn_version(GetVersion(), __arm_ml_version__)
+ 
+ def copy_extensions_to_source(self):
+ 
--- armnn-20.08/debian/patches/series
+++ armnn-20.08/debian/patches/series
@@ -13,3 +13,4 @@
 disable-unittests-that-can-cause-intermi
 set-error-tests-by-name.patch
 fix-gcc11-ftbfs.patch
+cross.patch
--- armnn-20.08/debian/rules
+++ armnn-20.08/debian/rules
@@ -1,4 +1,5 @@
 #!/usr/bin/make -f
+include /usr/share/dpkg/architecture.mk
 # See debhelper(7) (uncomment to enable)
 # output every command that modifies files on the build system.
 export DH_VERBOSE = 1
@@ -24,6 +25,8 @@
 
 PYTHON_INCLUDE_DIR=$(shell python3 -c "from distutils.sysconfig import 
get_python_inc; print(get_python_inc())")
 PYTHON_LIBRARY=$(shell python3 -c "import distutils.sysconfig as sysconfig; 
print(sysconfig.get_config_var('LIBDIR'))")
+export _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata__${DEB_HOST_MULTIARCH}
+export _PYTHON_HOST_PLATFORM=${DEB_HOST_ARCH_OS}-$(if $(filter 
amd64,${DEB_HOST_ARCH}),x86_64,${DEB_HOST_ARCH})
 
 export DH_VERBOSE=1
 %: