From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Cross-compilation, Guix "system", and GNU "triplet" Date: Fri, 24 Nov 2017 14:50:23 +0100 Message-ID: <871sknbxb4.fsf@gnu.org> References: <87shd4sduo.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIENB-0004tD-Hz for guix-devel@gnu.org; Fri, 24 Nov 2017 08:50:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIEN8-00070S-BW for guix-devel@gnu.org; Fri, 24 Nov 2017 08:50:29 -0500 Received: from hera.aquilenet.fr ([141.255.128.1]:49887) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eIEN8-0006zy-1T for guix-devel@gnu.org; Fri, 24 Nov 2017 08:50:26 -0500 In-Reply-To: <87shd4sduo.fsf@gmail.com> (Chris Marusich's message of "Thu, 23 Nov 2017 16:46:23 -0800") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Chris Marusich Cc: guix-devel@gnu.org Hi, Chris Marusich skribis: > As mentioned in bug 29402 [1], Guix uses strings like "armhf-linux" to > identify a system platform. However, to cross-compile a package using > Guix, you need to specify the target platform's "GNU triplet", which > looks like "arm-linux-gnueabihf" (e.g. by invoking "guix build > --target=3Darm-linux-gnueabihf hello"). These are not the same thing. > > OK, so Guix system "armhf-linux" maps to GNU triplet > "arm-linux-gnueabihf". Or perhaps a better way to think of this is that > Guix system "armhf-linux" refers to a very specific platform choice - > and it happens to be the case that that platform can also be identified > by the GNU triplet "arm-linux-gnueabihf". What about other ARM > variants? When we eventually get Guix running on two variants of ARM, > will we just define another special string, like "the-second-arm-linux", > to identify its Guix system? The Guix system string has the form ARCHITECTURE-KERNEL, because these are the two things not explicitly captured by the derivation graph. The =E2=80=9Chf=E2=80=9D in =E2=80=9Carmhf-linux=E2=80=9D denotes an ARMv7 = processor with a hardware floating point unit; it does not denote the ABI since the ABI is something that=E2=80=99s software-defined. As it turns out, we map =E2=80=9Carmhf-linux=E2=80=9D to the HF ABI (=E2=80= =9Ceabihf=E2=80=9D), because that=E2=80=99s the most sensible thing to do, but we could just as well map= it to the old soft-float ABI (=E2=80=9Ceabi=E2=80=9D). > My understanding is that multiple GNU triplets can refer to the same > platform. For example, I believe "arm-linux-gnueabihf" is the same as > "arm-unknown-linux-gnueabihf" because config.sub in Autoconf translates > the former to the latter. Do they refer to the same platform? Usually yes, because user-land software doesn=E2=80=99t care about the =E2= =80=9Cvendor=E2=80=9D part. It could make a difference to, say, GRUB, for which the =E2=80=9Cven= dor=E2=80=9D part is important. > Guix seems to treat them differently: > > [0] [env] marusich@garuda.local:~/guix > $ ./pre-inst-env guix build --no-substitutes --target=3Darm-linux-gnueabi= hf hello > /gnu/store/g7cmg23ssqwknpmbbrvap60iv524i9fw-hello-2.10 > [0] [env] marusich@garuda.local:~/guix > $ ./pre-inst-env guix build --no-substitutes --target=3Darm-unknown-linux= -gnueabihf hello > @ build-started /gnu/store/9kk7b46s836n5r0jh0sb00v8p3i5vlhg-gcc-cross-arm= -unknown-linux-gnueabihf-5.4.0.drv - x86_64-linux /var/log/guix/drvs/9k//k7= b46s836n5r0jh0sb00v8p3i5vlhg-gcc-cross-arm-unknown-linux-gnueabihf-5.4.0.dr= v.bz2 > ... > > As you can see, Guix initiated a build even though the targets are "the > same" as far as Autoconf is concerned. Perhaps this is because the > strings "arm-linux-gnueabihf" and "arm-unknown-linux-gnueabihf" differ, > which causes the derivations' output paths to differ? Guix doesn=E2=80=99t try to interpret GNU triplets in any way. So when you= pass a triplet to --target, it goes ahead and creates a cross-toolchain for that triplet. If turns out that Hydra has substitutes for the arm-linux-gnueabihf cross-toolchain, but not for arm-whatever-linux-gnueabihf. > Finally, I want to ask for some clarification regarding the "GNU > triplet" concept in general. Using the language of the section titled > "Specifying Target Triplets" in the Autoconf manual, I understand that a > GNU triplet takes the following form: > > `CPU-VENDOR-OS', where OS can be `SYSTEM' or `KERNEL-SYSTEM' > > It seems to me that "SYSTEM" here always denotes an ABI, such as > "gnueabihf". Can SYSTEM ever refer to something that is NOT an ABI? The triplet idea predates GNU/Linux, I think. Back then, it was quite clear what the OS was: SunOS, AIX, GNU, etc. With glibc ported to the kernel Linux, it became useful to differentiate between =E2=80=9Cgnu=E2=80=9D (i.e., GNU/Hurd) and =E2=80=9Clinux-gnu=E2=80= =9D. User-land software often only cares about the =E2=80=9C-gnu=E2=80=9D part, but sometimes it ne= eds to know about the kernel as well. Then people had the idea to abuse the triplet to piggyback information about the ABI being targeted. There are bits in the toolchain that interpret it meaningfully. I hope it makes sense. :-) Ludo=E2=80=99.