From nobody Thu May 2 00:54:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1548677012941215.33164245194746; Mon, 28 Jan 2019 04:03:32 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 93F6685546; Mon, 28 Jan 2019 12:03:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E4793627DF; Mon, 28 Jan 2019 12:03:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8B2FA3F954; Mon, 28 Jan 2019 12:03:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0SC3NvD009534 for ; Mon, 28 Jan 2019 07:03:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9EF8362956; Mon, 28 Jan 2019 12:03:23 +0000 (UTC) Received: from dhcp-16-175.lcy.redhat.com (unknown [10.42.16.175]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17243627DF; Mon, 28 Jan 2019 12:03:18 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Mon, 28 Jan 2019 12:03:17 +0000 Message-Id: <20190128120317.24560-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH] Add support for cross compiling libvirt via Debian X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 28 Jan 2019 12:03:31 +0000 (UTC) Debian's filesystem layout has a nice advantage over Fedora which is that it can install non-native RPMs in the main root filesystem. It is thus possible to prepare an x86_64 filesystem containing -dev packages for a foreign architecture, along with a GCC cross compiler. QEMU has used this technique to facilitate developer build testing of non-x86 architectures, since few people have access to physical hardware for most of these architectures. For the same reason it would be helpful to libvirt developers. This docker file allows creation of containers buildenv-cross-$ARCH for arm64, armel, armhf, mips, mipsel, mips64el, ppc64el, s390x, based off Debian 9, in which libvirt can be cross-compiled. Debian can support further architectures, but only by using the unstable 'sid' repos. This does not enable use of 'sid' but it could be added fairly easily at a later date if desired. Most of the other architectures are fairly old & obscure, the main interesting exception being riscv64. If qemu-user emulators are registered with the kernel binfmt, then it is theoretically possible to run "make check" tool, though this has not been tested. Signed-off-by: Daniel P. Berrang=C3=A9 --- .gitignore | 1 + cross-build/arch-config.csv | 8 +++ cross-build/buildenv-cross.docker.in | 96 ++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 cross-build/arch-config.csv create mode 100644 cross-build/buildenv-cross.docker.in diff --git a/.gitignore b/.gitignore index b25c15b..4884352 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *~ +cross-build/*docker diff --git a/cross-build/arch-config.csv b/cross-build/arch-config.csv new file mode 100644 index 0000000..36fcb5f --- /dev/null +++ b/cross-build/arch-config.csv @@ -0,0 +1,8 @@ +arm64,crossbuild-essential-arm64,aarch64-linux-gnu +armel,crossbuild-essential-armel,arm-linux-gnueabi +armhf,crossbuild-essential-armhf,arm-linux-gnueabihf +mips64el,gcc-mips64el-linux-gnuabi64,mips64el-linux-gnuabi64 +mips,gcc-mips-linux-gnu,mips-linux-gnu +mipsel,gcc-mipsel-linux-gnu,mipsel-linux-gnu +ppc64el,crossbuild-essential-ppc64el,powerpc64le-linux-gnu +s390x,gcc-multilib-s390x-linux-gnu,s390x-linux-gnu diff --git a/cross-build/buildenv-cross.docker.in b/cross-build/buildenv-cr= oss.docker.in new file mode 100644 index 0000000..97a9e69 --- /dev/null +++ b/cross-build/buildenv-cross.docker.in @@ -0,0 +1,96 @@ +# +# ::ARCH:: cross-compiler target +# +FROM debian:stretch-slim + +# Grab the updated list of packages +RUN apt update && apt dist-upgrade -yy + +# First some common native binaries. Any program that the +# build will execute needs to have a native binary package +# installed. We don't want to rely on qemu-user emulation +# for executing non-native binaries as that is slow & flaky +RUN DEBIAN_FRONTEND=3Dnoninteractive \ + apt-get install -y --no-install-recommends \ + git \ + build-essential \ + ca-certificates \ + libtool\ + autoconf \ + automake \ + python3 \ + xsltproc \ + parted \ + radvd \ + qemu-system-common \ + dwarves \ + libxml2-utils \ + dnsmasq-base \ + openssh-client \ + netcat-openbsd \ + ebtables \ + iptables \ + sheepdog \ + qemu-utils \ + qemu-system-x86 \ + pkg-config + + +# Add the ::ARCH:: architecture +RUN dpkg --add-architecture ::ARCH:: + + +# Grab the freshly updated list of packages +RUN apt update + + +# Pull in the native package for the cross-compiler +RUN DEBIAN_FRONTEND=3Dnoninteractive \ + apt-get install -y --no-install-recommends \ + ::COMPILER:: + +# Finally pull in the foreign architecture library +# packages that we're going to link against. Everything +# here should be a -dev package. Binaries belong earlier +RUN DEBIAN_FRONTEND=3Dnoninteractive \ + apt-get install -y --no-install-recommends \ + libxml2-dev:::ARCH:: \ + libncurses5-dev:::ARCH:: \ + libreadline-dev:::ARCH:: \ + zlib1g-dev:::ARCH:: \ + libgcrypt20-dev:::ARCH:: \ + libgnutls28-dev:::ARCH:: \ + libavahi-client-dev:::ARCH:: \ + libsasl2-dev:::ARCH:: \ + libparted-dev:::ARCH:: \ + libdevmapper-dev:::ARCH:: \ + uuid-dev:::ARCH:: \ + libudev-dev:::ARCH:: \ + libpciaccess-dev:::ARCH:: \ + libpolkit-gobject-1-dev:::ARCH:: \ + libcap-ng-dev:::ARCH:: \ + libnl-3-dev:::ARCH:: \ + libnl-route-3-dev:::ARCH:: \ + libyajl-dev:::ARCH:: \ + libpcap0.8-dev:::ARCH:: \ + libsanlock-dev:::ARCH:: \ + libaudit-dev:::ARCH:: \ + libselinux1-dev:::ARCH:: \ + libapparmor-dev:::ARCH:: \ + libdbus-1-dev:::ARCH:: \ + librbd-dev:::ARCH:: \ + librados-dev:::ARCH:: \ + libfuse-dev:::ARCH:: \ + libssh2-1-dev:::ARCH:: \ + libcurl4-gnutls-dev:::ARCH:: \ + libacl1-dev:::ARCH:: \ + libiscsi-dev:::ARCH:: \ + xfslibs-dev:::ARCH:: \ + libssh-dev:::ARCH:: \ + libgnutls28-dev:::ARCH:: + +# Tell libvirt which architecture we want to target +ENV LIBVIRT_CONFIGURE_OPTS "--host=3D::ABI:: --build=3Dx86_64-linux-gnu --= target=3D::ABI::" + +# Tell pkg-config where to find the non-native .pc files +ENV PKG_CONFIG_LIBDIR=3D/usr/lib/::ABI::/pkgconfig --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list