From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id mLquF2zwIGLw8wAAgWs5BA (envelope-from ) for ; Thu, 03 Mar 2022 17:44:28 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id sCkWFWzwIGLnugAA9RJhRA (envelope-from ) for ; Thu, 03 Mar 2022 17:44:28 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id DF955AC06 for ; Thu, 3 Mar 2022 17:44:27 +0100 (CET) Received: from localhost ([::1]:60014 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPoZ0-0000MH-LQ for larch@yhetil.org; Thu, 03 Mar 2022 11:44:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPoVi-0005Ah-Ii for guix-patches@gnu.org; Thu, 03 Mar 2022 11:41:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:49634) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nPoVi-00078S-A9 for guix-patches@gnu.org; Thu, 03 Mar 2022 11:41:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nPoVi-0001Ig-1c for guix-patches@gnu.org; Thu, 03 Mar 2022 11:41:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#54239] [PATCH] gnu: Add cross-clang. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 03 Mar 2022 16:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54239 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Julien Lepiller , 54239@debbugs.gnu.org Received: via spool by 54239-submit@debbugs.gnu.org id=B54239.16463256434964 (code B ref 54239); Thu, 03 Mar 2022 16:41:02 +0000 Received: (at 54239) by debbugs.gnu.org; 3 Mar 2022 16:40:43 +0000 Received: from localhost ([127.0.0.1]:43531 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nPoVP-0001I0-Eu for submit@debbugs.gnu.org; Thu, 03 Mar 2022 11:40:43 -0500 Received: from albert.telenet-ops.be ([195.130.137.90]:35208) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nPoVO-0001Hr-3w for 54239@debbugs.gnu.org; Thu, 03 Mar 2022 11:40:43 -0500 Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by albert.telenet-ops.be with bizsmtp id 1sgg2700D4UW6Th06sgg5M; Thu, 03 Mar 2022 17:40:40 +0100 Message-ID: <70c3446488f9b76479f4f989c351403c461369d1.camel@telenet.be> From: Maxime Devos Date: Thu, 03 Mar 2022 17:40:36 +0100 In-Reply-To: <20220303170252.3caec0a6@tachikoma.lepiller.eu> References: <20220303170252.3caec0a6@tachikoma.lepiller.eu> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-7UYS6Gzf4A0UuUJE5knD" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1646325640; bh=Mdo+K5fN1fNM87GnI3bXD5R5Ems6uTn3etE4gRIazEo=; h=Subject:From:To:Date:In-Reply-To:References; b=BZ+xqvMVLhH/Punb4I2pOmZgztpWFVTxspI0hEAqgO7AzDhJPcVarqtuQs+Lm1WuA P1M3BUCRlDpk8fZ2FnJXnf3nW23Ze+qaXqC6ZFy9AxJvpdkuPCI9aSEo1w2WLAmxD1 XYXLFyCOJH1RcbYsUiNhSgcBOY0YWNTGQkb+GYV6BqeijZmY8OU4x5kUGuoZo00gvr kRtmaX7fUCQVU8rIOd3c3JOkTgqkL/lum6Oa6ZwDRQzADA3lewL17VJrSdaYojDc0S YT7hgYulUiNWNmNHpIRIqtbco0k5GU5/z0Xuh4/K3isz8ulRKdA6TuEPNeKw67M+6a rpjGj1HwEHomA== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1646325867; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=Mdo+K5fN1fNM87GnI3bXD5R5Ems6uTn3etE4gRIazEo=; b=m34MykbRcaUx882PyiQRkgZD4GMFBz04JXmOEPg7oG0OcnaHdQJoIjibkXgt3qpcjFDtND X9UZTM6+xq90LZj7m6heq0YALNA5iFn7ksplwU9uX7umshUkCqftgVgtztEZQV/rtVrK9u NMuJlevrbWPsYVOH0UAH44BlvpXg5X46BTm9cUFTUXIHLYIz3kP3lR66kaOBhLAlZFhXRl kBpQHZ46EWZZYj/zN2qSU0nIDmtQdPuI0uMbj0LRixmlWDdmNZtDIxk7oALXfz7ajKZS1F lzt7eVMG7jjYRoEBPtr8glvoY1kIm65LG0uZogpN2rZc6NSlKB5XQOtLhX3wFQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1646325867; a=rsa-sha256; cv=none; b=ZENFmQYchN4lYkZhIN4Shui81BVbV6okDoBhpQlycpOHEYgiyN4ArfWIi5GWleXyaEYhVd uqZl/IX53nGq0Kc5M1VXpk/fg+9GKbY1prBFTBGDnGmOv+C05IX4n9jaEvChnp57UcrvtK bxazuVfIwoLo03PD3y2aBJR7stZ+2i+biZgGqPplUQOtv0/T8kdk5LobBldjcMMXz1+uoM +R1AD8vEIuyyPTuQMhhmRRU+qKNIUVez6s+pBUSiMLiGZ8MLAPa3VzWxMs9VaZeXQUNCF0 eDUe6AMphJ2URw3EE11At4Hb9KrM+1kpShrogCHf4O/D1BwswCBuhrD1lwM0XA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r22 header.b=BZ+xqvMV; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 2.74 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r22 header.b=BZ+xqvMV; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: DF955AC06 X-Spam-Score: 2.74 X-Migadu-Scanner: scn0.migadu.com X-TUID: EKMNxLuuwUuK --=-7UYS6Gzf4A0UuUJE5knD Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Julien Lepiller schreef op do 03-03-2022 om 17:02 [+0100]: > Hi Guix! >=20 > This small patch series adds cross-clang, a cross-compiler version of > clang. Clang doesn't really make a distinction between a native and a > cross-build, it is already a cross-compiler, but this ensures that: >=20 > 1. it actually works > 2. it targets (%current-target-architecture) by default Do you mean (%current-target-system)? Also, WDYT of making 'cross-clang' a memoising procedure, such that there's only one package object for a cross-clang of a fixed target system (and version)? > (native-inputs > - (list clang llvm)) > + (list (if (%current-target-system) > + (cross-clang (%current-target-system) #:clang clang-9) > + clang-9))) Probably a few other packages built with clang need such a thing as well. How about making doing the right thing a bit easier? Suggestion: introduce a 'clang-for-target' procedure, automatically returning the right clang: (define (clang-for-target #:optional (clang clang)) (if (%current-target-system) (cross-clang [...]) clang)) ; not cross-compiling then packages just need to do (native-inputs (list (clang-for-target) libfoo libbar ...)) The rest of the series ensures that libcxx and libcxxabi can be cross-compiled with it. Customarily, cross-compilers are named $TARGET-foo. WDYT of renaming the clang binary to '$TARGET-clang', such that a package can have both a native clang and a cross-clang in native-inputs if desired? Also, Autoconf looks for $TARGET-compiler, where compiler is at least gcc, but possibly also clang And perhaps the package name can be changed '$TARGET-clang' like done for g= cc? > + ;; Support the same variables as clang, even in cross-compilation > + ;; context. > + ;; Clang does not make a difference between native and > + ;; cross-compilation. Upstream clang doesn't, but this is in a 'cross-clang' procedure, so I think it would make sense for Guix' cross-clang to ignore LIBRARY_PATH and only use CROSS_LIBRARY_PATH. Mixing up C_INCLUDE_PATH and CROSS_C_INCLUDE_PATH (& friends) is unlikely to lead anything good, e.g. include/bits/setjmp.h is architecture-dependent= . > + (files '("lib" "lib64")))) I don't think Guix does a "lib" / "lib64" split, "lib" might be sufficient. At least, there are a few comments like ;; Force powerpc libdir to be /lib and not /lib64 in Guix (though the gcc packages still includes "lib64" but maybe that's only due to historical reasons). How does this patch series interact with 'with-c-toolchain'? Would "guix build hello --target=3Daarch64-linux-gnu --with-c-toolchain=3D.= .." succesfully compile 'hello' with clang? Greetings, Maxime. --=-7UYS6Gzf4A0UuUJE5knD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYiDvhBccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7uqcAQDqffJqLQht4hDAoFTQnBrHB7T8 iCEOxBLwpkk/N5DA2wD+P8JGmvPywrdGpa9kkA6aaFDMZcq9onGN3RVvfrY+CAw= =J8yF -----END PGP SIGNATURE----- --=-7UYS6Gzf4A0UuUJE5knD--