Source: mariadb-10.3
Version: 1:10.3.15-2
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

mariadb-10.3 fails to cross build from source. The immediate reason is
that its perl dependency is not satisfiable. I'm not quite sure what it
needs perl for, so I'm uneasy about annotating it :native. Let's defer
that part for now.

Once the dependency issue is ignored, a cross build gets quite far until
it tries to execute host tools. A little research on the web quickly
yields https://mariadb.com/kb/en/library/cross-compiling-mariadb/. There
we read that we should perform a native build pass with a make target of
import_executables first. The attached patch implements that.
Unfortunately, it seems like mariadb cannot be built without libreadline
at all (even for the import_executables), so we'll have to depend on the
build architecture libreadline-gplv2-dev. At this point, we'll get stuck
as installing multiple libreadline-gplv2-dev is currently broken
(#707750).

While getting there, I also ran into a small problem where
cmake/systemd.cmake would use CHECK_LIBRARY_EXISTS without
INCLUDE(CheckLibraryExists) and fail. This looks like a simple upstream
bug.

So the attached patch will not make mariadb-10.3 cross buildable, but it
will be a little closer to that goal. Can you apply it and close this
bug when doing so?

Helmut
diff --minimal -Nru mariadb-10.3-10.3.15/debian/changelog 
mariadb-10.3-10.3.15/debian/changelog
--- mariadb-10.3-10.3.15/debian/changelog       2019-06-07 08:13:35.000000000 
+0200
+++ mariadb-10.3-10.3.15/debian/changelog       2019-06-10 06:34:40.000000000 
+0200
@@ -1,3 +1,14 @@
+mariadb-10.3 (1:10.3.15-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Improve cross building. (Closes: #-1)
+    + Perform a native build of import_executables first.
+    + cross.patch: Fix missing include in cmake/systemd.cmake.
+    + Build-Depends: libreadline-gplv2-dev:native for the native pass.
+    + Forward IMPORT_EXECUTABLES to the cross build pass.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Mon, 10 Jun 2019 06:34:40 +0200
+
 mariadb-10.3 (1:10.3.15-2) unstable; urgency=medium
 
   [ Julien Muchembled ]
diff --minimal -Nru mariadb-10.3-10.3.15/debian/control 
mariadb-10.3-10.3.15/debian/control
--- mariadb-10.3-10.3.15/debian/control 2019-05-21 09:45:30.000000000 +0200
+++ mariadb-10.3-10.3.15/debian/control 2019-06-10 06:34:40.000000000 +0200
@@ -24,6 +24,7 @@
                libpam0g-dev,
                libpcre3-dev (>= 2:8.35-3.2~),
                libreadline-gplv2-dev,
+               libreadline-gplv2-dev:native,
                libsnappy-dev,
                libsystemd-dev [linux-any],
                libxml2-dev,
diff --minimal -Nru mariadb-10.3-10.3.15/debian/patches/cross.patch 
mariadb-10.3-10.3.15/debian/patches/cross.patch
--- mariadb-10.3-10.3.15/debian/patches/cross.patch     1970-01-01 
01:00:00.000000000 +0100
+++ mariadb-10.3-10.3.15/debian/patches/cross.patch     2019-06-10 
06:34:40.000000000 +0200
@@ -0,0 +1,10 @@
+--- mariadb-10.3-10.3.15.orig/cmake/systemd.cmake
++++ mariadb-10.3-10.3.15/cmake/systemd.cmake
+@@ -19,6 +19,7 @@
+     # http://www.cmake.org/cmake/help/v3.0/module/FindPkgConfig.html
+     INCLUDE(CheckFunctionExists)
+     INCLUDE(CheckIncludeFiles)
++    INCLUDE(CheckLibraryExists)
+ 
+     SET(WITH_SYSTEMD "auto" CACHE STRING "Enable systemd scripts and 
notification support")
+     IF(WITH_SYSTEMD STREQUAL "yes" OR WITH_SYSTEMD STREQUAL "auto")
diff --minimal -Nru mariadb-10.3-10.3.15/debian/patches/series 
mariadb-10.3-10.3.15/debian/patches/series
--- mariadb-10.3-10.3.15/debian/patches/series  2019-05-03 16:05:31.000000000 
+0200
+++ mariadb-10.3-10.3.15/debian/patches/series  2019-06-10 06:34:40.000000000 
+0200
@@ -17,3 +17,4 @@
 tokudb-libjemalloc.patch
 MDEV-18768-automate-auth_socket-to_unix_socket-upgrade.patch
 928230-mysql_config---libmysqld-libs.patch
+cross.patch
diff --minimal -Nru mariadb-10.3-10.3.15/debian/rules 
mariadb-10.3-10.3.15/debian/rules
--- mariadb-10.3-10.3.15/debian/rules   2019-05-21 09:45:30.000000000 +0200
+++ mariadb-10.3-10.3.15/debian/rules   2019-06-10 06:34:40.000000000 +0200
@@ -66,7 +66,7 @@
        rm -f 
storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result
        rm -f debian/mariadb-server-10.3.mariadb.service
        rm -f debian/mariadb-server-10.3.mariadb@.service
-       rm -rf $(BUILDDIR)
+       rm -rf $(BUILDDIR) builddir-native
 
        [ ! -f debian/mysql-test-unstable-tests.orig ] || \
            mv debian/mysql-test-unstable-tests.orig mysql-test/unstable-tests
@@ -84,6 +84,11 @@
        rm debian/libmariadb3.symbols
 endif
 
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+       dpkg-architecture -a$(DEB_BUILD_ARCH) -f -c dh_auto_configure 
--builddirectory=builddir-native
+       dh_auto_build --builddirectory=builddir-native -- import_executables
+endif
+
        # Remove -DWITH_SSL=bundle if you want to use system OpenSSL, otherwise
        # the server will use YaSSL and Connector/C will use GnuTLS
        mkdir -p $(BUILDDIR) && cd $(BUILDDIR) && \
@@ -92,6 +97,7 @@
                CXX=${CXX} \
            cmake -DCMAKE_INSTALL_PREFIX=/usr \
            $(CMAKEFLAGS) \
+           $(if $(filter 
$(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)),,-DIMPORT_EXECUTABLES=$(CURDIR)/builddir-native/import_executables.cmake)
 \
            -DCOMPILATION_COMMENT="$(DEB_VENDOR) $(RELEASE)" \
            -DMYSQL_SERVER_SUFFIX="-$(DEB_VERSION_REVISION)" \
            -DSYSTEM_TYPE="debian-$(DEB_HOST_GNU_SYSTEM)" \

Reply via email to