From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIvHq-0001WX-Fg for guix-patches@gnu.org; Wed, 16 May 2018 08:12:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fIvHn-0000px-5x for guix-patches@gnu.org; Wed, 16 May 2018 08:12:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:56852) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fIvHn-0000pt-2K for guix-patches@gnu.org; Wed, 16 May 2018 08:12:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fIvHm-0003SQ-TJ for guix-patches@gnu.org; Wed, 16 May 2018 08:12:02 -0400 Subject: [bug#31473] [PATCH] daemon: Allow building for armhf-linux on aarch64-linux. Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36151) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIvGr-0001MT-Uk for guix-patches@gnu.org; Wed, 16 May 2018 08:11:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fIvGo-0000Gf-Kx for guix-patches@gnu.org; Wed, 16 May 2018 08:11:05 -0400 Received: from flashner.co.il ([178.62.234.194]:40790) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIvGo-0000GJ-Du for guix-patches@gnu.org; Wed, 16 May 2018 08:11:02 -0400 From: Efraim Flashner Date: Wed, 16 May 2018 15:10:56 +0300 Message-Id: <20180516121056.29167-1-efraim@flashner.co.il> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 31473@debbugs.gnu.org Cc: Efraim Flashner * nix/libstore/build.cc (canBuildLocally): Allow building armhf-linux builds on aarch64-linux. (DerivationGoal::runChild) Throw error if attempting to build for armhf-linux on an unsupported platform. * doc/guix.texi (Invoking guix build): Document how to build natively for armhf-linux on aarch64-linux. Add note that on some aarch64 machines this is unsupported. --- doc/guix.texi | 9 ++++++++- nix/libstore/build.cc | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index a771ab7ae..e64b91608 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -5855,9 +5855,16 @@ information on cross-compilation. =20 An example use of this is on Linux-based systems, which can emulate different personalities. For instance, passing -@code{--system=3Di686-linux} on an @code{x86_64-linux} system allows you +@code{--system=3Di686-linux} on an @code{x86_64-linux} system or +@code{--system=3Darmhf-linux} on an @code{aarch64-linux} system allows y= ou to build packages in a complete 32-bit environment. =20 +@quotation Note +Building for an @code{armhf-linux} system is unconditionally enabled on +@code{aarch64-linux} machines, although certain aarch64 chipsets do not +allow for this functionality. +@end quotation + Similarly, when transparent emulation with QEMU and @code{binfmt_misc} is enabled (@pxref{Virtualization Services, @code{qemu-binfmt-service-type}}), you can build for any system for diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc index 34647e677..c7f32494d 100644 --- a/nix/libstore/build.cc +++ b/nix/libstore/build.cc @@ -1244,6 +1244,7 @@ static bool canBuildLocally(const string & platform= ) return platform =3D=3D settings.thisSystem #if __linux__ || (platform =3D=3D "i686-linux" && settings.thisSystem =3D=3D "= x86_64-linux") + || (platform =3D=3D "armhf-linux" && settings.thisSystem =3D=3D = "aarch64-linux") #endif ; } @@ -2220,6 +2221,13 @@ void DerivationGoal::runChild() throw SysError("cannot set i686-linux personality"); } =20 + if (drv.platform =3D=3D "armhf-linux" && + (settings.thisSystem =3D=3D "aarch64-linux" || + (!strcmp(utsbuf.sysname, "Linux") && !strcmp(utsbuf.machine= , "aarch64")))) { + if (personality(PER_LINUX32) =3D=3D -1) + throw SysError("cannot set armhf-linux personality"); + } + /* Impersonate a Linux 2.6 machine to get some determinism in builds that depend on the kernel version. */ if ((drv.platform =3D=3D "i686-linux" || drv.platform =3D=3D "x8= 6_64-linux") && settings.impersonateLinux26) { --=20 2.17.0