all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Efraim Flashner <efraim@flashner.co.il>
To: 31473@debbugs.gnu.org
Cc: Efraim Flashner <efraim@flashner.co.il>
Subject: [bug#31473] [PATCH] daemon: Allow building for armhf-linux on aarch64-linux.
Date: Wed, 16 May 2018 15:10:56 +0300	[thread overview]
Message-ID: <20180516121056.29167-1-efraim@flashner.co.il> (raw)

* 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.
 
 An example use of this is on Linux-based systems, which can emulate
 different personalities.  For instance, passing
-@code{--system=i686-linux} on an @code{x86_64-linux} system allows you
+@code{--system=i686-linux} on an @code{x86_64-linux} system or
+@code{--system=armhf-linux} on an @code{aarch64-linux} system allows you
 to build packages in a complete 32-bit environment.
 
+@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 == settings.thisSystem
 #if __linux__
         || (platform == "i686-linux" && settings.thisSystem == "x86_64-linux")
+        || (platform == "armhf-linux" && settings.thisSystem == "aarch64-linux")
 #endif
         ;
 }
@@ -2220,6 +2221,13 @@ void DerivationGoal::runChild()
                 throw SysError("cannot set i686-linux personality");
         }
 
+        if (drv.platform == "armhf-linux" &&
+            (settings.thisSystem == "aarch64-linux" ||
+             (!strcmp(utsbuf.sysname, "Linux") && !strcmp(utsbuf.machine, "aarch64")))) {
+            if (personality(PER_LINUX32) == -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 == "i686-linux" || drv.platform == "x86_64-linux") && settings.impersonateLinux26) {
-- 
2.17.0

             reply	other threads:[~2018-05-16 12:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-16 12:10 Efraim Flashner [this message]
2018-05-17 11:21 ` [bug#31473] [PATCH] daemon: Allow building for armhf-linux on aarch64-linux Ludovic Courtès
2018-05-17 11:27   ` Efraim Flashner
2018-05-17 14:08     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180516121056.29167-1-efraim@flashner.co.il \
    --to=efraim@flashner.co.il \
    --cc=31473@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.