daemon: Allow building for armhf-linux on aarch64-linux.

* 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.
This commit is contained in:
Efraim Flashner 2018-05-16 15:05:49 +03:00
parent 17aca5c4d2
commit 162825f965
No known key found for this signature in database
GPG Key ID: 41AAE7DCCA3D8351
2 changed files with 16 additions and 1 deletions

View File

@ -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, notably the ThunderX.
@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

View File

@ -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) {