Control: tags -1 + patch
Control: tags 1140151 + patch

Hi,

Thanks for the go-ahead. Rather than open a salsa MR I'm attaching the
change as a git patch series (generated against the debian/ packaging of
1:11.8.8-1) — happy to push it as an MR instead if you'd prefer, just say
so. You should be able to apply it directly:

    git am 0001-*.patch 0002-*.patch 0003-*.patch

Three commits, all under debian/ (no upstream/quilt patch needed — the
header split is done at build time in debian/rules):

  0001  libmariadb-dev: Multi-Arch: same. Replaces the per-arch compiled
        /usr/bin/mariadb_config with an architecture-independent shell
        script (derives the multiarch triplet at runtime), and moves the
        two arch-varying macros of mariadb_version.h (MARIADB_MACHINE_TYPE,
        MARIADB_PLUGINDIR) into a per-arch triplet stub header so the public
        header is byte-identical across arches. The header is deliberately
        NOT relocated — mysql.h includes it with quotes.   (Closes: #1140296)

  0002  libmariadb-dev-compat: Multi-Arch: same, and drop the two
        self-provided transitional virtuals from Conflicts/Breaks. Marking
        it M-A: same alone is not enough — two arch instances otherwise
        break each other via those virtuals.              (Closes: #1140151)

  0003  changelog entry (1:11.8.8-2 / UNRELEASED — drop or regenerate via
        gbp dch as you like).

What I verified locally (by transforming the real 11.8.6 binaries into this
exact end state): all shared-path files become byte-identical across amd64
and arm64; libmariadb-dev + libmariadb-dev-compat co-install for both arches;
#include <mysql.h> still compiles and links; and mariadb_config output is
unchanged (--cflags/--libs/--plugindir/--version=11.8.6/...). I could not run
a full source build here, so the buildd/CI pass on amd64+arm64 is the final
gate — which is exactly what this targets, since the previous failures you
mentioned were the cross-arch identical-files check.

One thing worth a look before merge: please sanity-check the shell
mariadb_config's flag set against the current compiled binary, in case
something relies on a flag it doesn't yet implement.

Thanks,
Dick Hollenbeck
# Applying the multi-arch patch series to the salsa clone

Three commits, generated against the `debian/` packaging of mariadb 1:11.8.8-1.
All changes live under `debian/` (no upstream/quilt patch needed — the header
split happens at build time in debian/rules).

  0001-libmariadb-dev-make-Multi-Arch-same-co-installable.patch
  0002-libmariadb-dev-compat-make-Multi-Arch-same-co-instal.patch
  0003-changelog-document-multi-arch-co-installability-fix-.patch

## Apply

    git clone [email protected]:<your-fork>/mariadb-server.git
    cd mariadb-server
    git checkout -b multiarch-dev-coinstall    # branch off the debian packaging branch
    git am /path/to/patches/0001*.patch /path/to/patches/0002*.patch /path/to/patches/0003*.patch

If `git am` fuzz-fails (salsa HEAD newer than 11.8.8-1), fall back to:

    git apply --3way /path/to/patches/000*.patch
    # then commit, reusing the messages from the .patch headers

Note: the changelog commit (0003) targets 1:11.8.8-2 / UNRELEASED with my name.
The team runs `gbp dch`; drop or regenerate that commit if they prefer.

## Build & verify (the CI gate the maintainer flagged)

    gbp buildpackage --git-pbuilder ...        # or sbuild, on amd64 AND arm64
    # then in a clean container with both arches enabled:
    dpkg --add-architecture arm64 && apt-get update
    apt-get install ./libmariadb-dev_*_amd64.deb ./libmariadb-dev_*_arm64.deb \
                    ./libmariadb-dev-compat_*_{amd64,arm64}.deb
    # expect: co-install succeeds; shared-path files byte-identical across arches

## Open the MR

Push the branch to your fork and open an MR against
salsa.debian.org/mariadb-team/mariadb-server. Use MR-libmariadb-multiarch.md
(one dir up) as the description.

## Locally verified already (by transforming the real 11.8.6 debs to this end state)
  - shared-path files byte-identical across amd64/arm64
  - all four debs co-install together
  - #include <mysql.h> compiles+links; mariadb_config output parity (--version=11.8.6)
Still required: a real source build through salsa CI on amd64 + arm64.
Before final: diff the script's flag set vs the upstream mariadb_config binary
(e.g. confirm nothing relies on a flag the script doesn't implement).
From 34644956a0b82582f1978f0b6ca7658e174aaebe Mon Sep 17 00:00:00 2001
From: Dick Hollenbeck <[email protected]>
Date: Thu, 25 Jun 2026 10:03:38 -0500
Subject: [PATCH 3/3] changelog: document multi-arch co-installability fix for
 1:11.8.8-2

---
 debian/changelog | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index c06d2bd..c34f6bb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+mariadb (1:11.8.8-2) UNRELEASED; urgency=medium
+
+  * Make the client development packages co-installable across architectures:
+    - libmariadb-dev: mark Multi-Arch: same; replace the per-arch compiled
+      mariadb_config with an architecture-independent shell script, and move
+      the two arch-varying macros of mariadb_version.h into a per-arch triplet
+      stub header so the public header is byte-identical (Closes: #1140296).
+    - libmariadb-dev-compat: mark Multi-Arch: same and drop the self-provided
+      transitional virtuals from Conflicts/Breaks so two architecture instances
+      no longer break each other (Closes: #1140151).
+
+ -- Dick Hollenbeck <[email protected]>  Wed, 25 Jun 2026 00:00:00 +0000
+
 mariadb (1:11.8.8-1) unstable; urgency=medium
 
   [ Otto Kekäläinen ]
-- 
2.47.3

From 81b7f9034b3ca1c5edd51f1fdf222c4ccd8d9a9c Mon Sep 17 00:00:00 2001
From: Dick Hollenbeck <[email protected]>
Date: Thu, 25 Jun 2026 10:02:26 -0500
Subject: [PATCH 2/3] libmariadb-dev-compat: make Multi-Arch: same
 co-installable

The package lacked Multi-Arch: same. Adding it alone is not sufficient:
the package Provides the transitional virtuals libmariadb-client-lgpl-dev-compat
and libmariadbclient-dev-compat while also listing them in Conflicts and
Breaks. With Multi-Arch: same, two architecture instances then break each
other ("libmariadb-dev-compat:amd64 breaks ...-compat / :arm64 provides
...-compat"), so co-installation still fails.

Mark the package Multi-Arch: same and drop the two self-provided virtuals
from Conflicts and Breaks (keeping Provides and Replaces, and keeping the
genuine libmysqlclient-dev / libmariadbclient-dev (<< 1:10.3) entries).
The package ships no per-architecture files, so this is sufficient.

Closes: #1140151
---
 debian/control | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/debian/control b/debian/control
index bc9dce0..f360888 100644
--- a/debian/control
+++ b/debian/control
@@ -92,21 +92,18 @@ Description: MariaDB database development files
 
 Package: libmariadb-dev-compat
 Architecture: any
+Multi-Arch: same
 Section: libdevel
 Depends:
  libmariadb-dev (= ${binary:Version}),
  ${misc:Depends},
 Conflicts:
- libmariadb-client-lgpl-dev-compat,
- libmariadbclient-dev-compat,
  libmysqlclient-dev,
 Provides:
  libmariadb-client-lgpl-dev-compat,
  libmariadbclient-dev-compat,
 Breaks:
- libmariadb-client-lgpl-dev-compat,
  libmariadbclient-dev (<< 1:10.3),
- libmariadbclient-dev-compat,
  libmysqlclient-dev,
 Replaces:
  libmariadb-client-lgpl-dev-compat,
-- 
2.47.3

From 1c66a8516b382b9f636a60bbc890d2acb1da3c84 Mon Sep 17 00:00:00 2001
From: Dick Hollenbeck <[email protected]>
Date: Thu, 25 Jun 2026 10:01:48 -0500
Subject: [PATCH 1/3] libmariadb-dev: make Multi-Arch: same co-installable

libmariadb-dev could not be co-installed for multiple architectures
because it lacked Multi-Arch: same and shipped two files that differ per
architecture at shared (non-triplet) paths:

  * /usr/bin/mariadb_config            (a compiled ELF binary)
  * /usr/include/mariadb/mariadb_version.h
        (only MARIADB_MACHINE_TYPE and MARIADB_PLUGINDIR differ)

All 146 other shared files are byte-identical between architectures.

Mark the package Multi-Arch: same and neutralise the two differing files
at build time (execute_after_dh_install):

  * Replace the compiled mariadb_config with an architecture-independent
    POSIX shell script that derives the multiarch triplet at runtime, so
    the installed file is identical on every architecture.
  * Move only the two arch-varying macros out of mariadb_version.h into a
    stub header in the per-arch triplet include directory (auto-searched
    by the compiler), keeping the public header byte-identical. The header
    is deliberately not relocated: mysql.h includes it with quotes.

Closes: #1140296
---
 debian/control        |  1 +
 debian/mariadb_config | 37 +++++++++++++++++++++++++++++++++++++
 debian/rules          | 24 ++++++++++++++++++++++++
 3 files changed, 62 insertions(+)
 create mode 100755 debian/mariadb_config

diff --git a/debian/control b/debian/control
index 9939b13..bc9dce0 100644
--- a/debian/control
+++ b/debian/control
@@ -57,6 +57,7 @@ Vcs-Git: https://salsa.debian.org/mariadb-team/mariadb-server.git
 
 Package: libmariadb-dev
 Architecture: any
+Multi-Arch: same
 Section: libdevel
 Depends:
  libmariadb3 (= ${binary:Version}),
diff --git a/debian/mariadb_config b/debian/mariadb_config
new file mode 100755
index 0000000..dd02a57
--- /dev/null
+++ b/debian/mariadb_config
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Architecture-independent mariadb_config (Debian multi-arch co-install fix).
+# Derives the multiarch triplet at runtime so this file is byte-identical
+# across architectures and libmariadb-dev can be Multi-Arch: same.
+set -e
+triplet=$(${CC:-cc} -print-multiarch 2>/dev/null) || true
+[ -n "$triplet" ] || triplet=$(dpkg-architecture -qDEB_HOST_MULTIARCH 2>/dev/null) || true
+[ -n "$triplet" ] || triplet=$(${CC:-cc} -dumpmachine 2>/dev/null) || true
+libdir="/usr/lib/$triplet"
+vhdr="/usr/include/mariadb/mariadb_version.h"
+version=$(sed -n 's/.*MARIADB_CLIENT_VERSION_STR[^"]*"\([^"]*\)".*/\1/p' "$vhdr" 2>/dev/null)
+[ -n "$version" ] || version=unknown
+inc="-I/usr/include/mariadb -I/usr/include/mariadb/mysql"
+usage() {
+  cat <<USE
+Usage: $0 [OPTIONS]
+  --cflags        --include      --libs        --libs_sys
+  --libs_r        --plugindir    --socket      --port
+  --version       --variable=VAR (pkglibdir|plugindir)
+USE
+}
+[ $# -eq 0 ] && { usage; exit 1; }
+for arg in "$@"; do
+  case "$arg" in
+    --cflags|--include)   printf '%s\n' "$inc" ;;
+    --libs|--libs_r)      printf '%s\n' "-L$libdir/ -lmariadb" ;;
+    --libs_sys)           printf '%s\n' "-lz -ldl -lm -lssl -lcrypto" ;;
+    --plugindir)          printf '%s\n' "$libdir/libmariadb3/plugin" ;;
+    --socket)             printf '%s\n' "/run/mysqld/mysqld.sock" ;;
+    --port)               printf '%s\n' "3306" ;;
+    --version)            printf '%s\n' "$version" ;;
+    --variable=pkglibdir) printf '%s\n' "$libdir" ;;
+    --variable=plugindir) printf '%s\n' "$libdir/libmariadb3/plugin" ;;
+    --help|-h)            usage ;;
+    *) echo "$0: unrecognized option '$arg'" >&2; exit 1 ;;
+  esac
+done
diff --git a/debian/rules b/debian/rules
index 4b10965..0b5da6e 100755
--- a/debian/rules
+++ b/debian/rules
@@ -227,6 +227,30 @@ override_dh_installinit:
 override_dh_gencontrol:
 	dh_gencontrol -- -Tdebian/substvars
 
+# Make libmariadb-dev co-installable across architectures (Multi-Arch: same).
+# Two files would otherwise differ between architectures at shared paths:
+#  - /usr/bin/mariadb_config: replace the per-arch compiled binary with an
+#    architecture-independent shell script that derives the multiarch triplet
+#    at runtime, so the file is byte-identical on every architecture.
+#  - /usr/include/mariadb/mariadb_version.h: move only the two arch-varying
+#    macros (MARIADB_MACHINE_TYPE, MARIADB_PLUGINDIR) into a stub header in the
+#    per-arch triplet include dir (which the compiler searches automatically),
+#    leaving the public header byte-identical across architectures. The header
+#    must NOT be relocated: mysql.h pulls it in with #include "..." (same dir).
+execute_after_dh_install:
+	set -e; pkgdir=debian/libmariadb-dev; inc=$$pkgdir/usr/include; \
+	if [ -f $$inc/mariadb/mariadb_version.h ]; then \
+		install -m0755 debian/mariadb_config $$pkgdir/usr/bin/mariadb_config; \
+		mkdir -p $$inc/$(DEB_HOST_MULTIARCH); \
+		grep -E 'MARIADB_MACHINE_TYPE|MARIADB_PLUGINDIR' \
+			$$inc/mariadb/mariadb_version.h \
+			> $$inc/$(DEB_HOST_MULTIARCH)/mariadb_version_arch.h; \
+		sed -i -E '/MARIADB_MACHINE_TYPE|MARIADB_PLUGINDIR/d' \
+			$$inc/mariadb/mariadb_version.h; \
+		sed -i '/#define _mariadb_version_h_/a #include <mariadb_version_arch.h>' \
+			$$inc/mariadb/mariadb_version.h; \
+	fi
+
 # If a file is not supposed to be included anywhere, add it to the not-installed
 # file and document the reason. Note that dh_install supports the above mentioned
 # white list file only starting from Debian Stretch and Ubuntu Xenial.
-- 
2.47.3

Reply via email to