[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Need advice for cross building gammu



Hi Boian,

On Wed, Oct 20, 2021 at 11:50:00PM +0300, Boian Bonev wrote:
> Hi,

Thank you for moving the discussion to the appropriate place.

> Recently I have adopted the gammu package in Debian and there are couple of
> things preventing its cross build:
> 
> 1) Missing deps: [1]
> 
> python3-breathe:arm64 (>= 4.1.0) which is a virtual package and is not provided
> by any available package
> 
> python3-sphinx:arm64 (>= 1.3) which is a virtual package and is not provided by
> any available package

These hints point in the right direction. In general, it is also worth
looking at http://crossqa.debian.net/src/gammu, but it is relatively
boring in this instance:
 * No related bugs are linked.
 * It only sees one of the dependency issues.
However, there also is that link to bootstrap.d.n, which tells a bit
more about dependencies
https://bootstrap.debian.net/cross_all/gammu.html.
In this case, it only tells us about the two you mentioned, but
bootstrap.debian.net usually is exhaustive, so that's a good sign.

Even though this didn't add much info, I've included it here as a
general process of how to approach cross build issues.

> I suppose that nothing can be done about those until they become available in
> the cross-build chroot. Or maybe adding :any can help because they are needed
> as amd64 not arm64? I have tried adding :any to the above two and that broke
> normal builds, also tried moving them to Build-Depend-Indep and normal builds
> are OK but cross fails in the same way.

Those ideas are good in principle. Often times a missing dependency
indicates work elsewhere, yes. And sometimes, annotating dependencies
with :any can help though note that the relevant packages need to be
marked "Multi-Arch: alllowed" for :any to work. An alternative to
annotating :any is the :native annotation which is not permitted in
runtime Depends and only allowed in Build-Depends. It's sort of a
measure of last resort though. And then you mentioned
Build-Depends-Indep. I think this last idea is the way to go for this
problem as you already have a gammu-doc package. A proper indep split is
the most common solution to sphinx breaking cross compilation. Are you
sure that the build fails "in the same way"? I tried doing it myself and
it just worked for me. I think there are two aspects that are not
entirely obvious:
 * The sphinx dh addon must be conditionalized and the easiest way of
   doing so is turning it into a dependency on dh-sequence-sphinxdoc at
   which point it can be moved to B-D-I.
 * The manual build needs to be conditionalized as well. One option for
   doing so is "ifneq (,$(filter gammu-doc,$(shell dh_listpackages)))".
I'm attaching a patch with what I have.

> 2) When some day the above are resolved, the build will fail on the test step
> unless cmake is clever and skips it or dh detects nocheck and skips the step as
> a whole:

Cross builds should automatically pass nocheck in DEB_BUILD_OPTIONS by
default.  dh_auto_test should automatically honour this option. I don't
quite see how this failed for you. How did you perform the build? Both
sbuild and pbuilder automatically add nocheck when you ask for a cross
build.

> So my question - is it proper to make this conditional, e.g.:
> 
> override_dh_auto_test:
> ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
>   dh_auto_test --no-parallel
> else
>   true
> endif
> 
> or there is a better way to handle that?

Please don't do this. If you perform a cross build from e.g. amd64 to
i386, you can run tests and you can build without nocheck. In that case,
tests should be run. Whether tests should be run is a question the
builder needs to specify and the way to do that is adding nocheck to
DEB_BUILD_OPTIONS.

Thank you for looking so deeply into cross building gammu. You really
got a lot of aspects right.

Helmut
diff --minimal -Nru gammu-1.42.0/debian/changelog gammu-1.42.0/debian/changelog
--- gammu-1.42.0/debian/changelog	2021-09-16 05:07:40.000000000 +0200
+++ gammu-1.42.0/debian/changelog	2021-10-21 06:38:22.000000000 +0200
@@ -1,3 +1,10 @@
+gammu (1.42.0-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Move documentation build and its dependencies to indep only.
+
+ -- Helmut Grohne <helmut@subdivi.de>  Thu, 21 Oct 2021 06:38:22 +0200
+
 gammu (1.42.0-1) unstable; urgency=medium
 
   * New maintainer (Closes: #951855)
diff --minimal -Nru gammu-1.42.0/debian/control gammu-1.42.0/debian/control
--- gammu-1.42.0/debian/control	2021-09-16 05:07:40.000000000 +0200
+++ gammu-1.42.0/debian/control	2021-10-21 06:38:22.000000000 +0200
@@ -7,7 +7,6 @@
  cmake,
  debhelper-compat (= 13),
  default-libmysqlclient-dev,
- doxygen,
  libbluetooth-dev [linux-any],
  libcurl4-gnutls-dev,
  libdbd-sqlite3,
@@ -17,10 +16,13 @@
  libpq-dev,
  libusb-1.0-0-dev [linux-any],
  pkg-config,
- python3-breathe (>= 4.1.0),
- python3-sphinx (>= 1.3),
  sqlite3,
  unixodbc-dev,
+Build-Depends-Indep:
+ dh-sequence-sphinxdoc,
+ doxygen,
+ python3-breathe (>= 4.1.0),
+ python3-sphinx (>= 1.3),
 Standards-Version: 4.6.0
 Rules-Requires-Root: no
 Vcs-Browser: https://salsa.debian.org/debian/gammu
diff --minimal -Nru gammu-1.42.0/debian/rules gammu-1.42.0/debian/rules
--- gammu-1.42.0/debian/rules	2021-09-16 05:07:40.000000000 +0200
+++ gammu-1.42.0/debian/rules	2021-10-21 06:38:22.000000000 +0200
@@ -9,11 +9,13 @@
 include /usr/share/dpkg/buildflags.mk
 
 %:
-	dh $@ --with sphinxdoc --buildsystem=cmake
+	dh $@ --buildsystem=cmake
 
 override_dh_auto_build:
 	dh_auto_build --parallel
+ifneq (,$(filter gammu-doc,$(shell dh_listpackages)))
 	dh_auto_build -- manual-html
+endif
 
 override_dh_auto_test:
 	dh_auto_test --no-parallel

Reply to: