GNU bug report logs - #54239
[PATCH] gnu: Add cross-clang.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Julien Lepiller <julien@HIDDEN>; Keywords: patch; dated Thu, 3 Mar 2022 16:04:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 21 May 2022 13:41:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 21 09:41:43 2022
Received: from localhost ([127.0.0.1]:41010 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nsPMV-0006Ex-0L
	for submit <at> debbugs.gnu.org; Sat, 21 May 2022 09:41:43 -0400
Received: from eggs.gnu.org ([209.51.188.92]:39012)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1nsPMP-0006Ee-M1
 for 54239 <at> debbugs.gnu.org; Sat, 21 May 2022 09:41:41 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:52472)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1nsPMJ-0008EQ-Qn; Sat, 21 May 2022 09:41:31 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=RJ4zIyRzQutcRvTgTFlKlqHqOYjPD+S7NrouuOMrF6s=; b=XP6/vPP2hxleKBAF+mkd
 oK3NjdjXoImcteiMmyfFLBtm+qN5ABZKTUcCBHANrNUsykOQ11DCdQexLAD6duM0qGLfy9zg08av3
 5tCAjUYRBGwjvWSlp1wTnPCNaCfAyx81rhgks0UqN3YrbNX+0jhrUvpuVXwtprrdfAmIdsCIuwHGb
 Uy+63U0wnkc7o8OEthhR1BKMlyToL35JE9pbshq9yZ7vWDfTs+1c3LpKFojUSuS3gr5w6674DekNc
 9IIjGB6JgrGXhhQVggebMpqYRiv+0rBFzi9GlEklNxNXxSMGJZk81VVOgvUDPEXg3fUP8jGTOT51U
 DgP7wA76mqWI8Q==;
Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:61258
 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1nsPMI-0006eh-9j; Sat, 21 May 2022 09:41:30 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>
Subject: Re: bug#54239: [PATCH] gnu: Add cross-clang.
References: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
 <937fd2ca36d8368ea83be56ae29dbec1a97bfb41.1646387919.git.julien@HIDDEN>
 <04c47fe2e1f964a675697f3e389f6226e11f9815.camel@HIDDEN>
Date: Sat, 21 May 2022 15:41:27 +0200
In-Reply-To: <04c47fe2e1f964a675697f3e389f6226e11f9815.camel@HIDDEN>
 (Maxime Devos's message of "Fri, 04 Mar 2022 20:50:43 +0100")
Message-ID: <87czg7uho8.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 54239
Cc: 54239 <at> debbugs.gnu.org, Pierre Langlois <pierre.langlois@HIDDEN>,
 Maxime Devos <maximedevos@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hello Julien and all,

Looks like quite a lot of work has gone into this patch series.  What=E2=80=
=99s
the status?  It would be nice to push it past the finish line!

TIA,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 5 Mar 2022 16:21:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 05 11:21:28 2022
Received: from localhost ([127.0.0.1]:48933 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQX9r-000858-VV
	for submit <at> debbugs.gnu.org; Sat, 05 Mar 2022 11:21:28 -0500
Received: from mout.gmx.net ([212.227.17.20]:59033)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pierre.langlois@HIDDEN>) id 1nQX9p-00084v-Rt
 for 54239 <at> debbugs.gnu.org; Sat, 05 Mar 2022 11:21:26 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1646497278;
 bh=QhBprqL/9hOqHxTU3D00xGUhGf2qO4++MIeXCraJ4Ro=;
 h=X-UI-Sender-Class:References:From:To:Cc:Subject:Date:In-reply-to;
 b=hHpi7ZXCzdRzJJhB0L1UkzLYIUWdhtlWPfXPXoJL0hIocx753FCYl+7NXWQjsj1V8
 Ez/43wlK+mfCKgbsFhLe/0YlVyzfxTpj5kCOfDf5YQKRBoK4aE3hTvCX9xS0I66BBx
 GYiIwQmshbLn36oRlXTlyvSK17fjlue45iUwlJGw=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from labiere ([82.69.64.142]) by mail.gmx.net (mrgmx104
 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MTAFb-1nbtnF1Mjv-00UdE6; Sat, 05
 Mar 2022 17:21:18 +0100
References: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
 <de91f63243153229e558311bb91f688ca8e177fb.1646387919.git.julien@HIDDEN>
User-agent: mu4e 1.6.10; emacs 27.2
From: Pierre Langlois <pierre.langlois@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>
Subject: Re: [bug#54239] [PATCH v2 2/5] gnu: Add cross-clang.
Date: Sat, 05 Mar 2022 16:05:43 +0000
In-reply-to: <de91f63243153229e558311bb91f688ca8e177fb.1646387919.git.julien@HIDDEN>
Message-ID: <87wnh8gykq.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Provags-ID: V03:K1:83EpukF15SqGaAp7230/ZegFEOF0/furozBJNQbgpEiarBPvQhL
 wpijfAN6wVjbfn6wVR2j+lluuvsXzIvM9lmVEFSt4uN3XeHTktPiGlC5SVeuU97L4L0eXvu
 O0gDA8tDmvnPhs5uu+KnsIJH+Bx1MrFPBi9xwjIZpiKxehvNTbq8l4X0Y3XlbERkW6T/+ny
 OaItJDHM4NXx2OOtqn39w==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:LN6IrCs+k/8=:pvwNU7sQthlrN6x/j8i89v
 sHymauDVupqAVDzeYytrwEeQLy87HJQuDr+tQf0EP2S5rM2PpFOANxA+47Lu9Y/AaaqR8BRsn
 8ZKSfQy8L/5gTu60+Myn//vPTf7jmws/MzyuXTOsZDmz5SjYk+V/NnnxzznHfiKUtMZMvm6h1
 ZB7a7fiOnfoT5f579kTtghV2Os8qQpEBi+goKRZd7rBLmSC28Nu1VMR4VToe+RPXXPHoTBTIZ
 wkYLv630PzXRzjIJjNkS07YPQwyPTfUHWSKsH4hp7GBXa6IPw02zsikgHmWA2JM2rGKAtNWp9
 QU1Zreo0IaaFc3dGYCNVz2sib1zzkDwsd+TA/5uSUdY7wQTWP0jDvaEqiDRB4x4tJM68ummp0
 MEgiaNllqwK8ljIRWpNawJbMyh/mUAK+dJxn5IEnKuwA5XdLCFjs1YX4DDy65JWbb2QlzEhyw
 m1veJChir+AjB/UsCGxlEgxPXfxe8TguXKEaln2SH07q6P3d0Y0QY7kOlI53XocZnNfic4K/t
 lB8t+B5Z99JC+muBMIq2v9/xEfS+YrPIX6UFHiDWONgiS9Ly1N3SFMZkMuKg8Kjortd5hkmJy
 i4CkvG3dQsO6H96vVMbQ5TEB2VKqTGGSniQmzBrSiqYQgtZXftEfM81fhuNeio/mi3CPfsrrJ
 2x3haLOhM2zHjsvZxZ3dgT3SY1MPFdOmh0xRu/K9UJpuSJXq/RSMC6Unjr+OhGIp+MyzpCY3J
 NpPlK7E81azb+zCn+A1lSsKyLUAyz+wG4fRQ9dGsJeOlBAzlTnRfEyUJT5aAJimrPPjbzEGOX
 +HfjKvavHGUAb7iSKZ2dxIWI0dWs9PgbzfuKLJr48t0BiOvrEA4piAh4c+GT1zk85a7ydo24X
 kAF8tWJG1CXpFS0R7iINSKV4JKc9ayr4CgzMzg2DOy5ExQ3A+WIvjDdYMf1zpv+My//zrAg5I
 5MWWwf5MfPUtCn/4+ZX8ccAT8Lc3c6vaK+8T0yb0YiPd6krMzaRIuQ9ckFtZTNmet1Vu98iFZ
 I2PQKxY9XKZUOdPgXI4zL+Ap0vOvrHO0B48xT4NwtUr2nFrRA0WEjMW5q3ZZylITCP9ITKnzj
 ijqCmvRZp8nKuA=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 54239
Cc: 54239 <at> debbugs.gnu.org, guix-patches@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Hi,

A couple of comments from me while testing this trying to build a
cross-toolchain with llvm-13.  Hope this is helpful!

Julien Lepiller <julien@HIDDEN> writes:

> * gnu/packages/llvm.scm (cross-clang): New variable.
> ---
>  gnu/packages/llvm.scm | 144 +++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 143 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
> index d6e9846699..c277e2ac35 100644
> --- a/gnu/packages/llvm.scm
> +++ b/gnu/packages/llvm.scm
> @@ -54,6 +54,7 @@ (define-module (gnu packages llvm)
>    #:use-module (guix build-system trivial)
>    #:use-module (gnu packages)
>    #:use-module (gnu packages base)
> +  #:use-module (gnu packages cross-base)
>    #:use-module (gnu packages gcc)
>    #:use-module (gnu packages bootstrap)           ;glibc-dynamic-linker
>    #:use-module (gnu packages check)               ;python-lit
> @@ -75,7 +76,9 @@ (define-module (gnu packages llvm)
>    #:use-module (ice-9 match)
>    #:export (make-lld-wrapper
>              system->llvm-target
> -            cross-llvm))
> +            cross-llvm
> +            cross-clang
> +            clang-for-target))
>=20=20
>  (define* (system->llvm-target #:optional
>                                (system (or (and=3D> (%current-target-syst=
em)
> @@ -1023,6 +1026,145 @@ (define-public clang-runtime clang-runtime-13)
>  (define-public clang clang-13)
>  (define-public clang-toolchain clang-toolchain-13)
>=20=20
> +(define* (cross-clang target
> +                      #:key
> +                      (libc (cross-libc target))
> +                      (xgcc (cross-gcc target
> +                              #:xbinutils (cross-binutils target)
> +                              #:libc (cross-libc target)))
> +                      (clang clang))
> +  "Return a cross-clang compiler for target."
> +  (define cross-clang-aux
> +    (mlambda (target libc xgcc clang)
> +      (package
> +        (inherit clang)
> +        (name (string-append "clang-cross-" target))
> +        (version (package-version clang))
> +        ;; Support the same variables as clang, even in cross-compilatio=
n context.
> +        ;; Clang does not make a difference between native and cross-com=
pilation.
> +        (search-paths
> +          (list
> +            (search-path-specification
> +              (variable "CROSS_LIBRARY_PATH")
> +              (files '("lib")))
> +            (search-path-specification
> +              (variable "CROSS_C_INCLUDE_PATH")
> +              (files '("include")))
> +            (search-path-specification
> +              (variable "CROSS_CPLUS_INCLUDE_PATH")
> +              (files '("include/c++" "include")))))
> +        (native-search-paths '())
> +        (arguments
> +         (substitute-keyword-arguments (package-arguments clang)
> +           ((#:configure-flags _)
> +            `(list "-DCLANG_INCLUDE_TESTS=3DTrue"
> +                   (string-append "-DGCC_INSTALL_PREFIX=3D"
> +                                  (assoc-ref %build-inputs "cross-gcc-li=
b"))
> +                   (string-append "-DC_INCLUDE_DIRS=3D"
> +                                  (assoc-ref %build-inputs "target-libc")
> +                                  "/include")))
> +           ((#:phases phases)
> +            `(modify-phases ,phases
> +               (add-after 'unpack 'add-missing-libdir
> +                 (lambda _
> +                   ;; cross-gcc installs its libraries in <target>/lib i=
nstead of
> +                   ;; lib.
> +                   (substitute* "lib/Driver/ToolChain.cpp"
> +                     (("\"-L\"\\) \\+ LibPath\\)\\);")
> +                      ,(string-append "\"-L\") + LibPath));
> +  CmdArgs.push_back(Args.MakeArgString(StringRef(\"-L\") + "
> +                                     "StringRef(GCC_INSTALL_PREFIX) + St=
ringRef(\"/"
> +                                     target "/lib\")));
> +  CmdArgs.push_back(Args.MakeArgString(StringRef(\"-rpath=3D\") + "
> +                                     "StringRef(GCC_INSTALL_PREFIX) + St=
ringRef(\"/"
> +                                     target "/lib\")));")))))
> +               (add-after 'unpack 'support-cross-include-path
> +                 (lambda _
> +                   (substitute* "lib/Driver/ToolChains/Clang.cpp"
> +                     (("C_INCLUDE_PATH") "CROSS_C_INCLUDE_PATH")
> +                     (("CPLUS_INCLUDE_PATH") "CROSS_CPLUS_INCLUDE_PATH")=
)))
> +               (add-after 'unpack 'support-cross-library-path
> +                 (lambda _
> +                   ;; LIBRARY_PATH is only supported for native builds, =
but we still
> +                   ;; need it (or CROSS_LIBRARY_PATH to be precise) when
> +                   ;; cross-compiling
> +                   (substitute* "lib/Driver/ToolChains/CommonArgs.cpp"
> +                     (("LIBRARY_PATH\"")
> +                      "LIBRARY_PATH\");
> +  } else {
> +    addDirectoryList(Args, CmdArgs, \"-L\", \"CROSS_LIBRARY_PATH\""))))

Testing this with llvm-13, this substitution doesn't look quite right
and causes the build to fail, they might have removed braces between
versions:
https://github.com/llvm/llvm-project/blob/release/13.x/clang/lib/Driver/Too=
lChains/CommonArgs.cpp#L236

Doing a blame points to this commit, which suggest it's changed with
LLVM 10 release I believe.

https://github.com/llvm/llvm-project/commit/7dbdc8de183e7aa2dc0a9c3a4f47314=
2ddd460bf,

> +               (replace 'set-glibc-file-names
> +                 (lambda* (#:key inputs #:allow-other-keys)
> +                   (let ((libc (assoc-ref inputs "target-libc"))
> +                         (compiler-rt (assoc-ref inputs "clang-runtime"))

Quick question, compiler-rt here is the host's runtime right?  Do we not
need to cross-compile it as well?

It's not always clear to me what is part of compiler-rt vs libc vs
libgcc, it could be target-dependent.  For example when trying to target
WebAssembly, I needed a cross-compiled compiler-rt to provide the
libclang_rt.builtins-wasm32.a library.

> +                         (gcc (assoc-ref inputs "cross-gcc")))
> +                     (setenv "LIBRARY_PATH"
> +                             (string-append
> +                               (assoc-ref inputs "libc") "/lib:" (getenv=
 "LIBRARY_PATH")))
> +                     ,@(cond
> +                        ((version>=3D? version "6.0")
> +                         `(;; Link to libclang_rt files from clang-runti=
me.
> +                           (substitute* "lib/Driver/ToolChain.cpp"
> +                             (("getDriver\\(\\)\\.ResourceDir")
> +                              (string-append "\"" compiler-rt "\"")))
> +
> +                           ;; Make "LibDir" refer to <glibc>/lib so that=
 it
> +                           ;; uses the right dynamic linker file name.
> +                           (substitute* "lib/Driver/ToolChains/Linux.cpp"
> +                             (("(^[[:blank:]]+LibDir =3D ).*" _ declarat=
ion)
> +                              (string-append declaration "\"" libc "/lib=
\";\n"))
> +
> +                             ;; Make clang look for libstdc++ in the rig=
ht
> +                             ;; location.
> +                             (("LibStdCXXIncludePathCandidates\\[\\] =3D=
 \\{")
> +                              (string-append
> +                               "LibStdCXXIncludePathCandidates[] =3D { \=
"" gcc
> +                               "/include/c++\","))
> +
> +                             ;; Make sure libc's libdir is on the search=
 path, to
> +                             ;; allow crt1.o & co. to be found.
> +                             (("@GLIBC_LIBDIR@")
> +                              (string-append libc "/lib")))))
> +                        (else
> +                         `((substitute* "lib/Driver/Tools.cpp"
> +                             ;; Patch the 'getLinuxDynamicLinker' functi=
on so that
> +                             ;; it uses the right dynamic linker file na=
me.
> +                             (("/lib64/ld-linux-x86-64.so.2")
> +                              (string-append libc ,(glibc-dynamic-linker=
))))
> +
> +                           ;; Link to libclang_rt files from clang-runti=
me.
> +                           ;; This substitution needed slight adjustment=
 in 3.8.
> +                           ,@(if (version>=3D? version "3.8")
> +                                 '((substitute* "lib/Driver/Tools.cpp"
> +                                     (("TC\\.getDriver\\(\\)\\.ResourceD=
ir")
> +                                      (string-append "\"" compiler-rt "\=
""))))
> +                                 '((substitute* "lib/Driver/ToolChain.cp=
p"
> +                                     (("getDriver\\(\\)\\.ResourceDir")
> +                                      (string-append "\"" compiler-rt "\=
"")))))
> +
> +                           ;; Make sure libc's libdir is on the search p=
ath, to
> +                           ;; allow crt1.o & co. to be found.
> +                           (substitute* "lib/Driver/ToolChains.cpp"
> +                             (("@GLIBC_LIBDIR@")
> +                              (string-append libc "/lib")))))))))))))
> +        (inputs
> +         `(("target-libc" ,libc)
> +           ("cross-gcc-lib" ,xgcc "lib")
> +           ("cross-gcc" ,xgcc)
> +           ,@(package-inputs clang)))
> +        (propagated-inputs
> +          (modify-inputs (package-propagated-inputs clang)
> +            (replace "llvm"
> +              (cross-llvm
> +                (car (assoc-ref (package-propagated-inputs clang) "llvm"=
))
> +                target)))))))
> +  (cross-clang-aux target libc xgcc clang))
> +
> +(define* (clang-for-target #:optional (clang clang))
> +  (if (%current-target-system)
> +      (cross-clang (%current-target-system) #:clang clang)
> +      clang))
> +
>  (define-public llvm-for-rocm
>    (package
>      ;; Actually based on LLVM 13 as of v4.3, but llvm-12 works just fine.


--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQFMBAEBCgA2FiEEctU9gYy29KFyWDdMqPyeRH9PfVQFAmIjjfUYHHBpZXJyZS5s
YW5nbG9pc0BnbXguY29tAAoJEKj8nkR/T31UWZ8H/RkJveoN8jLYnHtYmxuNW3d5
C856RQ2StnV+QJGaspgT90iQRwsyGGxUplJBVt5I2Whwtutsq10bIH0/eD6WQQ55
ZipUbb8jLeHJqx1hy4Slc6G41ZDr3j5r213AXWj67K6t3d2mYwnkwbxypR/EeLQy
OVM6rjPBkfU+86buBsBOVFlwfBEQWvgI67oNa/68E9fzZNwAt9HgTiFgpO5KnfLA
M7tbCXhmoul21mxXIcijE3tsHGPQ4A+H2QjNT45TxXb6DEh2ZtrVJDfODItpS/kS
VpWYAauqYsb8lFsHfbtah6TJUTn0YVQLo/w6KJh/rnYHHu4pSBv/GzOKYrBIyk0=
=M4mc
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 5 Mar 2022 16:21:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 05 11:21:32 2022
Received: from localhost ([127.0.0.1]:48936 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQX9v-00085S-Gh
	for submit <at> debbugs.gnu.org; Sat, 05 Mar 2022 11:21:31 -0500
Received: from lists.gnu.org ([209.51.188.17]:41866)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pierre.langlois@HIDDEN>) id 1nQX9u-00085K-Ic
 for submit <at> debbugs.gnu.org; Sat, 05 Mar 2022 11:21:31 -0500
Received: from eggs.gnu.org ([209.51.188.92]:47980)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <pierre.langlois@HIDDEN>)
 id 1nQX9u-00012l-DX
 for guix-patches@HIDDEN; Sat, 05 Mar 2022 11:21:30 -0500
Received: from mout.gmx.net ([212.227.17.20]:45801)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <pierre.langlois@HIDDEN>)
 id 1nQX9s-00005e-5t
 for guix-patches@HIDDEN; Sat, 05 Mar 2022 11:21:30 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1646497278;
 bh=QhBprqL/9hOqHxTU3D00xGUhGf2qO4++MIeXCraJ4Ro=;
 h=X-UI-Sender-Class:References:From:To:Cc:Subject:Date:In-reply-to;
 b=hHpi7ZXCzdRzJJhB0L1UkzLYIUWdhtlWPfXPXoJL0hIocx753FCYl+7NXWQjsj1V8
 Ez/43wlK+mfCKgbsFhLe/0YlVyzfxTpj5kCOfDf5YQKRBoK4aE3hTvCX9xS0I66BBx
 GYiIwQmshbLn36oRlXTlyvSK17fjlue45iUwlJGw=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from labiere ([82.69.64.142]) by mail.gmx.net (mrgmx104
 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MTAFb-1nbtnF1Mjv-00UdE6; Sat, 05
 Mar 2022 17:21:18 +0100
References: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
 <de91f63243153229e558311bb91f688ca8e177fb.1646387919.git.julien@HIDDEN>
User-agent: mu4e 1.6.10; emacs 27.2
From: Pierre Langlois <pierre.langlois@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>
Subject: Re: [bug#54239] [PATCH v2 2/5] gnu: Add cross-clang.
Date: Sat, 05 Mar 2022 16:05:43 +0000
In-reply-to: <de91f63243153229e558311bb91f688ca8e177fb.1646387919.git.julien@HIDDEN>
Message-ID: <87wnh8gykq.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Provags-ID: V03:K1:83EpukF15SqGaAp7230/ZegFEOF0/furozBJNQbgpEiarBPvQhL
 wpijfAN6wVjbfn6wVR2j+lluuvsXzIvM9lmVEFSt4uN3XeHTktPiGlC5SVeuU97L4L0eXvu
 O0gDA8tDmvnPhs5uu+KnsIJH+Bx1MrFPBi9xwjIZpiKxehvNTbq8l4X0Y3XlbERkW6T/+ny
 OaItJDHM4NXx2OOtqn39w==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:LN6IrCs+k/8=:pvwNU7sQthlrN6x/j8i89v
 sHymauDVupqAVDzeYytrwEeQLy87HJQuDr+tQf0EP2S5rM2PpFOANxA+47Lu9Y/AaaqR8BRsn
 8ZKSfQy8L/5gTu60+Myn//vPTf7jmws/MzyuXTOsZDmz5SjYk+V/NnnxzznHfiKUtMZMvm6h1
 ZB7a7fiOnfoT5f579kTtghV2Os8qQpEBi+goKRZd7rBLmSC28Nu1VMR4VToe+RPXXPHoTBTIZ
 wkYLv630PzXRzjIJjNkS07YPQwyPTfUHWSKsH4hp7GBXa6IPw02zsikgHmWA2JM2rGKAtNWp9
 QU1Zreo0IaaFc3dGYCNVz2sib1zzkDwsd+TA/5uSUdY7wQTWP0jDvaEqiDRB4x4tJM68ummp0
 MEgiaNllqwK8ljIRWpNawJbMyh/mUAK+dJxn5IEnKuwA5XdLCFjs1YX4DDy65JWbb2QlzEhyw
 m1veJChir+AjB/UsCGxlEgxPXfxe8TguXKEaln2SH07q6P3d0Y0QY7kOlI53XocZnNfic4K/t
 lB8t+B5Z99JC+muBMIq2v9/xEfS+YrPIX6UFHiDWONgiS9Ly1N3SFMZkMuKg8Kjortd5hkmJy
 i4CkvG3dQsO6H96vVMbQ5TEB2VKqTGGSniQmzBrSiqYQgtZXftEfM81fhuNeio/mi3CPfsrrJ
 2x3haLOhM2zHjsvZxZ3dgT3SY1MPFdOmh0xRu/K9UJpuSJXq/RSMC6Unjr+OhGIp+MyzpCY3J
 NpPlK7E81azb+zCn+A1lSsKyLUAyz+wG4fRQ9dGsJeOlBAzlTnRfEyUJT5aAJimrPPjbzEGOX
 +HfjKvavHGUAb7iSKZ2dxIWI0dWs9PgbzfuKLJr48t0BiOvrEA4piAh4c+GT1zk85a7ydo24X
 kAF8tWJG1CXpFS0R7iINSKV4JKc9ayr4CgzMzg2DOy5ExQ3A+WIvjDdYMf1zpv+My//zrAg5I
 5MWWwf5MfPUtCn/4+ZX8ccAT8Lc3c6vaK+8T0yb0YiPd6krMzaRIuQ9ckFtZTNmet1Vu98iFZ
 I2PQKxY9XKZUOdPgXI4zL+Ap0vOvrHO0B48xT4NwtUr2nFrRA0WEjMW5q3ZZylITCP9ITKnzj
 ijqCmvRZp8nKuA=
Received-SPF: pass client-ip=212.227.17.20;
 envelope-from=pierre.langlois@HIDDEN; helo=mout.gmx.net
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7,
 RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
Cc: 54239 <at> debbugs.gnu.org, guix-patches@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Hi,

A couple of comments from me while testing this trying to build a
cross-toolchain with llvm-13.  Hope this is helpful!

Julien Lepiller <julien@HIDDEN> writes:

> * gnu/packages/llvm.scm (cross-clang): New variable.
> ---
>  gnu/packages/llvm.scm | 144 +++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 143 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
> index d6e9846699..c277e2ac35 100644
> --- a/gnu/packages/llvm.scm
> +++ b/gnu/packages/llvm.scm
> @@ -54,6 +54,7 @@ (define-module (gnu packages llvm)
>    #:use-module (guix build-system trivial)
>    #:use-module (gnu packages)
>    #:use-module (gnu packages base)
> +  #:use-module (gnu packages cross-base)
>    #:use-module (gnu packages gcc)
>    #:use-module (gnu packages bootstrap)           ;glibc-dynamic-linker
>    #:use-module (gnu packages check)               ;python-lit
> @@ -75,7 +76,9 @@ (define-module (gnu packages llvm)
>    #:use-module (ice-9 match)
>    #:export (make-lld-wrapper
>              system->llvm-target
> -            cross-llvm))
> +            cross-llvm
> +            cross-clang
> +            clang-for-target))
>=20=20
>  (define* (system->llvm-target #:optional
>                                (system (or (and=3D> (%current-target-syst=
em)
> @@ -1023,6 +1026,145 @@ (define-public clang-runtime clang-runtime-13)
>  (define-public clang clang-13)
>  (define-public clang-toolchain clang-toolchain-13)
>=20=20
> +(define* (cross-clang target
> +                      #:key
> +                      (libc (cross-libc target))
> +                      (xgcc (cross-gcc target
> +                              #:xbinutils (cross-binutils target)
> +                              #:libc (cross-libc target)))
> +                      (clang clang))
> +  "Return a cross-clang compiler for target."
> +  (define cross-clang-aux
> +    (mlambda (target libc xgcc clang)
> +      (package
> +        (inherit clang)
> +        (name (string-append "clang-cross-" target))
> +        (version (package-version clang))
> +        ;; Support the same variables as clang, even in cross-compilatio=
n context.
> +        ;; Clang does not make a difference between native and cross-com=
pilation.
> +        (search-paths
> +          (list
> +            (search-path-specification
> +              (variable "CROSS_LIBRARY_PATH")
> +              (files '("lib")))
> +            (search-path-specification
> +              (variable "CROSS_C_INCLUDE_PATH")
> +              (files '("include")))
> +            (search-path-specification
> +              (variable "CROSS_CPLUS_INCLUDE_PATH")
> +              (files '("include/c++" "include")))))
> +        (native-search-paths '())
> +        (arguments
> +         (substitute-keyword-arguments (package-arguments clang)
> +           ((#:configure-flags _)
> +            `(list "-DCLANG_INCLUDE_TESTS=3DTrue"
> +                   (string-append "-DGCC_INSTALL_PREFIX=3D"
> +                                  (assoc-ref %build-inputs "cross-gcc-li=
b"))
> +                   (string-append "-DC_INCLUDE_DIRS=3D"
> +                                  (assoc-ref %build-inputs "target-libc")
> +                                  "/include")))
> +           ((#:phases phases)
> +            `(modify-phases ,phases
> +               (add-after 'unpack 'add-missing-libdir
> +                 (lambda _
> +                   ;; cross-gcc installs its libraries in <target>/lib i=
nstead of
> +                   ;; lib.
> +                   (substitute* "lib/Driver/ToolChain.cpp"
> +                     (("\"-L\"\\) \\+ LibPath\\)\\);")
> +                      ,(string-append "\"-L\") + LibPath));
> +  CmdArgs.push_back(Args.MakeArgString(StringRef(\"-L\") + "
> +                                     "StringRef(GCC_INSTALL_PREFIX) + St=
ringRef(\"/"
> +                                     target "/lib\")));
> +  CmdArgs.push_back(Args.MakeArgString(StringRef(\"-rpath=3D\") + "
> +                                     "StringRef(GCC_INSTALL_PREFIX) + St=
ringRef(\"/"
> +                                     target "/lib\")));")))))
> +               (add-after 'unpack 'support-cross-include-path
> +                 (lambda _
> +                   (substitute* "lib/Driver/ToolChains/Clang.cpp"
> +                     (("C_INCLUDE_PATH") "CROSS_C_INCLUDE_PATH")
> +                     (("CPLUS_INCLUDE_PATH") "CROSS_CPLUS_INCLUDE_PATH")=
)))
> +               (add-after 'unpack 'support-cross-library-path
> +                 (lambda _
> +                   ;; LIBRARY_PATH is only supported for native builds, =
but we still
> +                   ;; need it (or CROSS_LIBRARY_PATH to be precise) when
> +                   ;; cross-compiling
> +                   (substitute* "lib/Driver/ToolChains/CommonArgs.cpp"
> +                     (("LIBRARY_PATH\"")
> +                      "LIBRARY_PATH\");
> +  } else {
> +    addDirectoryList(Args, CmdArgs, \"-L\", \"CROSS_LIBRARY_PATH\""))))

Testing this with llvm-13, this substitution doesn't look quite right
and causes the build to fail, they might have removed braces between
versions:
https://github.com/llvm/llvm-project/blob/release/13.x/clang/lib/Driver/Too=
lChains/CommonArgs.cpp#L236

Doing a blame points to this commit, which suggest it's changed with
LLVM 10 release I believe.

https://github.com/llvm/llvm-project/commit/7dbdc8de183e7aa2dc0a9c3a4f47314=
2ddd460bf,

> +               (replace 'set-glibc-file-names
> +                 (lambda* (#:key inputs #:allow-other-keys)
> +                   (let ((libc (assoc-ref inputs "target-libc"))
> +                         (compiler-rt (assoc-ref inputs "clang-runtime"))

Quick question, compiler-rt here is the host's runtime right?  Do we not
need to cross-compile it as well?

It's not always clear to me what is part of compiler-rt vs libc vs
libgcc, it could be target-dependent.  For example when trying to target
WebAssembly, I needed a cross-compiled compiler-rt to provide the
libclang_rt.builtins-wasm32.a library.

> +                         (gcc (assoc-ref inputs "cross-gcc")))
> +                     (setenv "LIBRARY_PATH"
> +                             (string-append
> +                               (assoc-ref inputs "libc") "/lib:" (getenv=
 "LIBRARY_PATH")))
> +                     ,@(cond
> +                        ((version>=3D? version "6.0")
> +                         `(;; Link to libclang_rt files from clang-runti=
me.
> +                           (substitute* "lib/Driver/ToolChain.cpp"
> +                             (("getDriver\\(\\)\\.ResourceDir")
> +                              (string-append "\"" compiler-rt "\"")))
> +
> +                           ;; Make "LibDir" refer to <glibc>/lib so that=
 it
> +                           ;; uses the right dynamic linker file name.
> +                           (substitute* "lib/Driver/ToolChains/Linux.cpp"
> +                             (("(^[[:blank:]]+LibDir =3D ).*" _ declarat=
ion)
> +                              (string-append declaration "\"" libc "/lib=
\";\n"))
> +
> +                             ;; Make clang look for libstdc++ in the rig=
ht
> +                             ;; location.
> +                             (("LibStdCXXIncludePathCandidates\\[\\] =3D=
 \\{")
> +                              (string-append
> +                               "LibStdCXXIncludePathCandidates[] =3D { \=
"" gcc
> +                               "/include/c++\","))
> +
> +                             ;; Make sure libc's libdir is on the search=
 path, to
> +                             ;; allow crt1.o & co. to be found.
> +                             (("@GLIBC_LIBDIR@")
> +                              (string-append libc "/lib")))))
> +                        (else
> +                         `((substitute* "lib/Driver/Tools.cpp"
> +                             ;; Patch the 'getLinuxDynamicLinker' functi=
on so that
> +                             ;; it uses the right dynamic linker file na=
me.
> +                             (("/lib64/ld-linux-x86-64.so.2")
> +                              (string-append libc ,(glibc-dynamic-linker=
))))
> +
> +                           ;; Link to libclang_rt files from clang-runti=
me.
> +                           ;; This substitution needed slight adjustment=
 in 3.8.
> +                           ,@(if (version>=3D? version "3.8")
> +                                 '((substitute* "lib/Driver/Tools.cpp"
> +                                     (("TC\\.getDriver\\(\\)\\.ResourceD=
ir")
> +                                      (string-append "\"" compiler-rt "\=
""))))
> +                                 '((substitute* "lib/Driver/ToolChain.cp=
p"
> +                                     (("getDriver\\(\\)\\.ResourceDir")
> +                                      (string-append "\"" compiler-rt "\=
"")))))
> +
> +                           ;; Make sure libc's libdir is on the search p=
ath, to
> +                           ;; allow crt1.o & co. to be found.
> +                           (substitute* "lib/Driver/ToolChains.cpp"
> +                             (("@GLIBC_LIBDIR@")
> +                              (string-append libc "/lib")))))))))))))
> +        (inputs
> +         `(("target-libc" ,libc)
> +           ("cross-gcc-lib" ,xgcc "lib")
> +           ("cross-gcc" ,xgcc)
> +           ,@(package-inputs clang)))
> +        (propagated-inputs
> +          (modify-inputs (package-propagated-inputs clang)
> +            (replace "llvm"
> +              (cross-llvm
> +                (car (assoc-ref (package-propagated-inputs clang) "llvm"=
))
> +                target)))))))
> +  (cross-clang-aux target libc xgcc clang))
> +
> +(define* (clang-for-target #:optional (clang clang))
> +  (if (%current-target-system)
> +      (cross-clang (%current-target-system) #:clang clang)
> +      clang))
> +
>  (define-public llvm-for-rocm
>    (package
>      ;; Actually based on LLVM 13 as of v4.3, but llvm-12 works just fine.


--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQFMBAEBCgA2FiEEctU9gYy29KFyWDdMqPyeRH9PfVQFAmIjjfUYHHBpZXJyZS5s
YW5nbG9pc0BnbXguY29tAAoJEKj8nkR/T31UWZ8H/RkJveoN8jLYnHtYmxuNW3d5
C856RQ2StnV+QJGaspgT90iQRwsyGGxUplJBVt5I2Whwtutsq10bIH0/eD6WQQ55
ZipUbb8jLeHJqx1hy4Slc6G41ZDr3j5r213AXWj67K6t3d2mYwnkwbxypR/EeLQy
OVM6rjPBkfU+86buBsBOVFlwfBEQWvgI67oNa/68E9fzZNwAt9HgTiFgpO5KnfLA
M7tbCXhmoul21mxXIcijE3tsHGPQ4A+H2QjNT45TxXb6DEh2ZtrVJDfODItpS/kS
VpWYAauqYsb8lFsHfbtah6TJUTn0YVQLo/w6KJh/rnYHHu4pSBv/GzOKYrBIyk0=
=M4mc
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 5 Mar 2022 14:41:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 05 09:41:03 2022
Received: from localhost ([127.0.0.1]:47514 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQVae-0005Db-8h
	for submit <at> debbugs.gnu.org; Sat, 05 Mar 2022 09:41:03 -0500
Received: from lists.gnu.org ([209.51.188.17]:47466)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pierre.langlois@HIDDEN>) id 1nQVac-0005DO-Ox
 for submit <at> debbugs.gnu.org; Sat, 05 Mar 2022 09:40:59 -0500
Received: from eggs.gnu.org ([209.51.188.92]:60554)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <pierre.langlois@HIDDEN>)
 id 1nQVac-0004rn-ID
 for guix-patches@HIDDEN; Sat, 05 Mar 2022 09:40:58 -0500
Received: from mout.gmx.net ([212.227.17.21]:46817)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <pierre.langlois@HIDDEN>)
 id 1nQVaa-0007DO-JJ
 for guix-patches@HIDDEN; Sat, 05 Mar 2022 09:40:58 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1646491245;
 bh=VmP/JBM+/jGg5P4hZo2pw5KH6RW3QDO5KxkaouPr960=;
 h=X-UI-Sender-Class:References:From:To:Cc:Subject:Date:In-reply-to;
 b=iGkWGm3Yry/oIhGdNwRMkVl81xHJwGVvcijyTFM5wSuzEuII+SiS902XGRhkUBpdp
 I3J3jd8eWIe6Io7sPKdskJLNUI4NB5AlJ0y//q5yzQPC++1RaOY7vvfMaKhEZboRFk
 9b2p6m3SVik7GdxoPVUpPh8KoDY2pCnZgkkDI5zE=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from labiere ([82.69.64.142]) by mail.gmx.net (mrgmx104
 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MnJhU-1ns6cz01Ey-00jHd7; Sat, 05
 Mar 2022 15:40:45 +0100
References: <20220303170252.3caec0a6@HIDDEN>
 <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
User-agent: mu4e 1.6.10; emacs 27.2
From: Pierre Langlois <pierre.langlois@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>
Subject: Re: [bug#54239] [PATCH v2 1/5] gnu: Add cross-llvm.
Date: Sat, 05 Mar 2022 14:00:32 +0000
In-reply-to: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
Message-ID: <87zgm4ihsp.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Provags-ID: V03:K1:DX8VOw0tY3VDGTgdEuW0thJjp33yKxjaRyQg8Uj+hSi73wtjKq9
 Wy6FGaNORACpPICwhdL6xeWkZcxL+9lWsKiME94PRBAdyt7mZJHUuiWwNIhLcYdzArCmPFP
 IEzlC9ts9SbCuxDsBHC6lFXyCNNujCkpqQgEJ146Zo2U2P3+eImn1ndrHEIXoSM6ZcS41m4
 qxaVuP6ShvjQcXR+th3NA==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:Lq/HQuYhqTw=:D5usQUaCyejWn+fg6eAxkO
 BrOniLlp6NAVv+yhb9R8iGwU6yt4P3YQJg7dlaseLUZefvvXagt0yfeyTaOD61i/LFN2HpB4e
 8nSUEC9+Pqy2TfftRFrJNLzpFS21zCmvTK2zqWTP6CXvYOYtN6txsRl0EAVyWVISh+8p1koyf
 3nf2gjq4KIkc075unDzlgsZrszBdYaZX+kDmHzrT+2YizbkgABoL0A7mp8mqSluTWIEfWzXq5
 miZd5kQuRUuQ2QeOlOvBaO045iOADje/ITVmp+QDG5A+865iKyHNGHHHr6gPd+i4VCXlFJ1Pp
 KxgHigK+Qm7zKwHwJv64SIo23ZmsySRszdjr/WkQfkvzQ1f9Enh9W6wKZXR9z+xT1PX0WXUZ1
 WnjxmMNP28bRta6kIFyIF4M5jfxJO9+f89wzhk925d5y8B+9arkf4QOizXIQyL1DFnNvUhI35
 23vRyLks6phq8MksTZ3/Oay7ie/tjuWNBCLqDCIMSmHNVVQECkI5xbtiNKeb1G+RPi8b/a3k8
 3FuGnQEY3G3oXrQAVYZXefXYoUmCg0V6E92+/6ClE9CU/P5BUrbxcszNKjGhCb0OyY+dtYa0a
 DQbzLWMD6OZ5RejhLDQJyklXeSNIvyL4At4avCw0wgcHgCgQbYWPut3ARpH2wagyfCBc2Ip+z
 8TsAd2UyFNnXaG+TJot2CdpzKj9h4ArfYORRZF3PlwcJlYXXZ5JRIJxM/FZwBkfKtlWaxkXZg
 YNVxJbYGuB51VJBG8/HrSBa2DC1VYSj+9+cBf2x6D5og0CFUnZJkyoTQrWgy6RGL1wblKbjBX
 FJO+lJ/auzAy/X64fdcwRlvBQU8JiOrY66/MqQ9B5O2ymBmqpLoiqdAd+li8DfDjLc5+tqSev
 VyDgWpq2uL36uIpbuUvRdfF7SK6SGRih9pNtzr9lzEc8ezrpyDScjcb+XiNvxKjsn6jyaE0fq
 0bF5CsU/Jt2HXeE+yweXz8FVt2I4nh5ZR23aEkiH6ZCb2CucF8V6gCVMK6iY3iAjtHv9vSv3a
 5588nqVrpxUwiMQQy0H3NFgQMgKgmVWYDkgVgaSxF7AMmsWTKcVue4zi82zeWYjbb8oQMJlPi
 n/O/Kr8w5bVhco=
Received-SPF: pass client-ip=212.227.17.21;
 envelope-from=pierre.langlois@HIDDEN; helo=mout.gmx.net
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7,
 RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
Cc: 54239 <at> debbugs.gnu.org, guix-patches@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


Julien Lepiller <julien@HIDDEN> writes:

> * gnu/packages/llvm.scm (cross-llvm): New variable.
> ---
>  gnu/packages/llvm.scm | 21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
> index eb949bed1b..d6e9846699 100644
> --- a/gnu/packages/llvm.scm
> +++ b/gnu/packages/llvm.scm
> @@ -18,7 +18,7 @@
>  ;;; Copyright =C2=A9 2020 Jakub K=C4=85dzio=C5=82ka <kuba@HIDDEN>
>  ;;; Copyright =C2=A9 2021 Maxime Devos <maximedevos@HIDDEN>
>  ;;; Copyright =C2=A9 2020, 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN=
om>
> -;;; Copyright =C2=A9 2021 Julien Lepiller <julien@HIDDEN>
> +;;; Copyright =C2=A9 2021, 2022 Julien Lepiller <julien@HIDDEN>
>  ;;; Copyright =C2=A9 2021 Lars-Dominik Braun <lars@HIDDEN>
>  ;;; Copyright =C2=A9 2021 Guillaume Le Vaillant <glv@HIDDEN>
>  ;;; Copyright =C2=A9 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
> @@ -74,7 +74,8 @@ (define-module (gnu packages llvm)
>    #:use-module (srfi srfi-1)
>    #:use-module (ice-9 match)
>    #:export (make-lld-wrapper
> -            system->llvm-target))
> +            system->llvm-target
> +            cross-llvm))
>=20=20
>  (define* (system->llvm-target #:optional
>                                (system (or (and=3D> (%current-target-syst=
em)
> @@ -99,6 +100,22 @@ (define* (system->llvm-target #:optional
>               ("i686"        =3D> "X86")
>               ("i586"        =3D> "X86"))))
>=20=20
> +(define (cross-llvm llvm target)
> +  "Return a native LLVM package that targets a different system.  The re=
sulting
> +libraries are running on the host but target a different system by defau=
lt.
> +This packge can be used to control clang's default target."
> +  (package
> +    (inherit llvm)
> +    (arguments
> +     (substitute-keyword-arguments (package-arguments llvm)
> +      ((#:configure-flags flags)
> +       #~(append
> +           (list
> +             (string-append "-DLLVM_DEFAULT_TARGET_TRIPLE=3D" #$target)
> +             (string-append "-DLLVM_TARGET_ARCH=3D"
> +                            #$(system->llvm-target (gnu-triplet->nix-sys=
tem target))))


While playing with trying to use this series to build a WebAssembly
cross-compiler, I /think/ we have a bug here, and also in master, when
it comes to setting LLVM_TARGET_ARCH.

It's a bit confusing though, the documentation is as follows:

=2D-8<---------------cut here---------------start------------->8---
LLVM_TARGET_ARCH:STRING
    LLVM target to use for native code generation. This is required for
    JIT generation. It defaults to =E2=80=9Chost=E2=80=9D, meaning that it =
shall pick
    the architecture of the machine where LLVM is being built. If you
    are cross-compiling, set it to the target architecture name.
=2D-8<---------------cut here---------------end--------------->8---

It's not clear what naming scheme the variable needs, is it the internal
LLVM target name or the triplet? I think it's architecture part of the
triplet...ish? But instead we pass it the internal target name.

It still works at the moment because whenever LLVM_TARGET_ARCH is used,
the cmake code looks quite permissive and tries to do the right thing by
turning the string lowercase and matching common names (hence the "...ish" =
:-) ).

https://github.com/llvm/llvm-project/blob/24f88f57de588817bd21e799e2ac1069c=
025674c/llvm/cmake/config-ix.cmake#L420

So if I try and add WebAssembly into the mix, the architecure name is
wasm32, but the LLVM target is called WebAssembly, and the lowercase
version of it doesn't work :-(=20

| nix-system | LLVM target | LLVM target lowercase | Does it match? |
|------------+-------------+-----------------------+----------------|
| aarch64    | AArch64     | aarch64               | Y              |
| armhf      | ARM         | arm                   | Y              |
| mips64el   | Mips        | mips                  | Y              |
| powerpc    | PowerPC     | powerpc               | Y              |
| riscv      | RISCV       | riscv                 | Y              |
| x86_64     | X86         | x86                   | Y              |
| i686       | X86         | x86                   | Y              |
| i586       | X86         | x86                   | Y              |
|------------+-------------+-----------------------+----------------|
| wasm32     | WebAssembly | webassembly           | N :-(          |


I /think/ we might want to use the nix-system instead of the LLVM target
for LLVM_TARGET_ARCH:

=2D-8<---------------cut here---------------start------------->8---
(string-append "-DLLVM_TARGET_ARCH=3D" #$(gnu-triplet->nix-system target)))
=2D-8<---------------cut here---------------end--------------->8---

But I'm not sure, it might not work for mips64el for example, so we
could need yet-another-mapping.

Given it works as it is today with the current set of supported targets,
we don't necessarily need to fix it now. I'll be happy to take a look
later when eventually adding support for the wasm32-wasi toolchain in
Guix.

Thanks,
Pierre

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQFMBAEBCgA2FiEEctU9gYy29KFyWDdMqPyeRH9PfVQFAmIjdmYYHHBpZXJyZS5s
YW5nbG9pc0BnbXguY29tAAoJEKj8nkR/T31UCOwH/jFKIRa8Xi5gwAvaxu5HhC7c
XXWlEvz2rhfikOzU7TvNHTGXNBKu6Zhy0a+k3uN9hyYIYSdSi2cr2ZSjUDNYtefc
QekS48AyA17prUiK1kw9Hx+0ulV2uI2e6USl7aYPZ7NvZ4Necx6S1sGQze1oEdyj
m2uJagH6EQbELDq9fqzmdP2lLWhtTMFHnVJdA8/gN8pIycwehELSOQJ4pVhuNStq
cu97BefLhFUuNERTF0n2TxAgd1qwqBI2GwaT7dHBZNUhpVsoMQs6nQge2DakSx8V
jinX424tCaHONpL0RBwZsvyhfh3FF42U+i7FUph+rKZrXVUhn37Qu7lhrvDJTh8=
=/iOv
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 5 Mar 2022 14:40:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 05 09:40:59 2022
Received: from localhost ([127.0.0.1]:47511 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQVaZ-0005DJ-BF
	for submit <at> debbugs.gnu.org; Sat, 05 Mar 2022 09:40:59 -0500
Received: from mout.gmx.net ([212.227.17.21]:41823)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pierre.langlois@HIDDEN>) id 1nQVaW-0005D6-Rb
 for 54239 <at> debbugs.gnu.org; Sat, 05 Mar 2022 09:40:53 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1646491245;
 bh=VmP/JBM+/jGg5P4hZo2pw5KH6RW3QDO5KxkaouPr960=;
 h=X-UI-Sender-Class:References:From:To:Cc:Subject:Date:In-reply-to;
 b=iGkWGm3Yry/oIhGdNwRMkVl81xHJwGVvcijyTFM5wSuzEuII+SiS902XGRhkUBpdp
 I3J3jd8eWIe6Io7sPKdskJLNUI4NB5AlJ0y//q5yzQPC++1RaOY7vvfMaKhEZboRFk
 9b2p6m3SVik7GdxoPVUpPh8KoDY2pCnZgkkDI5zE=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from labiere ([82.69.64.142]) by mail.gmx.net (mrgmx104
 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MnJhU-1ns6cz01Ey-00jHd7; Sat, 05
 Mar 2022 15:40:45 +0100
References: <20220303170252.3caec0a6@HIDDEN>
 <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
User-agent: mu4e 1.6.10; emacs 27.2
From: Pierre Langlois <pierre.langlois@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>
Subject: Re: [bug#54239] [PATCH v2 1/5] gnu: Add cross-llvm.
Date: Sat, 05 Mar 2022 14:00:32 +0000
In-reply-to: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
Message-ID: <87zgm4ihsp.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Provags-ID: V03:K1:DX8VOw0tY3VDGTgdEuW0thJjp33yKxjaRyQg8Uj+hSi73wtjKq9
 Wy6FGaNORACpPICwhdL6xeWkZcxL+9lWsKiME94PRBAdyt7mZJHUuiWwNIhLcYdzArCmPFP
 IEzlC9ts9SbCuxDsBHC6lFXyCNNujCkpqQgEJ146Zo2U2P3+eImn1ndrHEIXoSM6ZcS41m4
 qxaVuP6ShvjQcXR+th3NA==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:Lq/HQuYhqTw=:D5usQUaCyejWn+fg6eAxkO
 BrOniLlp6NAVv+yhb9R8iGwU6yt4P3YQJg7dlaseLUZefvvXagt0yfeyTaOD61i/LFN2HpB4e
 8nSUEC9+Pqy2TfftRFrJNLzpFS21zCmvTK2zqWTP6CXvYOYtN6txsRl0EAVyWVISh+8p1koyf
 3nf2gjq4KIkc075unDzlgsZrszBdYaZX+kDmHzrT+2YizbkgABoL0A7mp8mqSluTWIEfWzXq5
 miZd5kQuRUuQ2QeOlOvBaO045iOADje/ITVmp+QDG5A+865iKyHNGHHHr6gPd+i4VCXlFJ1Pp
 KxgHigK+Qm7zKwHwJv64SIo23ZmsySRszdjr/WkQfkvzQ1f9Enh9W6wKZXR9z+xT1PX0WXUZ1
 WnjxmMNP28bRta6kIFyIF4M5jfxJO9+f89wzhk925d5y8B+9arkf4QOizXIQyL1DFnNvUhI35
 23vRyLks6phq8MksTZ3/Oay7ie/tjuWNBCLqDCIMSmHNVVQECkI5xbtiNKeb1G+RPi8b/a3k8
 3FuGnQEY3G3oXrQAVYZXefXYoUmCg0V6E92+/6ClE9CU/P5BUrbxcszNKjGhCb0OyY+dtYa0a
 DQbzLWMD6OZ5RejhLDQJyklXeSNIvyL4At4avCw0wgcHgCgQbYWPut3ARpH2wagyfCBc2Ip+z
 8TsAd2UyFNnXaG+TJot2CdpzKj9h4ArfYORRZF3PlwcJlYXXZ5JRIJxM/FZwBkfKtlWaxkXZg
 YNVxJbYGuB51VJBG8/HrSBa2DC1VYSj+9+cBf2x6D5og0CFUnZJkyoTQrWgy6RGL1wblKbjBX
 FJO+lJ/auzAy/X64fdcwRlvBQU8JiOrY66/MqQ9B5O2ymBmqpLoiqdAd+li8DfDjLc5+tqSev
 VyDgWpq2uL36uIpbuUvRdfF7SK6SGRih9pNtzr9lzEc8ezrpyDScjcb+XiNvxKjsn6jyaE0fq
 0bF5CsU/Jt2HXeE+yweXz8FVt2I4nh5ZR23aEkiH6ZCb2CucF8V6gCVMK6iY3iAjtHv9vSv3a
 5588nqVrpxUwiMQQy0H3NFgQMgKgmVWYDkgVgaSxF7AMmsWTKcVue4zi82zeWYjbb8oQMJlPi
 n/O/Kr8w5bVhco=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 54239
Cc: 54239 <at> debbugs.gnu.org, guix-patches@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


Julien Lepiller <julien@HIDDEN> writes:

> * gnu/packages/llvm.scm (cross-llvm): New variable.
> ---
>  gnu/packages/llvm.scm | 21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
> index eb949bed1b..d6e9846699 100644
> --- a/gnu/packages/llvm.scm
> +++ b/gnu/packages/llvm.scm
> @@ -18,7 +18,7 @@
>  ;;; Copyright =C2=A9 2020 Jakub K=C4=85dzio=C5=82ka <kuba@HIDDEN>
>  ;;; Copyright =C2=A9 2021 Maxime Devos <maximedevos@HIDDEN>
>  ;;; Copyright =C2=A9 2020, 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN=
om>
> -;;; Copyright =C2=A9 2021 Julien Lepiller <julien@HIDDEN>
> +;;; Copyright =C2=A9 2021, 2022 Julien Lepiller <julien@HIDDEN>
>  ;;; Copyright =C2=A9 2021 Lars-Dominik Braun <lars@HIDDEN>
>  ;;; Copyright =C2=A9 2021 Guillaume Le Vaillant <glv@HIDDEN>
>  ;;; Copyright =C2=A9 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
> @@ -74,7 +74,8 @@ (define-module (gnu packages llvm)
>    #:use-module (srfi srfi-1)
>    #:use-module (ice-9 match)
>    #:export (make-lld-wrapper
> -            system->llvm-target))
> +            system->llvm-target
> +            cross-llvm))
>=20=20
>  (define* (system->llvm-target #:optional
>                                (system (or (and=3D> (%current-target-syst=
em)
> @@ -99,6 +100,22 @@ (define* (system->llvm-target #:optional
>               ("i686"        =3D> "X86")
>               ("i586"        =3D> "X86"))))
>=20=20
> +(define (cross-llvm llvm target)
> +  "Return a native LLVM package that targets a different system.  The re=
sulting
> +libraries are running on the host but target a different system by defau=
lt.
> +This packge can be used to control clang's default target."
> +  (package
> +    (inherit llvm)
> +    (arguments
> +     (substitute-keyword-arguments (package-arguments llvm)
> +      ((#:configure-flags flags)
> +       #~(append
> +           (list
> +             (string-append "-DLLVM_DEFAULT_TARGET_TRIPLE=3D" #$target)
> +             (string-append "-DLLVM_TARGET_ARCH=3D"
> +                            #$(system->llvm-target (gnu-triplet->nix-sys=
tem target))))


While playing with trying to use this series to build a WebAssembly
cross-compiler, I /think/ we have a bug here, and also in master, when
it comes to setting LLVM_TARGET_ARCH.

It's a bit confusing though, the documentation is as follows:

=2D-8<---------------cut here---------------start------------->8---
LLVM_TARGET_ARCH:STRING
    LLVM target to use for native code generation. This is required for
    JIT generation. It defaults to =E2=80=9Chost=E2=80=9D, meaning that it =
shall pick
    the architecture of the machine where LLVM is being built. If you
    are cross-compiling, set it to the target architecture name.
=2D-8<---------------cut here---------------end--------------->8---

It's not clear what naming scheme the variable needs, is it the internal
LLVM target name or the triplet? I think it's architecture part of the
triplet...ish? But instead we pass it the internal target name.

It still works at the moment because whenever LLVM_TARGET_ARCH is used,
the cmake code looks quite permissive and tries to do the right thing by
turning the string lowercase and matching common names (hence the "...ish" =
:-) ).

https://github.com/llvm/llvm-project/blob/24f88f57de588817bd21e799e2ac1069c=
025674c/llvm/cmake/config-ix.cmake#L420

So if I try and add WebAssembly into the mix, the architecure name is
wasm32, but the LLVM target is called WebAssembly, and the lowercase
version of it doesn't work :-(=20

| nix-system | LLVM target | LLVM target lowercase | Does it match? |
|------------+-------------+-----------------------+----------------|
| aarch64    | AArch64     | aarch64               | Y              |
| armhf      | ARM         | arm                   | Y              |
| mips64el   | Mips        | mips                  | Y              |
| powerpc    | PowerPC     | powerpc               | Y              |
| riscv      | RISCV       | riscv                 | Y              |
| x86_64     | X86         | x86                   | Y              |
| i686       | X86         | x86                   | Y              |
| i586       | X86         | x86                   | Y              |
|------------+-------------+-----------------------+----------------|
| wasm32     | WebAssembly | webassembly           | N :-(          |


I /think/ we might want to use the nix-system instead of the LLVM target
for LLVM_TARGET_ARCH:

=2D-8<---------------cut here---------------start------------->8---
(string-append "-DLLVM_TARGET_ARCH=3D" #$(gnu-triplet->nix-system target)))
=2D-8<---------------cut here---------------end--------------->8---

But I'm not sure, it might not work for mips64el for example, so we
could need yet-another-mapping.

Given it works as it is today with the current set of supported targets,
we don't necessarily need to fix it now. I'll be happy to take a look
later when eventually adding support for the wasm32-wasi toolchain in
Guix.

Thanks,
Pierre

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQFMBAEBCgA2FiEEctU9gYy29KFyWDdMqPyeRH9PfVQFAmIjdmYYHHBpZXJyZS5s
YW5nbG9pc0BnbXguY29tAAoJEKj8nkR/T31UCOwH/jFKIRa8Xi5gwAvaxu5HhC7c
XXWlEvz2rhfikOzU7TvNHTGXNBKu6Zhy0a+k3uN9hyYIYSdSi2cr2ZSjUDNYtefc
QekS48AyA17prUiK1kw9Hx+0ulV2uI2e6USl7aYPZ7NvZ4Necx6S1sGQze1oEdyj
m2uJagH6EQbELDq9fqzmdP2lLWhtTMFHnVJdA8/gN8pIycwehELSOQJ4pVhuNStq
cu97BefLhFUuNERTF0n2TxAgd1qwqBI2GwaT7dHBZNUhpVsoMQs6nQge2DakSx8V
jinX424tCaHONpL0RBwZsvyhfh3FF42U+i7FUph+rKZrXVUhn37Qu7lhrvDJTh8=
=/iOv
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 5 Mar 2022 13:10:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 05 08:10:55 2022
Received: from localhost ([127.0.0.1]:47481 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQUBT-00036z-7k
	for submit <at> debbugs.gnu.org; Sat, 05 Mar 2022 08:10:55 -0500
Received: from mout.gmx.net ([212.227.17.21]:40029)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pierre.langlois@HIDDEN>) id 1nQUBR-00036m-9t
 for 54239 <at> debbugs.gnu.org; Sat, 05 Mar 2022 08:10:54 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1646485845;
 bh=CuA2q6em7bJ53i7SNigugqXb73QACcsxw6HRH8BqY2o=;
 h=X-UI-Sender-Class:References:From:To:Cc:Subject:Date:In-reply-to;
 b=W4F1eFb5BIdnqFqi7i2V+fxval+1P9GBgpu5B6cxyZ1VxMRWPEB9/Fym2SbIgyhiW
 CPbwnBDvP/g3QArDnCZCzynl4skv1dM9M1KyLxml9tpHNdeYt2erfw/b5cgsThblme
 rIDqEA2jzXV91CcjoxIR8cxQZtYS7vshgBN7SiUE=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from labiere ([82.69.64.142]) by mail.gmx.net (mrgmx104
 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MEFzx-1nITq42Uuj-00ADkn; Sat, 05
 Mar 2022 14:10:45 +0100
References: <20220303170252.3caec0a6@HIDDEN>
 <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
 <87bkylo6ai.fsf@HIDDEN> <20220305092445.27693167@HIDDEN>
User-agent: mu4e 1.6.10; emacs 27.2
From: Pierre Langlois <pierre.langlois@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>
Subject: Re: [bug#54239] [PATCH v2 1/5] gnu: Add cross-llvm.
Date: Sat, 05 Mar 2022 13:02:48 +0000
In-reply-to: <20220305092445.27693167@HIDDEN>
Message-ID: <874k4cmtny.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Provags-ID: V03:K1:3lbqJlNdLUOgVoXV3F/dwLZk6U//oAHF0ihfcXt9gGr2eHZXxyW
 h6qTxlWzlwBdi7OA7iwsM1STBd/XMHSsP/QZ4SuS9HbYsRKaHlr+Ywn0qHPKizOKVmiuxoZ
 3VcXxN2QGUAi7sl0hbFroaymOM4rhsMvIDSDc+s8Vz2wGIYsl3w+2/yTNO69qZ4r84NJ5Ea
 dKGEZyOQxLPoOpUQfc4fw==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:z52kRtVncSk=:Sx+EtOC4bzTWI9qOOltJPH
 ip6VBibv0D7YFUqrpJJ3DHyW+c0auvGurCs2KwNFXVTYXD/1GVM+/K49xTsoCqMSh7VCkmpzv
 P5jtUf9hHMd50+QHWfmv6vxia8qel1qJxN2LqKr6nale1NtIt6hSM+if3TYKh9kf+0+MuHeuW
 bL564VtLRPv+CJl+65Kb32VuDlFnwSZauJ2rigymvG8wuRcxBD8PpIme/hMDsLMCaUxCJehQr
 GPFwKR4Mt3jrZvREvgFNIXTZSv+jJebcigxhYLdkL7tLobs7Yqswemfocecu1ltDuS1ervnUa
 z8yXPc75ilymelMg8Z8zHeivsEBIQL9Y1unVj1xw46ZRR+c7tcg2YSSmYhkCV2G2IjqDmh1tA
 PnIRIKUlM1WCDAMmCjMgtYEHhFkFRaQSYlbO0iCCVU3kmo06iIN2nSmgwOAknNrZTRs//iO6T
 BIdvHMjLpVwao8ChbHSgsTjCL+AIp5fn244Mq5eVq94BKV/Hs5uhSmH0yAvEldKTk63ONrjnC
 yEGcozsw2oKKbZWLn4yHWLN9dfCaI0rPS0nMkU6ArxeqaMMq5dqO3scGMFqubCmG+ZmL0mQnH
 Y+odgBIhYdyn0u8PDf+LUBp0HUtkM8nAiFfYcMdvrxo+6T8iFf0SvDbQWmsFNemvfygcWxkqP
 n8JxTE9VEhLF1z6gctpiwKORKFK2ZQfz9/qYTVRDIovuMC1yfE5n5q31DGlASi4QhI2M28LMC
 I6nqbeNmMONuWTFo0nMrkBC78u7iH+VQULUaFLdFOHWSYVFrddQxZneadoIMCcVt4ltdZ5KoK
 4k04QGUaf6pv4ghA2AHTa5SGztwX8u6mgfS43b0Fq42JCI5bz3jqYySRRHWXJfVgXwlr8AdMH
 qbfcWYJUtW5Bp3KotEfDTMZVDSiDoYNR9vys78Hc3doFw7cm+CeIVR6RkZmcA8nbNrgBE9cg7
 LeAF8wvwop6Kh6mL3EpZkTsidPWlB++lcvpzvwZleAnusrF5Bu6GCqDHM9MTjSueLtLrvuTl3
 nEcSHEoIn2SFco8+PboTx0eHsrS2D8j0+SBXTvLgFWRsWd40Fe75tm31bJc1yQfR+knzw3Tg3
 PJa9U36RqYUEbU=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 54239
Cc: 54239 <at> debbugs.gnu.org, Pierre Langlois <pierre.langlois@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


Julien Lepiller <julien@HIDDEN> writes:

> Le Fri, 04 Mar 2022 19:34:07 +0000,
> Pierre Langlois <pierre.langlois@HIDDEN> a =C3=A9crit :
>
>> Hi Julien,
>>=20
>> Julien Lepiller <julien@HIDDEN> writes:
>>=20
>> > * gnu/packages/llvm.scm (cross-llvm): New variable.=20=20
>>=20
>> Do you really need to define a cross package for LLVM? In my
>> experience it was possible to use the same llvm libraries for native
>> and cross compilation. By default LLVM builds support for all
>> supported targets (provided they are not "experimental" IIRC).
>
> No, I don't think it's required.  I only need it so I can define a
> default target that's different from the host.
>
>>=20
>> Whereas for the clang package, at the moment it does have to be built
>> for a specific target IIUC. I hope that one day we could have the same
>> clang for native and cross compilation in Guix, but I don't think it
>> can work without some serious re-design of how cross-compilation
>> works. I've been trying to think about it but I don't yet have a good
>> understanding of it.
>
> You can use --target to control which target clang builds for (although
> I don't know if our clang package can work like that). I wanted to have
> a default target though, because passing --target all the time is
> cumbersome and we would have to adjust all recipes to pass the flag.
> With the default target set appropriately, (clang-for-target) will
> always produce binaries for the correct architecture, whether
> cross-compiling or not.
>

Ah I see, that makes sense!  I suppose a possible alternative could be
to define a wrapper around clang to pass the `--target=3D<triplet>' option
by default, but that might be a bit ugly (although we already have a
ld-wrapper).

Thanks,
Pierre


--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQFMBAEBCgA2FiEEctU9gYy29KFyWDdMqPyeRH9PfVQFAmIjYVEYHHBpZXJyZS5s
YW5nbG9pc0BnbXguY29tAAoJEKj8nkR/T31Ux6kIALKVi4SszzwqrEnhV3Ie0UD/
vyWtGDyn7fnsAesFA/90tvNjCoKuyYZtIam7fNIlCZHvc5GihMqGCyF8az9MSrt3
DpsIJjTYqXK9yhlHCcX2yO6FkrGzYUoaG12PiyFtg9cGJFWCmc3V+LsvUEN0EfrF
+Eh2wsEypTrzApq9zXkZKhDuoi9BEVGbwW/5EP7guZGD+5iTn7PvNyTkKWE3uTyf
Twt+C9cSRyd+SaSTtczdBGpsqcnQj1CGAsYpW18L7WjamyIBIlS7DnkBUK+vguBR
PY+7yEtuGrHG4NYklarTsRkaoR8yLMGtfyi8emkXt5lz2N1296BugLQF3Pb92cg=
=yIpi
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 5 Mar 2022 08:30:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 05 03:30:16 2022
Received: from localhost ([127.0.0.1]:47259 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQPns-0008Ck-8K
	for submit <at> debbugs.gnu.org; Sat, 05 Mar 2022 03:30:16 -0500
Received: from lepiller.eu ([89.234.186.109]:57228)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <julien@HIDDEN>) id 1nQPnp-0008Ca-NH
 for 54239 <at> debbugs.gnu.org; Sat, 05 Mar 2022 03:30:14 -0500
Received: from lepiller.eu (localhost [127.0.0.1])
 by lepiller.eu (OpenSMTPD) with ESMTP id e394ede6;
 Sat, 5 Mar 2022 08:30:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from
 :to:cc:subject:message-id:in-reply-to:references:mime-version
 :content-type:content-transfer-encoding; s=dkim; bh=jGCzsspB5l4d
 Ap9MzqVgk5HhqNytqg8X9x0Eqb6upG8=; b=dfanSWTRZeHAYgYcpbdf4gcV62R4
 3zeQUtfr9gef3f9IiKXQBLWgKB+yI+WKdsthtlsWqh/vMEx7B9xb3XJOeJBTZTw5
 o2AlZXmaGyqu0c1NVMOTruXmgQ1B1iiJHMVKxENVgiggcT6OLEof98e7D8qDMdz3
 DDKtAiMZnKOmb1Ms/G2Mt4TsGEl7qLDOOnbBphaFNF3Ek/ikfwQBg171TgZ4xTuu
 cmHFds9RDIZv9qEVipY/h2ko4Q6r/j4K7ZVHl1zmnX0jUqleMj5NpEY2xb3haAPM
 nMLiEFdS+nrLTIH+P6eXf1JfwJhEaByhkHwrQ+JD0WPvzgSBFKTRmet++Q==
Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 280dbc06
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); 
 Sat, 5 Mar 2022 08:30:12 +0000 (UTC)
Date: Sat, 5 Mar 2022 09:30:10 +0100
From: Julien Lepiller <julien@HIDDEN>
To: Maxime Devos <maximedevos@HIDDEN>
Subject: Re: [bug#54239] [PATCH v2 2/5] gnu: Add cross-clang.
Message-ID: <20220305093010.470bf145@HIDDEN>
In-Reply-To: <cc5830dc3779618436c23eaa0c2af3715273683a.camel@HIDDEN>
References: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
 <de91f63243153229e558311bb91f688ca8e177fb.1646387919.git.julien@HIDDEN>
 <cc5830dc3779618436c23eaa0c2af3715273683a.camel@HIDDEN>
X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 54239
Cc: 54239 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Le Fri, 04 Mar 2022 20:54:22 +0100,
Maxime Devos <maximedevos@HIDDEN> a =C3=A9crit :

> Julien Lepiller schreef op vr 04-03-2022 om 10:59 [+0100]:
> > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
 `((substitute* "lib/Driver/Tools.cpp"
> > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 ;; Patch the 'getLinuxDynamicLinker'
> > function so that
> > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 ;; it uses the right dynamic linker
> > file name.
> > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 (("/lib64/ld-linux-x86-64.so.2")
> > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (string-append libc
> > ,(glibc-dynamic-linker)))) =20
>=20
> Do we need something similar for non-x86-64 architectures as well?
>=20
> Greetings,
> Maxime.

I don't know about that. This phase is mostly copied from clang itself.




Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 5 Mar 2022 08:24:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 05 03:24:51 2022
Received: from localhost ([127.0.0.1]:47255 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQPid-00083E-Iz
	for submit <at> debbugs.gnu.org; Sat, 05 Mar 2022 03:24:51 -0500
Received: from lepiller.eu ([89.234.186.109]:57220)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <julien@HIDDEN>) id 1nQPib-000833-Uu
 for 54239 <at> debbugs.gnu.org; Sat, 05 Mar 2022 03:24:50 -0500
Received: from lepiller.eu (localhost [127.0.0.1])
 by lepiller.eu (OpenSMTPD) with ESMTP id f5e47765;
 Sat, 5 Mar 2022 08:24:47 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from
 :to:cc:subject:message-id:in-reply-to:references:mime-version
 :content-type:content-transfer-encoding; s=dkim; bh=ZwmRAgqLuRxt
 Bge5PZA4raZSB2No5x33wgXRk/phDB0=; b=M8fp2nONt+DsR/s8svWXdvXjLQvC
 GBtvhqkqo3+yOITBnd84aM0SxfXfEx8UFTiD9WtX1BwpdjrMGBjHVfCv6E1XqsN2
 yfn1MkjuJBs5ALioyp+YrwALaZpd4sVJ8J5FOCGh2HELyF1SIU9JZqqUc66le26h
 Qam1bcspQqqVO+MveEiYsKkCS47oT+RBy9Jn82PlmSD8QziqOqNUjCNMBmKmLa6i
 UQCigyaS57A7Jte2P8cR5y9mnbwVVr969T4QIK1MnPhMt6o/zsffXt3o9nRp9u1q
 2GAYC5lswP9LZCRxU/hBph6ogX/9iSM9ng/Tug0Rb4Sa9jmym8EZWYD/FA==
Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 6c054277
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); 
 Sat, 5 Mar 2022 08:24:47 +0000 (UTC)
Date: Sat, 5 Mar 2022 09:24:45 +0100
From: Julien Lepiller <julien@HIDDEN>
To: Pierre Langlois <pierre.langlois@HIDDEN>
Subject: Re: [bug#54239] [PATCH v2 1/5] gnu: Add cross-llvm.
Message-ID: <20220305092445.27693167@HIDDEN>
In-Reply-To: <87bkylo6ai.fsf@HIDDEN>
References: <20220303170252.3caec0a6@HIDDEN>
 <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
 <87bkylo6ai.fsf@HIDDEN>
X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 54239
Cc: 54239 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Le Fri, 04 Mar 2022 19:34:07 +0000,
Pierre Langlois <pierre.langlois@HIDDEN> a =C3=A9crit :

> Hi Julien,
>=20
> Julien Lepiller <julien@HIDDEN> writes:
>=20
> > * gnu/packages/llvm.scm (cross-llvm): New variable. =20
>=20
> Do you really need to define a cross package for LLVM? In my
> experience it was possible to use the same llvm libraries for native
> and cross compilation. By default LLVM builds support for all
> supported targets (provided they are not "experimental" IIRC).

No, I don't think it's required.  I only need it so I can define a
default target that's different from the host.

>=20
> Whereas for the clang package, at the moment it does have to be built
> for a specific target IIUC. I hope that one day we could have the same
> clang for native and cross compilation in Guix, but I don't think it
> can work without some serious re-design of how cross-compilation
> works. I've been trying to think about it but I don't yet have a good
> understanding of it.

You can use --target to control which target clang builds for (although
I don't know if our clang package can work like that). I wanted to have
a default target though, because passing --target all the time is
cumbersome and we would have to adjust all recipes to pass the flag.
With the default target set appropriately, (clang-for-target) will
always produce binaries for the correct architecture, whether
cross-compiling or not.

>=20
> Thanks,
> Pierre
>=20





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 4 Mar 2022 20:05:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 04 15:05:17 2022
Received: from localhost ([127.0.0.1]:46880 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQEAu-0003v1-RU
	for submit <at> debbugs.gnu.org; Fri, 04 Mar 2022 15:05:17 -0500
Received: from baptiste.telenet-ops.be ([195.130.132.51]:60780)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1nQEAt-0003uq-18
 for 54239 <at> debbugs.gnu.org; Fri, 04 Mar 2022 15:05:15 -0500
Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be
 ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a])
 by baptiste.telenet-ops.be with bizsmtp
 id 2L5D270044UW6Th01L5Dx7; Fri, 04 Mar 2022 21:05:13 +0100
Message-ID: <87986722191470a315336d6cf07b3106de1b725c.camel@HIDDEN>
Subject: Re: [bug#54239] [PATCH] gnu: Add cross-clang.
From: Maxime Devos <maximedevos@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>
Date: Fri, 04 Mar 2022 21:05:12 +0100
In-Reply-To: <20220303193503.4c055cec@HIDDEN>
References: <20220303170252.3caec0a6@HIDDEN>
 <70c3446488f9b76479f4f989c351403c461369d1.camel@HIDDEN>
 <20220303193503.4c055cec@HIDDEN>
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-zWJovEOylU399RyGR7mD"
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=1646424313; bh=EI2dYbKaeh4PZg0HWK6xuRM7+/jbQmy/g9UwiZbssp4=;
 h=Subject:From:To:Cc:Date:In-Reply-To:References;
 b=aVs2FhMFH9XvTSK5YB3ZxKqmkmHFfAhytm0xPPktkI5pVFpSf2TXHoXeuDow86gLQ
 GwrNxKkJ720oURMEm9VdvDSO58JVik0+zAt3Ik+7vr04p06siC9ybiUfDIWjEmuB0k
 NCaQWL/0PeDLdjPmI3jB02wPg+W99g72GE+X1GDdBjhL8Par4s4hhWV9xaPCH8knjg
 oycEc3w9fQxxjTH60Ey+fclBx4HGUMDcJ+PQOZqJnHo2sudVvK0hKSKC0jigRRXAti
 TJ9OXhfUQcBbAVQvf26FMzOWOZEg65R4CGl72sABVbF3bfujd0n5cvjwwIkKuW4i2g
 i9vtNV78x7rPg==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 54239
Cc: 54239 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)


--=-zWJovEOylU399RyGR7mD
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Julien Lepiller schreef op do 03-03-2022 om 19:35 [+0100]:
> It won't work, just like it doesn't work for gcc-toolchain. When you do
> (without my patches):
>=20
> guix build hello --with-c-toolchain=3Dhello=3Dclang-toolchain
> --target=3Di686-unknown-linux-gnu
>=20
> it builds, but that's because --with-c-toolchain replaces "gcc"
> (and friends), but the cross package uses "cross-gcc".
>=20
> guix build hello --with-c-toolchain=3Dhello=3Dgcc-toolchain@7
> --target=3Di686-unknown-linux-gnu
>=20
> also builds, but uses the latest gcc instead of gcc-toolchain@7.

In that case, could this limitation be documented in

@deffn {Scheme Procedure} package-with-c-toolchain @var{package} @var{toolc=
hain}

in the manual?  Modifying (guix transformations) to also replace
the cross-toolchain would be even better.

Greetings,
Maxime

--=-zWJovEOylU399RyGR7mD
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+4iGRcl7gUCYiJw+BccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7hezAQDkymriyv+dfhA2Bf5jE/kOB2Yn
hLqzuoBdYFeFMWh/JAD/W8ERivlwqO+V7WtjPsgDaUzYqHjW8W1aCelDlvq4DgY=
=lWUb
-----END PGP SIGNATURE-----

--=-zWJovEOylU399RyGR7mD--





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 4 Mar 2022 20:00:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 04 15:00:58 2022
Received: from localhost ([127.0.0.1]:46875 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQE6k-0003ob-BQ
	for submit <at> debbugs.gnu.org; Fri, 04 Mar 2022 15:00:58 -0500
Received: from xavier.telenet-ops.be ([195.130.132.52]:60728)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1nQE6i-0003oQ-2l
 for 54239 <at> debbugs.gnu.org; Fri, 04 Mar 2022 15:00:56 -0500
Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be
 ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a])
 by xavier.telenet-ops.be with bizsmtp
 id 2L0u2700T4UW6Th01L0vnE; Fri, 04 Mar 2022 21:00:55 +0100
Message-ID: <c4628a24fb6919ff35fc5f861e78b392a2447d2d.camel@HIDDEN>
Subject: Re: [bug#54239] [PATCH v2 2/5] gnu: Add cross-clang.
From: Maxime Devos <maximedevos@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>, 54239 <at> debbugs.gnu.org
Date: Fri, 04 Mar 2022 21:00:54 +0100
In-Reply-To: <de91f63243153229e558311bb91f688ca8e177fb.1646387919.git.julien@HIDDEN>
References: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
 <de91f63243153229e558311bb91f688ca8e177fb.1646387919.git.julien@HIDDEN>
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-/90ij+Y778kGdcalrK+w"
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=1646424055; bh=1yVD896QlzlbD1QvFTXx2nmp0QTzE8TcLXauDwOSTpE=;
 h=Subject:From:To:Date:In-Reply-To:References;
 b=KFQtOZq/bbiFmxhzXVcULtKM2soijI/48+ThBt9vutCP3/ek3S79fPRT8TRpze5pD
 mFGwaME8lYwCd+ID2e+MPKWjrhEmNHAM+BmRA+ILzvseI/0ZjQ8UZMkfrXOb2Yv5BF
 rs0B73w8Nf+Zjtn996xMHvzX+Dj123uiFoIqNSOSTmQAvSvFCTYpkrGWOifQrmxBeQ
 n6A5eS15Xhdkm7Vdy8KEHP0S2WXJmYw5ok1KLRQLKZ+0cLXyerJco8cEHjDeUnsjMl
 addznJeFfT6D17/EEb3q5EJw1hi3BviFxbYzDe1YgL36l0URm/q8kemXIrCl3GmK0y
 /jbO3INRxhArA==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 54239
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)


--=-/90ij+Y778kGdcalrK+w
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Julien Lepiller schreef op vr 04-03-2022 om 10:59 [+0100]:
> +=C2=A0 #:use-module (gnu packages cross-base)

Most of the time, we aren't cross-compiling.  So WDYT of autoloading
this module?  It's rather unusual to do this in (gnu packages ...), but
there does not appear to be any reason for this to be impossible to do.

Another option would be using 'module-ref' like (guix build-system ...)
does.

Greetings,
Maxime.

--=-/90ij+Y778kGdcalrK+w
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+4iGRcl7gUCYiJv9hccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7oKPAQD6IpCh/We0dAH+vGeBH/Br+1Mk
20kWUzHil8jG6p7oygD/VaPbN9vV2+YX3OPSMsPjMoCWDezuYJjci3aRB+yRvQ8=
=KJXK
-----END PGP SIGNATURE-----

--=-/90ij+Y778kGdcalrK+w--





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 4 Mar 2022 19:56:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 04 14:56:15 2022
Received: from localhost ([127.0.0.1]:46869 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQE2A-0003gU-Pa
	for submit <at> debbugs.gnu.org; Fri, 04 Mar 2022 14:56:14 -0500
Received: from xavier.telenet-ops.be ([195.130.132.52]:56056)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1nQE28-0003gM-Ik
 for 54239 <at> debbugs.gnu.org; Fri, 04 Mar 2022 14:56:12 -0500
Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be
 ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a])
 by xavier.telenet-ops.be with bizsmtp
 id 2KwB2700H4UW6Th01KwBCK; Fri, 04 Mar 2022 20:56:11 +0100
Message-ID: <bdcd3f77f0d5d1e298e562ccbc6fc690b699a5f1.camel@HIDDEN>
Subject: Re: [bug#54239] [PATCH v2 2/5] gnu: Add cross-clang.
From: Maxime Devos <maximedevos@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>, 54239 <at> debbugs.gnu.org
Date: Fri, 04 Mar 2022 20:56:11 +0100
In-Reply-To: <de91f63243153229e558311bb91f688ca8e177fb.1646387919.git.julien@HIDDEN>
References: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
 <de91f63243153229e558311bb91f688ca8e177fb.1646387919.git.julien@HIDDEN>
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-Goz/sZV9+9LSjeqKQt17"
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=1646423771; bh=n3qeNQsFuzhfAKd8eWy2Bmqm9LnFJZHnfhrSsrtR8vQ=;
 h=Subject:From:To:Date:In-Reply-To:References;
 b=EHNy7UX8kakE2CcPwbv929vFecp1nOJ1++WaYx2oFyjZaA3HQLpebhUqmMPRCpY0e
 cwb96UwjLeBbqhpIoKxShUFYij3z2Sz1zluOWgJ70y9n61x7MyupnpYFO1ZS/JIZse
 0kc0SL0vGGfiYYxFMP1yiPZloa3omMteCOgJcpzMKcj0n9mr4/kCsl9I+0KMy96lYa
 JEYQLyRcTl2kRpmAVPTfEEPuW9w3OEQFIwWIKdG0f9Ec2YrDGBGDd6FlG+YSLYEGge
 dcawk1UWNknktt0zaNOWPIq4PyGTLE/L4UHWIqpEqJwTV5ORXN4/zoSQuJTu6OKKFK
 Sg2S0iKLGemAA==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 54239
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)


--=-Goz/sZV9+9LSjeqKQt17
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: base64

SnVsaWVuIExlcGlsbGVyIHNjaHJlZWYgb3AgdnIgMDQtMDMtMjAyMiBvbSAxMDo1OSBbKzAxMDBd
Ogo+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIChlbHNl
Cj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCBgKChz
dWJzdGl0dXRlKiAibGliL0RyaXZlci9Ub29scy5jcHAiCj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKg
wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIDs7IFBhdGNoIHRoZSAnZ2V0TGlu
dXhEeW5hbWljTGlua2VyJyBmdW5jdGlvbiBzbyB0aGF0Cj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKg
wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgIDs7IGl0IHVzZXMgdGhlIHJpZ2h0
IGR5bmFtaWMgbGlua2VyIGZpbGUgbmFtZS4KPiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC
oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgKCgiL2xpYjY0L2xkLWxpbnV4LXg4Ni02NC5z
by4yIikKPiArwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg
wqDCoMKgwqDCoCAoc3RyaW5nLWFwcGVuZCBsaWJjICwoZ2xpYmMtZHluYW1pYy1saW5rZXIpKSkp
CgpTaG91bGRuJ3Qgd2UgdXNlIHRoZSBhcmNoaXRlY3R1cmUgdGhhdCB0aGUgY3Jvc3MtY2xhbmcg
aXMgdGFyZ2V0dGluZyBiZQpwYXNzZWQgdG8gJ2dsaWJjLWR5bmFtaWMtbGlua2VyJyBpbnN0ZWFk
IG9mIHRoZSBhcmNoaXRlY3R1cmUgdGhhdCB0aGUKY3Jvc3MtY2xhbmcgd2lsbCBydW4gb24/CgpH
cmVldGluZ3MsCk1heGltZS4K


--=-Goz/sZV9+9LSjeqKQt17
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+4iGRcl7gUCYiJu2xccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7gZtAQCqhhpBXu1E/Xyt1zHUWZtM3MxA
+zDCtImIO7cPzVT/ogD/W5aLM9QHgI0ddK3wSaLonex711hTjK07SUJklv8u9Ao=
=b8Ct
-----END PGP SIGNATURE-----

--=-Goz/sZV9+9LSjeqKQt17--





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 4 Mar 2022 19:54:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 04 14:54:25 2022
Received: from localhost ([127.0.0.1]:46864 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQE0P-0003dc-Eq
	for submit <at> debbugs.gnu.org; Fri, 04 Mar 2022 14:54:25 -0500
Received: from andre.telenet-ops.be ([195.130.132.53]:39716)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1nQE0N-0003dT-Cv
 for 54239 <at> debbugs.gnu.org; Fri, 04 Mar 2022 14:54:23 -0500
Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be
 ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a])
 by andre.telenet-ops.be with bizsmtp
 id 2KuN270044UW6Th01KuNW6; Fri, 04 Mar 2022 20:54:22 +0100
Message-ID: <cc5830dc3779618436c23eaa0c2af3715273683a.camel@HIDDEN>
Subject: Re: [bug#54239] [PATCH v2 2/5] gnu: Add cross-clang.
From: Maxime Devos <maximedevos@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>, 54239 <at> debbugs.gnu.org
Date: Fri, 04 Mar 2022 20:54:22 +0100
In-Reply-To: <de91f63243153229e558311bb91f688ca8e177fb.1646387919.git.julien@HIDDEN>
References: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
 <de91f63243153229e558311bb91f688ca8e177fb.1646387919.git.julien@HIDDEN>
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-x90WOd/tk3C48hfp0AX3"
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=1646423662; bh=bU2Zfv6ekMlAOSJphzEYG1MWqrfDPf75oLDOfwttl4E=;
 h=Subject:From:To:Date:In-Reply-To:References;
 b=kEob6TiJDaa+n4/8t4+KCIBwjf19/WmG4PAtNw5GeLE+5wzjEqurYOqiiQ3g8p7Or
 BhQydeQ/BGhsInm7i52gixVF3/E2cEUEspIzs/7hhC8DzEVl1CxT9v1f1l8QtvScRk
 FfniTv/3bHEnxvdWspuV87NHOYD6500ICL3+/6IWQk+GabRQn2w3KwlVUrFgs4bB/L
 54WNtUWyh9C6EBI8a//+0lieaIF6DSa+nEHKBJw/kpf5BYEILlpz1He51tNFr4+til
 qORPCvZO1bPDICFIRlzPhCJkUszYCXnoN4SF9fg4J5tFEv4jZBXBvNo3TGMf+KZe87
 AzZN/UHaybDmQ==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 54239
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)


--=-x90WOd/tk3C48hfp0AX3
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: base64

SnVsaWVuIExlcGlsbGVyIHNjaHJlZWYgb3AgdnIgMDQtMDMtMjAyMiBvbSAxMDo1OSBbKzAxMDBd
Ogo+ICvCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqAgYCgo
c3Vic3RpdHV0ZSogImxpYi9Ecml2ZXIvVG9vbHMuY3BwIgo+ICvCoMKgwqDCoMKgwqDCoMKgwqDC
oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCA7OyBQYXRjaCB0aGUgJ2dldExp
bnV4RHluYW1pY0xpbmtlcicgZnVuY3Rpb24gc28gdGhhdAo+ICvCoMKgwqDCoMKgwqDCoMKgwqDC
oMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoCA7OyBpdCB1c2VzIHRoZSByaWdo
dCBkeW5hbWljIGxpbmtlciBmaWxlIG5hbWUuCj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKg
wqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgICgoIi9saWI2NC9sZC1saW51eC14ODYtNjQu
c28uMiIpCj4gK8KgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDCoMKgwqDC
oMKgwqDCoMKgwqAgKHN0cmluZy1hcHBlbmQgbGliYyAsKGdsaWJjLWR5bmFtaWMtbGlua2VyKSkp
KQoKRG8gd2UgbmVlZCBzb21ldGhpbmcgc2ltaWxhciBmb3Igbm9uLXg4Ni02NCBhcmNoaXRlY3R1
cmVzIGFzIHdlbGw/CgpHcmVldGluZ3MsCk1heGltZS4K


--=-x90WOd/tk3C48hfp0AX3
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+4iGRcl7gUCYiJubhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7m4/AP9Inisv/2UlDlnlUiqJ74zRBxsr
s0YYh4xJkhW0tKQEjgD/a6AD357eCGKfbziteEdFuIIYeKkS61AfYAe+9Y9c8As=
=bYbQ
-----END PGP SIGNATURE-----

--=-x90WOd/tk3C48hfp0AX3--





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 4 Mar 2022 19:53:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 04 14:53:15 2022
Received: from localhost ([127.0.0.1]:46859 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQDzH-0003br-4Q
	for submit <at> debbugs.gnu.org; Fri, 04 Mar 2022 14:53:15 -0500
Received: from xavier.telenet-ops.be ([195.130.132.52]:53442)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1nQDzE-0003bi-Sa
 for 54239 <at> debbugs.gnu.org; Fri, 04 Mar 2022 14:53:13 -0500
Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be
 ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a])
 by xavier.telenet-ops.be with bizsmtp
 id 2KtB270044UW6Th01KtBpH; Fri, 04 Mar 2022 20:53:11 +0100
Message-ID: <d128d502479628c326db2e95925f14a1e596e3e8.camel@HIDDEN>
Subject: Re: [bug#54239] [PATCH v2 2/5] gnu: Add cross-clang.
From: Maxime Devos <maximedevos@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>, 54239 <at> debbugs.gnu.org
Date: Fri, 04 Mar 2022 20:53:10 +0100
In-Reply-To: <de91f63243153229e558311bb91f688ca8e177fb.1646387919.git.julien@HIDDEN>
References: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
 <de91f63243153229e558311bb91f688ca8e177fb.1646387919.git.julien@HIDDEN>
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-JPNIXx7d9dxQNkJhPAR0"
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=1646423591; bh=3HApjK79fM6SGltEPBUxtPAk5K/HmjbZH6h9kup+JFA=;
 h=Subject:From:To:Date:In-Reply-To:References;
 b=jzfh7hMr6nYNQgKQxvgy84YMH1UG8MS9Fv8DuvIncbubCZu30hzcRuL1178Ug+KOH
 1KwK32vjxNQiKqA9nH2DJo/DVhltL66SMsflKK0ZJTpiPZ0txKiXhlNv2vj9FlXTIA
 WZyeuFv54764BRxuqFDZ/wIWY/SEO1DI2t8u6VRtxo2TjXt9pwAYABZQ6IOR/bB1U6
 +NouT7xPRKiNChqjWvDsQSAYtS2/CBSXwlta5ovIkdLIC3B0E63xwCJDltpwQsMBET
 7LdhdAq8lUn8Zhy4lNWGEAWNqinFggMLb8XqumOIlyJxN769zFQ4lDTxkC36Wx/G/q
 AAqA6pFo8wnLQ==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 54239
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)


--=-JPNIXx7d9dxQNkJhPAR0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Julien Lepiller schreef op vr 04-03-2022 om 10:59 [+0100]:
> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((#:configu=
re-flags _)
> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 `(lis=
t "-DCLANG_INCLUDE_TESTS=3DTrue"

This is a bit fragile.  If the definition of the 'clang' package mad
the #:configure-flags a gexp, then this would fail because of the
'sexp->gexp' optimisation in 'cmake-build-system'.  As such, I
recommend #~(list "-DCLANG_INCLUDE_TESTS=3DTrue" ...) here instead of
sexp quasiquoting.

Greetings,
Maxime.

--=-JPNIXx7d9dxQNkJhPAR0
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+4iGRcl7gUCYiJuJhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7s/3AQC/TO8VUDws76nMb4GKctaWxt4B
SS9iuG25J5wzb7WWhQD/WEHGk+RiyfpFrRHWRKXagskPCaX6skuy3vSwF6bJ+Q0=
=7V8F
-----END PGP SIGNATURE-----

--=-JPNIXx7d9dxQNkJhPAR0--





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 4 Mar 2022 19:50:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 04 14:50:52 2022
Received: from localhost ([127.0.0.1]:46854 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQDwy-0003YE-OU
	for submit <at> debbugs.gnu.org; Fri, 04 Mar 2022 14:50:52 -0500
Received: from andre.telenet-ops.be ([195.130.132.53]:36794)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1nQDww-0003Y1-RE
 for 54239 <at> debbugs.gnu.org; Fri, 04 Mar 2022 14:50:51 -0500
Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be
 ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a])
 by andre.telenet-ops.be with bizsmtp
 id 2Kqo2700D4UW6Th01Kqo8U; Fri, 04 Mar 2022 20:50:48 +0100
Message-ID: <04c47fe2e1f964a675697f3e389f6226e11f9815.camel@HIDDEN>
Subject: Re: [bug#54239] [PATCH v2 5/5] gnu: Add libcxxabi-9.
From: Maxime Devos <maximedevos@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>, 54239 <at> debbugs.gnu.org
Date: Fri, 04 Mar 2022 20:50:43 +0100
In-Reply-To: <937fd2ca36d8368ea83be56ae29dbec1a97bfb41.1646387919.git.julien@HIDDEN>
References: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
 <937fd2ca36d8368ea83be56ae29dbec1a97bfb41.1646387919.git.julien@HIDDEN>
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-m90AECf+/vvwxwjvURSI"
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=1646423448; bh=XWSDpVcKLasRCPSztDtpn//GwA+uPa8Obl9rOnve7Ks=;
 h=Subject:From:To:Date:In-Reply-To:References;
 b=oNGzHa5TtqGs9K/zsZP2GuYcY6KcVDw/sYMUVbGMP3FKVSJacDx5maCgul3UOA2sT
 v//8u0kLp8gJUpEqbWDycAyMWPvurrdUohwBa9zgex/vOnUL4699NpVMlBtsPJu+4e
 qHsg6/iiLNnz+W1elo8LE82A2QNJmDF18x2m1OZ4JYf49NqT3+NOBCNGxPNcjCw38q
 nFA1RM13y8D+1jOpvjPlxs6RhvMZHgbe6qKlkGMyz9uGQIRwyS7ZdaNbS3/MCB/Frk
 2Tmz+5ZiWJ8Jn74RECWmtih3R3w26jBo9k4FzB0TF1/dua/j20ZOgmykMbq90ovwhb
 RXeQMKolCG1Ow==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 54239
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)


--=-m90AECf+/vvwxwjvURSI
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Julien Lepiller schreef op vr 04-03-2022 om 10:59 [+0100]:
> +=C2=A0=C2=A0=C2=A0=C2=A0 (list (if (%current-target-system)
> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 (cross-clang (%current-target-system) #:clang clang-6)
> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 clang-6)))))

Could the new procedure could 'clang-for-target' be used here?
Likewise for a few other packages (e.g. hedgewards), but those could be
left for future patches.

Greetings,
Maxime

--=-m90AECf+/vvwxwjvURSI
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+4iGRcl7gUCYiJtkxccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7g+SAPwNtiBWZWQka5/VxCpnIR9A+eLD
i3AfQ/q+2hNyJU4szwD9EVtb47tcflyQ7VAqPDGokz0iGABWEXNCypB+tOKiHA4=
=5T+3
-----END PGP SIGNATURE-----

--=-m90AECf+/vvwxwjvURSI--





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 4 Mar 2022 19:40:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 04 14:40:37 2022
Received: from localhost ([127.0.0.1]:46839 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQDn2-0003GN-U2
	for submit <at> debbugs.gnu.org; Fri, 04 Mar 2022 14:40:37 -0500
Received: from mout.gmx.net ([212.227.17.20]:54731)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pierre.langlois@HIDDEN>) id 1nQDn1-0003G6-1r
 for 54239 <at> debbugs.gnu.org; Fri, 04 Mar 2022 14:40:35 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1646422828;
 bh=Ey0krwRcgl6ljqgLUtwFOx9R8cCIftaN2r+wntvWZTE=;
 h=X-UI-Sender-Class:References:From:To:Cc:Subject:Date:In-reply-to;
 b=ee15uHXhKW0MQ5jE1n0yrH+31o2Bk0GQ6o/SHx3XyPIsiwH19sAG37ro6LaJFiUCm
 6Cuq+YwBvpDbH56R8dHMb+47sUr09WhX+AAxTp0YTDa90YohXMW6oaGKaoUJtulNJ6
 XHeSDMNgXYt/NJSntYHSwi+tosxGLXUg+cIxYV0w=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from labiere ([82.69.64.142]) by mail.gmx.net (mrgmx105
 [212.227.17.174]) with ESMTPSA (Nemesis) id 1Mkpap-1ntjyG3vWZ-00mKDP; Fri, 04
 Mar 2022 20:40:28 +0100
References: <20220303170252.3caec0a6@HIDDEN>
 <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
User-agent: mu4e 1.6.10; emacs 27.2
From: Pierre Langlois <pierre.langlois@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>
Subject: Re: [bug#54239] [PATCH v2 1/5] gnu: Add cross-llvm.
Date: Fri, 04 Mar 2022 19:34:07 +0000
In-reply-to: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
Message-ID: <87bkylo6ai.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Provags-ID: V03:K1:NtkH4NzH6LfD6l94mSR0/83YUm6ownxtFsmLJGStUW+U218wGXC
 BAIPSiqJ5ApPlcN77P1ycIL7MYWrx8SrnBnlXJl5LWibnEnOtMBOaHHEJxTvAIMHHlX8LSL
 xK9NTZT42XJhqsUyM+MRPmGMC/giCdR2hZB6ZIB4ubrnZmqNxde4kxWpkk/q2mPIBC/DhHo
 Wg715vRIVN4M5WzmVxnAg==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:omneCtNusoQ=:zs7qG529fuNwHcnAtARL3I
 20Z155tpgFkpVpus3yvd2XsHeX1YzaOujFwKBtTkY5JaofScoddgUkfqgtxXEo7JELWyqeQsX
 f6BHpm0K0Zovb9Zq+9JPrFM37DcaZup1X73LIp6tRy9RG1/4hMStLH808GcJfOjAdTPKQPvfS
 qmsROo7jMDavwEI/MYHLlqOGliBIbGxzD6fUtmYW7N4WtUqbmUsHsj/J/y52EaWqenYgjI5YX
 HMcTddu/dtU1+jPJu5GAdabBx6I+QeTJUrEDNqj2O3HoOdUxAuAHkgbEulJGQDQfHlXJu3u9w
 us336t2PlKlAiue+TZeNS4yBVi+31tM+THPdXYMO/CLsfA7Gu1zR8TFAbDEVmCEpBEFTT7Z5h
 wBDEAoNXzCcnnbVVTb3aRcHZ1T3y6Se8QgVIn0piojLt2LfD1OXZs9psTXusZ8+Zco2UbvE4d
 KzkJICyfNVM02n5f3Jy4xRcVR5fUn2o93pp5McZDAZ07TiGsgee8hg8KLlcLqkUIq+JtGisXE
 38R0SvQKiQ//nTawDjW6N8jRIUi1S8Xr0Zh2JW9e+RiwZ6N2k5IZEZTGdxL/LSxKsizJY+fXh
 ghpoMzVEg0AEK1kfF0AUn/OF2EKBvMjXbVWlohXP8bSxTWTUvC2W8AASlBKqcle7NAjzork3q
 eECHLyXGOInpZ4CQcXPFnn6VIC7cMW91aea+welzI/VKzmkXmlOjys4JimGxHtSAvl9mzpudr
 9b/JiiAVedvkrRF5Hh3C7jYv3s7aOKsFRHro9AN7oWSIlQ4Io9vRKlHwgNUboadZnEYYihtFr
 rSvJmtlPD5+e1Qml8iBDlrAnbqP5otRsEbBOxbVGnQv2HJ7TEM9KmkxlkKPb1USmkU9oR82re
 y5vMfKPl17az7XF7MabKCHmLNIovqzXFuuRljq39VEACuQTCl7wSLB/IrcwPNUy4Dee2Px3jW
 EX7Ubb6OaFTzqLMFvPHhOZ66sVGJfD9oT+88aJ9jWAiw+e+87qrMxIcFhY+BdxfkzweqI7TKu
 OgjNwEdwoLf/I1c1FPtI+1HUVRY+633mrgAun9/BLEpg0K54MNDcqiWkksKrDvgGtHbAk6iNF
 yX5rwhRR+X5xtQ=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 54239
Cc: 54239 <at> debbugs.gnu.org, guix-patches@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

--=-=-=
Content-Type: text/plain

Hi Julien,

Julien Lepiller <julien@HIDDEN> writes:

> * gnu/packages/llvm.scm (cross-llvm): New variable.

Do you really need to define a cross package for LLVM? In my experience
it was possible to use the same llvm libraries for native and cross
compilation. By default LLVM builds support for all supported targets
(provided they are not "experimental" IIRC).

Whereas for the clang package, at the moment it does have to be built
for a specific target IIUC. I hope that one day we could have the same
clang for native and cross compilation in Guix, but I don't think it can
work without some serious re-design of how cross-compilation works. I've
been trying to think about it but I don't yet have a good understanding
of it.

Thanks,
Pierre


--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQFMBAEBCgA2FiEEctU9gYy29KFyWDdMqPyeRH9PfVQFAmIiayUYHHBpZXJyZS5s
YW5nbG9pc0BnbXguY29tAAoJEKj8nkR/T31U24YH/1l7ln2fJnUtVun5qmCQlvJy
nbKnNQ7O+HibdMqivHT9b4eDOOTO1O8D6REU+uzjvb8qU0aIY45p+V6rYSP1GIe3
uCybteA+YTh4iPkbDrMu1RLXH+cYNG1HgxN+l4/K1t1L+Httnk1e6H7WQ/QD0R1Q
I26tSHczktvs7ZR5DLQYR8TP+r9fmYP7TQEI+3Gb62sy85JfEkS6aWH6NGZXSQMY
D36mSohSOhXdGb1PCBe8MiKVFH9eQt+DQ8NqMdYuXxGTozL0NagWeE73lz+QseJu
Pg/JiFtCn8AQ5nIvmWiTn6D+NFcoz425mTzuB84/S1bzm5WaZolCEvGNjQ8/FpI=
=bXNa
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 4 Mar 2022 19:40:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 04 14:40:41 2022
Received: from localhost ([127.0.0.1]:46842 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQDn7-0003Ge-5R
	for submit <at> debbugs.gnu.org; Fri, 04 Mar 2022 14:40:41 -0500
Received: from lists.gnu.org ([209.51.188.17]:46230)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pierre.langlois@HIDDEN>) id 1nQDn5-0003GW-KI
 for submit <at> debbugs.gnu.org; Fri, 04 Mar 2022 14:40:39 -0500
Received: from eggs.gnu.org ([209.51.188.92]:60230)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <pierre.langlois@HIDDEN>)
 id 1nQDn5-0000sq-AI
 for guix-patches@HIDDEN; Fri, 04 Mar 2022 14:40:39 -0500
Received: from mout.gmx.net ([212.227.17.20]:44489)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <pierre.langlois@HIDDEN>)
 id 1nQDn3-0004w1-FX
 for guix-patches@HIDDEN; Fri, 04 Mar 2022 14:40:39 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1646422828;
 bh=Ey0krwRcgl6ljqgLUtwFOx9R8cCIftaN2r+wntvWZTE=;
 h=X-UI-Sender-Class:References:From:To:Cc:Subject:Date:In-reply-to;
 b=ee15uHXhKW0MQ5jE1n0yrH+31o2Bk0GQ6o/SHx3XyPIsiwH19sAG37ro6LaJFiUCm
 6Cuq+YwBvpDbH56R8dHMb+47sUr09WhX+AAxTp0YTDa90YohXMW6oaGKaoUJtulNJ6
 XHeSDMNgXYt/NJSntYHSwi+tosxGLXUg+cIxYV0w=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from labiere ([82.69.64.142]) by mail.gmx.net (mrgmx105
 [212.227.17.174]) with ESMTPSA (Nemesis) id 1Mkpap-1ntjyG3vWZ-00mKDP; Fri, 04
 Mar 2022 20:40:28 +0100
References: <20220303170252.3caec0a6@HIDDEN>
 <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
User-agent: mu4e 1.6.10; emacs 27.2
From: Pierre Langlois <pierre.langlois@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>
Subject: Re: [bug#54239] [PATCH v2 1/5] gnu: Add cross-llvm.
Date: Fri, 04 Mar 2022 19:34:07 +0000
In-reply-to: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
Message-ID: <87bkylo6ai.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Provags-ID: V03:K1:NtkH4NzH6LfD6l94mSR0/83YUm6ownxtFsmLJGStUW+U218wGXC
 BAIPSiqJ5ApPlcN77P1ycIL7MYWrx8SrnBnlXJl5LWibnEnOtMBOaHHEJxTvAIMHHlX8LSL
 xK9NTZT42XJhqsUyM+MRPmGMC/giCdR2hZB6ZIB4ubrnZmqNxde4kxWpkk/q2mPIBC/DhHo
 Wg715vRIVN4M5WzmVxnAg==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:omneCtNusoQ=:zs7qG529fuNwHcnAtARL3I
 20Z155tpgFkpVpus3yvd2XsHeX1YzaOujFwKBtTkY5JaofScoddgUkfqgtxXEo7JELWyqeQsX
 f6BHpm0K0Zovb9Zq+9JPrFM37DcaZup1X73LIp6tRy9RG1/4hMStLH808GcJfOjAdTPKQPvfS
 qmsROo7jMDavwEI/MYHLlqOGliBIbGxzD6fUtmYW7N4WtUqbmUsHsj/J/y52EaWqenYgjI5YX
 HMcTddu/dtU1+jPJu5GAdabBx6I+QeTJUrEDNqj2O3HoOdUxAuAHkgbEulJGQDQfHlXJu3u9w
 us336t2PlKlAiue+TZeNS4yBVi+31tM+THPdXYMO/CLsfA7Gu1zR8TFAbDEVmCEpBEFTT7Z5h
 wBDEAoNXzCcnnbVVTb3aRcHZ1T3y6Se8QgVIn0piojLt2LfD1OXZs9psTXusZ8+Zco2UbvE4d
 KzkJICyfNVM02n5f3Jy4xRcVR5fUn2o93pp5McZDAZ07TiGsgee8hg8KLlcLqkUIq+JtGisXE
 38R0SvQKiQ//nTawDjW6N8jRIUi1S8Xr0Zh2JW9e+RiwZ6N2k5IZEZTGdxL/LSxKsizJY+fXh
 ghpoMzVEg0AEK1kfF0AUn/OF2EKBvMjXbVWlohXP8bSxTWTUvC2W8AASlBKqcle7NAjzork3q
 eECHLyXGOInpZ4CQcXPFnn6VIC7cMW91aea+welzI/VKzmkXmlOjys4JimGxHtSAvl9mzpudr
 9b/JiiAVedvkrRF5Hh3C7jYv3s7aOKsFRHro9AN7oWSIlQ4Io9vRKlHwgNUboadZnEYYihtFr
 rSvJmtlPD5+e1Qml8iBDlrAnbqP5otRsEbBOxbVGnQv2HJ7TEM9KmkxlkKPb1USmkU9oR82re
 y5vMfKPl17az7XF7MabKCHmLNIovqzXFuuRljq39VEACuQTCl7wSLB/IrcwPNUy4Dee2Px3jW
 EX7Ubb6OaFTzqLMFvPHhOZ66sVGJfD9oT+88aJ9jWAiw+e+87qrMxIcFhY+BdxfkzweqI7TKu
 OgjNwEdwoLf/I1c1FPtI+1HUVRY+633mrgAun9/BLEpg0K54MNDcqiWkksKrDvgGtHbAk6iNF
 yX5rwhRR+X5xtQ=
Received-SPF: pass client-ip=212.227.17.20;
 envelope-from=pierre.langlois@HIDDEN; helo=mout.gmx.net
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7,
 RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
Cc: 54239 <at> debbugs.gnu.org, guix-patches@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

--=-=-=
Content-Type: text/plain

Hi Julien,

Julien Lepiller <julien@HIDDEN> writes:

> * gnu/packages/llvm.scm (cross-llvm): New variable.

Do you really need to define a cross package for LLVM? In my experience
it was possible to use the same llvm libraries for native and cross
compilation. By default LLVM builds support for all supported targets
(provided they are not "experimental" IIRC).

Whereas for the clang package, at the moment it does have to be built
for a specific target IIUC. I hope that one day we could have the same
clang for native and cross compilation in Guix, but I don't think it can
work without some serious re-design of how cross-compilation works. I've
been trying to think about it but I don't yet have a good understanding
of it.

Thanks,
Pierre


--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQFMBAEBCgA2FiEEctU9gYy29KFyWDdMqPyeRH9PfVQFAmIiayUYHHBpZXJyZS5s
YW5nbG9pc0BnbXguY29tAAoJEKj8nkR/T31U24YH/1l7ln2fJnUtVun5qmCQlvJy
nbKnNQ7O+HibdMqivHT9b4eDOOTO1O8D6REU+uzjvb8qU0aIY45p+V6rYSP1GIe3
uCybteA+YTh4iPkbDrMu1RLXH+cYNG1HgxN+l4/K1t1L+Httnk1e6H7WQ/QD0R1Q
I26tSHczktvs7ZR5DLQYR8TP+r9fmYP7TQEI+3Gb62sy85JfEkS6aWH6NGZXSQMY
D36mSohSOhXdGb1PCBe8MiKVFH9eQt+DQ8NqMdYuXxGTozL0NagWeE73lz+QseJu
Pg/JiFtCn8AQ5nIvmWiTn6D+NFcoz425mTzuB84/S1bzm5WaZolCEvGNjQ8/FpI=
=bXNa
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 4 Mar 2022 10:00:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 04 05:00:10 2022
Received: from localhost ([127.0.0.1]:44585 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQ4jK-0000RD-1X
	for submit <at> debbugs.gnu.org; Fri, 04 Mar 2022 05:00:10 -0500
Received: from lepiller.eu ([89.234.186.109]:57144)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <julien@HIDDEN>) id 1nQ4jG-0000QJ-BF
 for 54239 <at> debbugs.gnu.org; Fri, 04 Mar 2022 05:00:07 -0500
Received: from lepiller.eu (localhost [127.0.0.1])
 by lepiller.eu (OpenSMTPD) with ESMTP id be79e21b
 for <54239 <at> debbugs.gnu.org>; Fri, 4 Mar 2022 09:59:59 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=from:to
 :subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding; s=dkim; bh=cDaVQ5qFosiBCFerjM/fph4i8
 2MVYBq2dhARAawzBSI=; b=JeBgmZSt8rmnVkQFMifaq7bRLy8fpTY237V4IkGJr
 PQvexNTBHZwDEz+v8kNs3auIyvifBk8OeuAZtvL1VWDqaCBr4EtJXyQDyQVTtIl9
 Q6SnBh4wG6dvEkO7jdgsd1awZb6GuIUA9Q1pwT7+l02k4JsxurTdLzNwm/PqNN/S
 5ZVoWFk/B8Kjf9+x6WcVHDxAqARnVELhK3FLoIBcc1TO/Smfpf0+ZYY39hiPkd2d
 ciaH2L4uyYgUP6uofpy3c3aSxnCFcFPHdhSBO5aLqyxuXY2jwK8fSx4nULu+CcaJ
 zGPp0lsx/R6mF8+RoiA/H9FhYKtevWPv4Xw3aRRtU9irQ==
Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id c8d25820
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <54239 <at> debbugs.gnu.org>;
 Fri, 4 Mar 2022 09:59:59 +0000 (UTC)
From: Julien Lepiller <julien@HIDDEN>
To: 54239 <at> debbugs.gnu.org
Subject: [PATCH v2 5/5] gnu: Add libcxxabi-9.
Date: Fri,  4 Mar 2022 10:59:53 +0100
Message-Id: <937fd2ca36d8368ea83be56ae29dbec1a97bfb41.1646387919.git.julien@HIDDEN>
X-Mailer: git-send-email 2.34.0
In-Reply-To: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
References: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 54239
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/packages/llvm.scm (libcxxabi-9): New variable.
(libcxxabi-6): Inherit from it.
---
 gnu/packages/llvm.scm | 69 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 51 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index e00e92aa8c..47fd8e2442 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1407,20 +1407,17 @@ (define-public libcxx-6
          "0rzw4qvxp6qx4l4h9amrq02gp7hbg8lw4m0sy3k60f50234gnm3n"))))
     (inputs (list llvm-6))))
 
-(define-public libcxxabi-6
+(define-public libcxxabi-9
   (package
     (name "libcxxabi")
-    (version "6.0.1")
+    (version (package-version clang-9))
     (source
      (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://github.com/llvm/llvm-project")
-             (commit (string-append "llvmorg-" version))))
-       (file-name (git-file-name name version))
+       (method url-fetch)
+       (uri (llvm-uri "libcxxabi" version))
        (sha256
         (base32
-         "0ki6796b5z08kh3a3rbysr5wwb2dkl6wal5dzd03i4li5xfkvx1g"))))
+         "1b4aiaa8cirx52vk2p5kfk57qmbqf1ipb4nqnjhdgqps9jm7iyg8"))))
     (build-system cmake-build-system)
     (arguments
      `(#:configure-flags
@@ -1431,8 +1428,6 @@ (define-public libcxxabi-6
              "-DCMAKE_CXX_COMPILER=clang++")
        #:phases
        (modify-phases (@ (guix build cmake-build-system) %standard-phases)
-         (add-after 'unpack 'chdir
-           (lambda _ (chdir "libcxxabi")))
          (add-after 'unpack 'adjust-CPLUS_INCLUDE_PATH
            (lambda* (#:key inputs native-inputs #:allow-other-keys)
              (define (delete* what lst)
@@ -1466,10 +1461,10 @@ (define-public libcxxabi-6
                                         (string-append gcc "/include/c++"))
                                   (string-split (getenv "CROSS_CPLUS_INCLUDE_PATH")
                                                 #\:)))
-                          ":"))
-                 (format #true
-                         "environment variable `CROSS_CPLUS_INCLUDE_PATH' changed to ~a~%"
-                         (getenv "CROSS_CPLUS_INCLUDE_PATH")))
+                          ":")))
+               (format #true
+                       "environment variable `CROSS_CPLUS_INCLUDE_PATH' changed to ~a~%"
+                       (getenv "CROSS_CPLUS_INCLUDE_PATH"))
                (format #true
                        "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
                        (getenv "CPLUS_INCLUDE_PATH")))))
@@ -1477,10 +1472,15 @@ (define-public libcxxabi-6
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((include-dir (string-append
                                  (assoc-ref outputs "out") "/include")))
-               (install-file "../libcxxabi/include/__cxxabi_config.h" include-dir)
-               (install-file "../libcxxabi/include/cxxabi.h" include-dir)))))))
-    (inputs (list llvm-6 libcxx-6))
-    (native-inputs (list (clang-for-target clang-6)))
+               (mkdir-p include-dir)
+               (install-file ,(string-append "../libcxxabi-" version
+                                             ".src/include/__cxxabi_config.h")
+                             include-dir)
+               (install-file ,(string-append "../libcxxabi-" version
+                                             ".src/include/cxxabi.h")
+                             include-dir)))))))
+    (inputs (list llvm-9 libcxx))
+    (native-inputs (list (clang-for-target clang-9)))
     (home-page "https://libcxxabi.llvm.org")
     (synopsis "C++ standard library support")
     (description
@@ -1488,6 +1488,39 @@ (define-public libcxxabi-6
 standard C++ library.")
     (license license:expat)))
 
+(define-public libcxxabi-6
+  (package
+    (inherit libcxxabi-9)
+    (name "libcxxabi")
+    (version "6.0.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/llvm/llvm-project")
+             (commit (string-append "llvmorg-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0ki6796b5z08kh3a3rbysr5wwb2dkl6wal5dzd03i4li5xfkvx1g"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments libcxxabi-9)
+      ((#:phases phases)
+       `(modify-phases ,phases
+          (add-after 'unpack 'chdir
+            (lambda _ (chdir "libcxxabi")))
+          (replace 'install-headers
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let ((include-dir (string-append
+                                  (assoc-ref outputs "out") "/include")))
+                (install-file "../libcxxabi/include/__cxxabi_config.h" include-dir)
+                (install-file "../libcxxabi/include/cxxabi.h" include-dir))))))))
+    (inputs (list llvm-6 libcxx-6))
+    (native-inputs
+     (list (if (%current-target-system)
+               (cross-clang (%current-target-system) #:clang clang-6)
+               clang-6)))))
+
 (define-public libcxx+libcxxabi-6
   (package
     (inherit libcxx-6)
-- 
2.34.0





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 4 Mar 2022 10:00:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 04 05:00:09 2022
Received: from localhost ([127.0.0.1]:44583 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQ4jI-0000Qy-Cb
	for submit <at> debbugs.gnu.org; Fri, 04 Mar 2022 05:00:08 -0500
Received: from lepiller.eu ([89.234.186.109]:57142)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <julien@HIDDEN>) id 1nQ4jF-0000PL-Hf
 for 54239 <at> debbugs.gnu.org; Fri, 04 Mar 2022 05:00:06 -0500
Received: from lepiller.eu (localhost [127.0.0.1])
 by lepiller.eu (OpenSMTPD) with ESMTP id b454ee32
 for <54239 <at> debbugs.gnu.org>; Fri, 4 Mar 2022 09:59:59 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=from:to
 :subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding; s=dkim; bh=lTsk3RKlb8edrTtw89uWpQoem
 cuyRAvUUnK6CRY+4Gg=; b=T8u+hLONipTZxs0iK5y80pnTj131OIPpOiZjDSq1H
 IM4Ozh0/lE9n3OaHUnlLUz/+0InvnzkDES5lq5awEFw1g2lj9qzMtVE8tpDX/5Bc
 NfrCEFYu3un4Tr8ytJBdjMcADcjvxmZwQqTMWyyk7pHC45HEUg8t7DhJ+R1H58cd
 SYSckzqI7LvZVkRKQI1ax6E66g4JitJaC6hOH/+pQlbizo5kVRK860x8GbXeeC6R
 8I2vm4onVR+hPzub7PzZ2H+gE218vRN/zPigdgnOyODZk2vwhJTsLfRBFYlslzo3
 33eiyF8GDImVG5P9kB5ojKFeg4QaH95+K+1gfUT4ztPNQ==
Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 36399f69
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <54239 <at> debbugs.gnu.org>;
 Fri, 4 Mar 2022 09:59:59 +0000 (UTC)
From: Julien Lepiller <julien@HIDDEN>
To: 54239 <at> debbugs.gnu.org
Subject: [PATCH v2 4/5] gnu: libcxxabi-6: Allow cross-compilation.
Date: Fri,  4 Mar 2022 10:59:52 +0100
Message-Id: <ca97a5ae910b7620ed135b05f993dcfdb7b415c0.1646387919.git.julien@HIDDEN>
X-Mailer: git-send-email 2.34.0
In-Reply-To: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
References: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 54239
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/packages/llvm.scm (libcxxabi-6)[native-inputs]: Use
clang-for-target for cross-compilation.  Move llvm and libcxx to...
[inputs]: ...here.
[arguments]<adjust-CPLUS_INCLUDE_PATH>: Also adjust
CROSS_CPLUS_INCLUDE_PATH when necessary.
---
 gnu/packages/llvm.scm | 40 ++++++++++++++++++++++++++++++++--------
 1 file changed, 32 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 137bc99f35..e00e92aa8c 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1433,19 +1433,43 @@ (define-public libcxxabi-6
        (modify-phases (@ (guix build cmake-build-system) %standard-phases)
          (add-after 'unpack 'chdir
            (lambda _ (chdir "libcxxabi")))
-         (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((gcc (assoc-ref inputs  "gcc")))
+         (add-after 'unpack 'adjust-CPLUS_INCLUDE_PATH
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (define (delete* what lst)
+               (if (null? what)
+                   lst
+                   (delete* (cdr what) (delete (car what) lst))))
+
+             (let ((gcc (or (assoc-ref inputs  "gcc") (assoc-ref native-inputs "gcc")))
+                   (cross-gcc (assoc-ref native-inputs "cross-gcc")))
                ;; Hide GCC's C++ headers so that they do not interfere with
                ;; the ones we are attempting to build.
                (setenv "CPLUS_INCLUDE_PATH"
                        (string-join
                         (cons (string-append
                                (assoc-ref inputs "libcxx") "/include/c++/v1")
-                              (delete (string-append gcc "/include/c++")
-                                      (string-split (getenv "CPLUS_INCLUDE_PATH")
-                                                    #\:)))
+                              (delete*
+                                `(,(string-append gcc "/include/c++")
+                                  ,@(if cross-gcc
+                                        `(,(string-append cross-gcc "/include/c++"))
+                                        '()))
+                                (string-split (getenv "CPLUS_INCLUDE_PATH")
+                                              #\:)))
                         ":"))
+               (when cross-gcc
+                 (setenv "CROSS_CPLUS_INCLUDE_PATH"
+                         (string-join
+                          (cons (string-append
+                                  (assoc-ref inputs "libcxx") "/include/c++/v1")
+                                (delete*
+                                  (list (string-append cross-gcc "/include/c++")
+                                        (string-append gcc "/include/c++"))
+                                  (string-split (getenv "CROSS_CPLUS_INCLUDE_PATH")
+                                                #\:)))
+                          ":"))
+                 (format #true
+                         "environment variable `CROSS_CPLUS_INCLUDE_PATH' changed to ~a~%"
+                         (getenv "CROSS_CPLUS_INCLUDE_PATH")))
                (format #true
                        "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
                        (getenv "CPLUS_INCLUDE_PATH")))))
@@ -1455,8 +1479,8 @@ (define-public libcxxabi-6
                                  (assoc-ref outputs "out") "/include")))
                (install-file "../libcxxabi/include/__cxxabi_config.h" include-dir)
                (install-file "../libcxxabi/include/cxxabi.h" include-dir)))))))
-    (native-inputs
-     (list clang-6 llvm-6 libcxx-6))
+    (inputs (list llvm-6 libcxx-6))
+    (native-inputs (list (clang-for-target clang-6)))
     (home-page "https://libcxxabi.llvm.org")
     (synopsis "C++ standard library support")
     (description
-- 
2.34.0





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 4 Mar 2022 10:00:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 04 05:00:08 2022
Received: from localhost ([127.0.0.1]:44581 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQ4jH-0000Qt-Va
	for submit <at> debbugs.gnu.org; Fri, 04 Mar 2022 05:00:08 -0500
Received: from lepiller.eu ([89.234.186.109]:57144)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <julien@HIDDEN>) id 1nQ4jE-0000QJ-UV
 for 54239 <at> debbugs.gnu.org; Fri, 04 Mar 2022 05:00:06 -0500
Received: from lepiller.eu (localhost [127.0.0.1])
 by lepiller.eu (OpenSMTPD) with ESMTP id b015369b
 for <54239 <at> debbugs.gnu.org>; Fri, 4 Mar 2022 09:59:59 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=from:to
 :subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding; s=dkim; bh=OKzAPpbDh5YvxgHF03P3RQFrr
 7hFsdKtqRYcyY8ZoXU=; b=Ko7y6iJFXL5HuonUU1sAdWIFeT1x0V7qdoytx9hBA
 LbZqX0E9lpM5PIr237XaWSSHfnjmffz4tnIhE5ax3P2zPKznRps8jFyEoJdLW88E
 GOFcBhitSuFqHbxHjanyLOZHMETVcLl6wCZ3I9uMcCouHdA79lDb/W/wiEiLVSkI
 w+vbiQfkz9elXsGosEX5B4HqOEz0sNxDRSejMa7M5Tp4M6Pdx7Bnazwtn8CScejl
 0B8aaLrWGMgDuM6c6cT22jV1sPrHs/wIdZoR+AFLURhcBxxfYQny2ZUae4zTLgVt
 UPMBAgLfUfdVHfORRFCG9gABrfP1/TKoF4v0mqMSJ2EGA==
Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 5c7d9264
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <54239 <at> debbugs.gnu.org>;
 Fri, 4 Mar 2022 09:59:59 +0000 (UTC)
From: Julien Lepiller <julien@HIDDEN>
To: 54239 <at> debbugs.gnu.org
Subject: [PATCH v2 3/5] gnu: libcxx: Allow cross-compilation.
Date: Fri,  4 Mar 2022 10:59:51 +0100
Message-Id: <4ed2af8f27dab19c56149a614b46f92fb3541ca7.1646387919.git.julien@HIDDEN>
X-Mailer: git-send-email 2.34.0
In-Reply-To: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
References: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 54239
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/packages/llvm.scm (libcxx)[native-inputs]: Move llvm to...
[inputs]: ...here.
[arguments]: adjust CROSS_INCLUDE_PATH when cross-compiling.
(libcxx-6)[native-inputs]: Move llvm to...
[inputs]: ...here.
---
 gnu/packages/llvm.scm | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index c277e2ac35..137bc99f35 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1362,8 +1362,9 @@ (define-public libcxx
      `(#:phases
        (modify-phases (@ (guix build cmake-build-system) %standard-phases)
          (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((gcc (assoc-ref inputs  "gcc")))
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (let ((gcc (or (assoc-ref (or native-inputs inputs) "gcc")))
+                   (cross-gcc (assoc-ref native-inputs "cross-gcc")))
                ;; Hide GCC's C++ headers so that they do not interfere with
                ;; the ones we are attempting to build.
                (setenv "CPLUS_INCLUDE_PATH"
@@ -1371,12 +1372,19 @@ (define-public libcxx
                                             (string-split (getenv "CPLUS_INCLUDE_PATH")
                                                           #\:))
                                     ":"))
+               (when cross-gcc
+                 (setenv "CROSS_CPLUS_INCLUDE_PATH"
+                         (string-join (delete (string-append cross-gcc "/include/c++")
+                                              (string-split (getenv "CPLUS_INCLUDE_PATH")
+                                                            #\:))
+                                      ":"))
+                 (format #t
+                         "environment variable `CROSS_CPLUS_INCLUDE_PATH' changed to ~a~%"
+                         (getenv "CROSS_CPLUS_INCLUDE_PATH")))
                (format #t
                        "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
-                       (getenv "CPLUS_INCLUDE_PATH"))
-               #t))))))
-    (native-inputs
-     (list clang llvm))
+                       (getenv "CPLUS_INCLUDE_PATH"))))))))
+    (inputs (list llvm-9))
     (home-page "https://libcxx.llvm.org")
     (synopsis "C++ standard library")
     (description
@@ -1397,8 +1405,7 @@ (define-public libcxx-6
        (sha256
         (base32
          "0rzw4qvxp6qx4l4h9amrq02gp7hbg8lw4m0sy3k60f50234gnm3n"))))
-    (native-inputs
-     (list clang-6 llvm-6))))
+    (inputs (list llvm-6))))
 
 (define-public libcxxabi-6
   (package
-- 
2.34.0





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 4 Mar 2022 10:00:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 04 05:00:07 2022
Received: from localhost ([127.0.0.1]:44579 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQ4jH-0000Qo-BW
	for submit <at> debbugs.gnu.org; Fri, 04 Mar 2022 05:00:07 -0500
Received: from lepiller.eu ([89.234.186.109]:57142)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <julien@HIDDEN>) id 1nQ4jE-0000PL-41
 for 54239 <at> debbugs.gnu.org; Fri, 04 Mar 2022 05:00:05 -0500
Received: from lepiller.eu (localhost [127.0.0.1])
 by lepiller.eu (OpenSMTPD) with ESMTP id 64568d06
 for <54239 <at> debbugs.gnu.org>; Fri, 4 Mar 2022 09:59:59 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=from:to
 :subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding; s=dkim; bh=yBmOCEU1YmvvTLfijKo92t8fX
 ULJtlb2X+yEeOKc0ZM=; b=C+Acf6O8pzcsaq9kY2ZoCJmTWCMXcwo3ot5ALUiVK
 mssXfYZ49IHk7m5DaC9biWaWlvfgBWf/gLqC0xEPOZIIsjj/dgkzRb8WQXWXDo3g
 yjvw9XLu1oFVneaeOAvCUUPHmo3odDZ/fOj8X/fymfzZu6GCCV0Z4BGa53F23lNQ
 O+0+VmqAXekZeRqKMe4271Xhm38Kx4bk4gjXyn8AuERQbCu34/GoYAio4vbYIBhf
 ja4VzecaZA0ZUFPWn3HnQgYAjJ8/a1qafmf1rMAm3LfENkRw8yI/brTp3nOpXbui
 qFITJjc/xYAtwQo0GlJYUbLLUq2gzZm5NJCA0ppn/CDAQ==
Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 53e2a10a
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <54239 <at> debbugs.gnu.org>;
 Fri, 4 Mar 2022 09:59:59 +0000 (UTC)
From: Julien Lepiller <julien@HIDDEN>
To: 54239 <at> debbugs.gnu.org
Subject: [PATCH v2 2/5] gnu: Add cross-clang.
Date: Fri,  4 Mar 2022 10:59:50 +0100
Message-Id: <de91f63243153229e558311bb91f688ca8e177fb.1646387919.git.julien@HIDDEN>
X-Mailer: git-send-email 2.34.0
In-Reply-To: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
References: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 54239
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/packages/llvm.scm (cross-clang): New variable.
---
 gnu/packages/llvm.scm | 144 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 143 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index d6e9846699..c277e2ac35 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -54,6 +54,7 @@ (define-module (gnu packages llvm)
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages cross-base)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages bootstrap)           ;glibc-dynamic-linker
   #:use-module (gnu packages check)               ;python-lit
@@ -75,7 +76,9 @@ (define-module (gnu packages llvm)
   #:use-module (ice-9 match)
   #:export (make-lld-wrapper
             system->llvm-target
-            cross-llvm))
+            cross-llvm
+            cross-clang
+            clang-for-target))
 
 (define* (system->llvm-target #:optional
                               (system (or (and=> (%current-target-system)
@@ -1023,6 +1026,145 @@ (define-public clang-runtime clang-runtime-13)
 (define-public clang clang-13)
 (define-public clang-toolchain clang-toolchain-13)
 
+(define* (cross-clang target
+                      #:key
+                      (libc (cross-libc target))
+                      (xgcc (cross-gcc target
+                              #:xbinutils (cross-binutils target)
+                              #:libc (cross-libc target)))
+                      (clang clang))
+  "Return a cross-clang compiler for target."
+  (define cross-clang-aux
+    (mlambda (target libc xgcc clang)
+      (package
+        (inherit clang)
+        (name (string-append "clang-cross-" target))
+        (version (package-version clang))
+        ;; Support the same variables as clang, even in cross-compilation context.
+        ;; Clang does not make a difference between native and cross-compilation.
+        (search-paths
+          (list
+            (search-path-specification
+              (variable "CROSS_LIBRARY_PATH")
+              (files '("lib")))
+            (search-path-specification
+              (variable "CROSS_C_INCLUDE_PATH")
+              (files '("include")))
+            (search-path-specification
+              (variable "CROSS_CPLUS_INCLUDE_PATH")
+              (files '("include/c++" "include")))))
+        (native-search-paths '())
+        (arguments
+         (substitute-keyword-arguments (package-arguments clang)
+           ((#:configure-flags _)
+            `(list "-DCLANG_INCLUDE_TESTS=True"
+                   (string-append "-DGCC_INSTALL_PREFIX="
+                                  (assoc-ref %build-inputs "cross-gcc-lib"))
+                   (string-append "-DC_INCLUDE_DIRS="
+                                  (assoc-ref %build-inputs "target-libc")
+                                  "/include")))
+           ((#:phases phases)
+            `(modify-phases ,phases
+               (add-after 'unpack 'add-missing-libdir
+                 (lambda _
+                   ;; cross-gcc installs its libraries in <target>/lib instead of
+                   ;; lib.
+                   (substitute* "lib/Driver/ToolChain.cpp"
+                     (("\"-L\"\\) \\+ LibPath\\)\\);")
+                      ,(string-append "\"-L\") + LibPath));
+  CmdArgs.push_back(Args.MakeArgString(StringRef(\"-L\") + "
+                                     "StringRef(GCC_INSTALL_PREFIX) + StringRef(\"/"
+                                     target "/lib\")));
+  CmdArgs.push_back(Args.MakeArgString(StringRef(\"-rpath=\") + "
+                                     "StringRef(GCC_INSTALL_PREFIX) + StringRef(\"/"
+                                     target "/lib\")));")))))
+               (add-after 'unpack 'support-cross-include-path
+                 (lambda _
+                   (substitute* "lib/Driver/ToolChains/Clang.cpp"
+                     (("C_INCLUDE_PATH") "CROSS_C_INCLUDE_PATH")
+                     (("CPLUS_INCLUDE_PATH") "CROSS_CPLUS_INCLUDE_PATH"))))
+               (add-after 'unpack 'support-cross-library-path
+                 (lambda _
+                   ;; LIBRARY_PATH is only supported for native builds, but we still
+                   ;; need it (or CROSS_LIBRARY_PATH to be precise) when
+                   ;; cross-compiling
+                   (substitute* "lib/Driver/ToolChains/CommonArgs.cpp"
+                     (("LIBRARY_PATH\"")
+                      "LIBRARY_PATH\");
+  } else {
+    addDirectoryList(Args, CmdArgs, \"-L\", \"CROSS_LIBRARY_PATH\""))))
+               (replace 'set-glibc-file-names
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   (let ((libc (assoc-ref inputs "target-libc"))
+                         (compiler-rt (assoc-ref inputs "clang-runtime"))
+                         (gcc (assoc-ref inputs "cross-gcc")))
+                     (setenv "LIBRARY_PATH"
+                             (string-append
+                               (assoc-ref inputs "libc") "/lib:" (getenv "LIBRARY_PATH")))
+                     ,@(cond
+                        ((version>=? version "6.0")
+                         `(;; Link to libclang_rt files from clang-runtime.
+                           (substitute* "lib/Driver/ToolChain.cpp"
+                             (("getDriver\\(\\)\\.ResourceDir")
+                              (string-append "\"" compiler-rt "\"")))
+
+                           ;; Make "LibDir" refer to <glibc>/lib so that it
+                           ;; uses the right dynamic linker file name.
+                           (substitute* "lib/Driver/ToolChains/Linux.cpp"
+                             (("(^[[:blank:]]+LibDir = ).*" _ declaration)
+                              (string-append declaration "\"" libc "/lib\";\n"))
+
+                             ;; Make clang look for libstdc++ in the right
+                             ;; location.
+                             (("LibStdCXXIncludePathCandidates\\[\\] = \\{")
+                              (string-append
+                               "LibStdCXXIncludePathCandidates[] = { \"" gcc
+                               "/include/c++\","))
+
+                             ;; Make sure libc's libdir is on the search path, to
+                             ;; allow crt1.o & co. to be found.
+                             (("@GLIBC_LIBDIR@")
+                              (string-append libc "/lib")))))
+                        (else
+                         `((substitute* "lib/Driver/Tools.cpp"
+                             ;; Patch the 'getLinuxDynamicLinker' function so that
+                             ;; it uses the right dynamic linker file name.
+                             (("/lib64/ld-linux-x86-64.so.2")
+                              (string-append libc ,(glibc-dynamic-linker))))
+
+                           ;; Link to libclang_rt files from clang-runtime.
+                           ;; This substitution needed slight adjustment in 3.8.
+                           ,@(if (version>=? version "3.8")
+                                 '((substitute* "lib/Driver/Tools.cpp"
+                                     (("TC\\.getDriver\\(\\)\\.ResourceDir")
+                                      (string-append "\"" compiler-rt "\""))))
+                                 '((substitute* "lib/Driver/ToolChain.cpp"
+                                     (("getDriver\\(\\)\\.ResourceDir")
+                                      (string-append "\"" compiler-rt "\"")))))
+
+                           ;; Make sure libc's libdir is on the search path, to
+                           ;; allow crt1.o & co. to be found.
+                           (substitute* "lib/Driver/ToolChains.cpp"
+                             (("@GLIBC_LIBDIR@")
+                              (string-append libc "/lib")))))))))))))
+        (inputs
+         `(("target-libc" ,libc)
+           ("cross-gcc-lib" ,xgcc "lib")
+           ("cross-gcc" ,xgcc)
+           ,@(package-inputs clang)))
+        (propagated-inputs
+          (modify-inputs (package-propagated-inputs clang)
+            (replace "llvm"
+              (cross-llvm
+                (car (assoc-ref (package-propagated-inputs clang) "llvm"))
+                target)))))))
+  (cross-clang-aux target libc xgcc clang))
+
+(define* (clang-for-target #:optional (clang clang))
+  (if (%current-target-system)
+      (cross-clang (%current-target-system) #:clang clang)
+      clang))
+
 (define-public llvm-for-rocm
   (package
     ;; Actually based on LLVM 13 as of v4.3, but llvm-12 works just fine.
-- 
2.34.0





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 4 Mar 2022 10:00:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 04 05:00:06 2022
Received: from localhost ([127.0.0.1]:44574 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nQ4jF-0000QK-0f
	for submit <at> debbugs.gnu.org; Fri, 04 Mar 2022 05:00:06 -0500
Received: from lepiller.eu ([89.234.186.109]:57142)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <julien@HIDDEN>) id 1nQ4jB-0000PL-I7
 for 54239 <at> debbugs.gnu.org; Fri, 04 Mar 2022 05:00:03 -0500
Received: from lepiller.eu (localhost [127.0.0.1])
 by lepiller.eu (OpenSMTPD) with ESMTP id 0c521cff
 for <54239 <at> debbugs.gnu.org>; Fri, 4 Mar 2022 09:59:59 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=from:to
 :subject:date:message-id:mime-version:content-type
 :content-transfer-encoding; s=dkim; bh=PVbHQsUpe7ZCSCXqtXYm4YfVJ
 4XJ1fuE4mRuGe9Iu+g=; b=Dv6g1l0UWQd4camKeeVi6NlhP41tDoT0AMZov2zlu
 fozSRTuFd4nnptLTRce0125OZg9yqCZ3J964etacbU/XUICD2uk6qQYWL+B9FUuL
 N7C/fChF81h9knn1Mp56zVh2IGslv6os2Znd0WSXPtNXs/YXph9JcTiSDqdGeoXW
 9kZ64+41X9Bz/AU6H1CAs3Y1CD0pNd2qXrtAbqZFvJf97bq5QWID9Y9CO5UZRn7k
 5Cqdr8IcDCN41M1qPJWeGx74etjcm27iqDtCzTMncyMX+nIzzBdO/b3dBB+TkUz1
 Y4hlqBfduMJvYr9DMnowMeauzvfkpo3wu2LV3nEHiGtbw==
Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id b8e65455
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <54239 <at> debbugs.gnu.org>;
 Fri, 4 Mar 2022 09:59:59 +0000 (UTC)
From: Julien Lepiller <julien@HIDDEN>
To: 54239 <at> debbugs.gnu.org
Subject: [PATCH v2 1/5] gnu: Add cross-llvm.
Date: Fri,  4 Mar 2022 10:59:49 +0100
Message-Id: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646387919.git.julien@HIDDEN>
X-Mailer: git-send-email 2.34.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 54239
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/packages/llvm.scm (cross-llvm): New variable.
---
 gnu/packages/llvm.scm | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index eb949bed1b..d6e9846699 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -18,7 +18,7 @@
 ;;; Copyright © 2020 Jakub Kądziołka <kuba@HIDDEN>
 ;;; Copyright © 2021 Maxime Devos <maximedevos@HIDDEN>
 ;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
-;;; Copyright © 2021 Julien Lepiller <julien@HIDDEN>
+;;; Copyright © 2021, 2022 Julien Lepiller <julien@HIDDEN>
 ;;; Copyright © 2021 Lars-Dominik Braun <lars@HIDDEN>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@HIDDEN>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
@@ -74,7 +74,8 @@ (define-module (gnu packages llvm)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match)
   #:export (make-lld-wrapper
-            system->llvm-target))
+            system->llvm-target
+            cross-llvm))
 
 (define* (system->llvm-target #:optional
                               (system (or (and=> (%current-target-system)
@@ -99,6 +100,22 @@ (define* (system->llvm-target #:optional
              ("i686"        => "X86")
              ("i586"        => "X86"))))
 
+(define (cross-llvm llvm target)
+  "Return a native LLVM package that targets a different system.  The resulting
+libraries are running on the host but target a different system by default.
+This packge can be used to control clang's default target."
+  (package
+    (inherit llvm)
+    (arguments
+     (substitute-keyword-arguments (package-arguments llvm)
+      ((#:configure-flags flags)
+       #~(append
+           (list
+             (string-append "-DLLVM_DEFAULT_TARGET_TRIPLE=" #$target)
+             (string-append "-DLLVM_TARGET_ARCH="
+                            #$(system->llvm-target (gnu-triplet->nix-system target))))
+           #$flags))))))
+
 (define (llvm-uri component version)
   ;; LLVM release candidate file names are formatted 'tool-A.B.C-rcN/tool-A.B.CrcN.src.tar.xz'
   ;; so we specify the version as A.B.C-rcN and delete the hyphen when referencing the file name.
-- 
2.34.0





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 3 Mar 2022 21:20:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 03 16:20:53 2022
Received: from localhost ([127.0.0.1]:43958 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nPssX-0002Pb-5C
	for submit <at> debbugs.gnu.org; Thu, 03 Mar 2022 16:20:53 -0500
Received: from lepiller.eu ([89.234.186.109]:57082)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <julien@HIDDEN>) id 1nPssV-0002PT-A8
 for 54239 <at> debbugs.gnu.org; Thu, 03 Mar 2022 16:20:52 -0500
Received: from lepiller.eu (localhost [127.0.0.1])
 by lepiller.eu (OpenSMTPD) with ESMTP id a29708a3;
 Thu, 3 Mar 2022 21:20:49 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from
 :to:cc:subject:in-reply-to:references:message-id:mime-version
 :content-type:content-transfer-encoding; s=dkim; bh=ZB/jQpBznI+X
 d5dFBgODJFdnv1vDWNQFCxk2gjhRU5c=; b=YbULnIjYBGvkIXwvJDInan1QrAcJ
 WbD9k8+G1jk6hLteIGDz6hoTfeLLWvxL2W6XJluV+EN5zt8/pqrVeIGO5FPwE1zn
 h2tMO9VAGOlDPBcftiLMJArQ713lqOsR7tKt1FIDXaDoHG+cKCGiry2fg5uhPdAg
 up0Nrp4HVsvZYnapcAM4RqN0RXM5nCehGkRXXeguG+ngB1tCa4O/olMskR8LDtiT
 LtxfS+2H1XrGJubB/kXuUSvs9nt16/kHrfv5WifkSGBQY7PVJNHs9uZ5t6anpCL4
 gQsEDm28EyBS2WXV3Q+no7UhtRU4xzCiXYGPHQmN7kEe/DtnRIlsnXxtrg==
Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 404d70d0
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); 
 Thu, 3 Mar 2022 21:20:48 +0000 (UTC)
Date: Thu, 03 Mar 2022 22:20:45 +0100
From: Julien Lepiller <julien@HIDDEN>
To: Pierre Langlois <pierre.langlois@HIDDEN>
Subject: Re: [bug#54239] [PATCH] gnu: Add cross-clang.
User-Agent: K-9 Mail for Android
In-Reply-To: <87wnhapwsv.fsf@HIDDEN>
References: <20220303170252.3caec0a6@HIDDEN>
 <87wnhapwsv.fsf@HIDDEN>
Message-ID: <DB89C0F9-4C86-4412-98C6-250CF6813B8B@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary=----3KSS5RQVUTGPNXJNNC65RQ8SNWF588
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 54239
Cc: 54239 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

------3KSS5RQVUTGPNXJNNC65RQ8SNWF588
Content-Type: text/plain;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable

Oh wow!

I need clang for Android: it's only tested and built with clang, and some =
of the packages don't build with gcc=2E I don't really need any fancy targe=
t, but one of the goals I had was to be able to cross-build my android pack=
ages, hence this cross-compiler=2E

A wasm cross-compiler would be awesome!

On March 3, 2022 9:51:01 PM GMT+01:00, Pierre Langlois <pierre=2Elanglois@=
gmx=2Ecom> wrote:
>Hi Julien,
>
>Julien Lepiller <julien@lepiller=2Eeu> writes:
>
>> Hi Guix!
>>
>> This small patch series adds cross-clang, a cross-compiler version of
>> clang=2E Clang doesn't really make a distinction between a native and a
>> cross-build, it is already a cross-compiler, but this ensures that:
>>
>> 1=2E it actually works
>> 2=2E it targets (%current-target-architecture) by default
>>
>> The rest of the series ensures that libcxx and libcxxabi can be
>> cross-compiled with it=2E
>
>That's really cool! Out of curiosity, what target are you interested in
>that clang supports and GCC doesn't?  For instance I'm interested in
>WebAssembly, and I've actually been contemplating how we could improve
>support for cross-compilers based on Clang in Guix, to be able to
>provide a working WebAssembly toolchain=2E
>
>For context, such a toolchain will be needed to enable potential use of
>WebAssembly in IceCat, for security purposes, see
>https://hacks=2Emozilla=2Eorg/2021/12/webassembly-and-back-again-fine-gra=
ined-sandboxing-in-firefox-95/
>
>I actually have a toolchain that works already, which targets the
>wasm32-wasi-unknown triplet, but I wasn't convinced the way I did it was
>the right way to go long term, so it needs more work=2E  I'm attaching th=
e
>patch in case there's anything useful to you in there already!
>
>The approach I took was to create wrappers around clang/clang++ in order
>to set the correct include paths, and then provide an isolated sysroot
>for wasm32-wasi using union-build=2E This will work for IceCat, where
>their should be a flag to pass a sysroot path, but we should be able to
>do better in Guix=2E
>
>I though I'd share in case that's helpful! I'll take a look at your
>patches to see if I can build on top of them for a future WebAssembly
>toolchain in Guix=2E
>
>Thanks,
>Pierre
>

------3KSS5RQVUTGPNXJNNC65RQ8SNWF588
Content-Type: text/html;
 charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html><head></head><body>Oh wow!<br><br>I need clang for Android: it's only=
 tested and built with clang, and some of the packages don't build with gcc=
=2E I don't really need any fancy target, but one of the goals I had was to=
 be able to cross-build my android packages, hence this cross-compiler=2E<b=
r><br>A wasm cross-compiler would be awesome!<br><br><div class=3D"gmail_qu=
ote">On March 3, 2022 9:51:01 PM GMT+01:00, Pierre Langlois &lt;pierre=2Ela=
nglois@gmx=2Ecom&gt; wrote:<blockquote class=3D"gmail_quote" style=3D"margi=
n: 0pt 0pt 0pt 0=2E8ex; border-left: 1px solid rgb(204, 204, 204); padding-=
left: 1ex;">
<pre dir=3D"auto" class=3D"k9mail">Hi Julien,<br><br>Julien Lepiller &lt;j=
ulien@lepiller=2Eeu&gt; writes:<br><br><blockquote class=3D"gmail_quote" st=
yle=3D"margin: 0pt 0pt 1ex 0=2E8ex; border-left: 1px solid #729fcf; padding=
-left: 1ex;"> Hi Guix!<br><br> This small patch series adds cross-clang, a =
cross-compiler version of<br> clang=2E Clang doesn't really make a distinct=
ion between a native and a<br> cross-build, it is already a cross-compiler,=
 but this ensures that:<br><br> 1=2E it actually works<br> 2=2E it targets =
(%current-target-architecture) by default<br><br> The rest of the series en=
sures that libcxx and libcxxabi can be<br> cross-compiled with it=2E<br></b=
lockquote><br>That's really cool! Out of curiosity, what target are you int=
erested in<br>that clang supports and GCC doesn't?  For instance I'm intere=
sted in<br>WebAssembly, and I've actually been contemplating how we could i=
mprove<br>support for cross-compilers based on Clang in Guix, to be able to=
<br>provide a working WebAssembly toolchain=2E<br><br>For context, such a t=
oolchain will be needed to enable potential use of<br>WebAssembly in IceCat=
, for security purposes, see<br><a href=3D"https://hacks=2Emozilla=2Eorg/20=
21/12/webassembly-and-back-again-fine-grained-sandboxing-in-firefox-95/">ht=
tps://hacks=2Emozilla=2Eorg/2021/12/webassembly-and-back-again-fine-grained=
-sandboxing-in-firefox-95/</a><br><br>I actually have a toolchain that work=
s already, which targets the<br>wasm32-wasi-unknown triplet, but I wasn't c=
onvinced the way I did it was<br>the right way to go long term, so it needs=
 more work=2E  I'm attaching the<br>patch in case there's anything useful t=
o you in there already!<br><br>The approach I took was to create wrappers a=
round clang/clang++ in order<br>to set the correct include paths, and then =
provide an isolated sysroot<br>for wasm32-wasi using union-build=2E This wi=
ll work for IceCat, where<br>their should be a flag to pass a sysroot path,=
 but we should be able to<br>do better in Guix=2E<br><br>I though I'd share=
 in case that's helpful! I'll take a look at your<br>patches to see if I ca=
n build on top of them for a future WebAssembly<br>toolchain in Guix=2E<br>=
<br>Thanks,<br>Pierre<br><br></pre></blockquote></div></body></html>
------3KSS5RQVUTGPNXJNNC65RQ8SNWF588--




Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 3 Mar 2022 21:11:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 03 16:11:44 2022
Received: from localhost ([127.0.0.1]:43912 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nPsjg-00027K-3k
	for submit <at> debbugs.gnu.org; Thu, 03 Mar 2022 16:11:44 -0500
Received: from lepiller.eu ([89.234.186.109]:57074)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <julien@HIDDEN>) id 1nPsjd-00026v-MU
 for 54239 <at> debbugs.gnu.org; Thu, 03 Mar 2022 16:11:42 -0500
Received: from lepiller.eu (localhost [127.0.0.1])
 by lepiller.eu (OpenSMTPD) with ESMTP id 4b66e3a0;
 Thu, 3 Mar 2022 21:11:39 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from
 :to:cc:subject:message-id:in-reply-to:references:mime-version
 :content-type:content-transfer-encoding; s=dkim; bh=SqngmiwCVXFp
 JFqpmjqICtnd+67Qw98hbBDRQbGQOpU=; b=n+HsdfL0aP1OOe9FpWZ60lOQ7m1b
 BH1viaW1kyiXm3b0yRC4DVeuxVpa1lOpid4yl5erjqVAALDArC/DGNw+GjcZUl0K
 35z5GqCz3/qwFhOcMhttN3neSNB0bKnu/oxWr3TkAPGDz89sf+xD+e+kU6Pjwjr4
 E84tolxBr0E0FCW/0g1Lgv8Yn99/mfIeZoq+pyQ7lsx4NTeY4ThGOgqsBZzm9nK2
 8cZFz+zutaSPRcjPyYMedhjoaGUtv6MvQ49rsMHcNx+XUDq3H2/Lpd3tvrcjxl1+
 +RArwjy6I0dbiKfIWiORgldbXjRiitk+k4a+bbCbzHcodCid3md9tUb5sg==
Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 14e7f955
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); 
 Thu, 3 Mar 2022 21:11:39 +0000 (UTC)
Date: Thu, 3 Mar 2022 22:11:36 +0100
From: Julien Lepiller <julien@HIDDEN>
To: Maxime Devos <maximedevos@HIDDEN>
Subject: Re: [bug#54239] [PATCH] gnu: Add cross-clang.
Message-ID: <20220303221136.5c131ada@HIDDEN>
In-Reply-To: <9cd9c6e72b5c3e2b32544fbcb46f14b2b52247b0.camel@HIDDEN>
References: <20220303170252.3caec0a6@HIDDEN>
 <70c3446488f9b76479f4f989c351403c461369d1.camel@HIDDEN>
 <20220303193503.4c055cec@HIDDEN>
 <9cd9c6e72b5c3e2b32544fbcb46f14b2b52247b0.camel@HIDDEN>
X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 54239
Cc: 54239 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Le Thu, 03 Mar 2022 19:59:17 +0100,
Maxime Devos <maximedevos@HIDDEN> a =C3=A9crit :

> Julien Lepiller schreef op do 03-03-2022 om 19:35 [+0100]:
> > >=20
> > > 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)? =20
> >=20
> > I don't know how to do that. Are there some examples around? =20
>=20
> Search for 'cross-pkg-config' and 'standard-cross-packages'.
>=20
> Greetings,
> Maxime.

Thanks! I used mlambda, I think it should work :)

So I tried renaming clang to <target>-clang, but then I noticed the
build of libcxxabi fails:

-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
CMake Error at CMakeLists.txt:21 (project):
  The CMAKE_CXX_COMPILER:

    clang++

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the
  environment variable "CXX" or the CMake cache entry
  CMAKE_CXX_COMPILER to the full path to the compiler, or to the
  compiler name if it is in the PATH.


This is because it really expects clang, not <target>-clang. The
autotools might be smarter (haven't tested), but they're the only one.
I don't want to substitute* every CMakeList.txt to make sure they
understand what we're the only ones to do.

Furthermore, clang is already a cross-compiler, and cross-clang only
makes it work in the context of guix packaging and changes the default
target for convenience. Outside of a guix package, although not very
convenient, our clang package already works like everyone else's I
think. I don't think it makes sense to have clang AND i586-gnu-clang in
your profile. Also, cross-clang just like cross-gcc is not accessible
from the CLI.

WDYT?




Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 3 Mar 2022 21:10:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 03 16:10:26 2022
Received: from localhost ([127.0.0.1]:43892 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nPsiK-00023t-6r
	for submit <at> debbugs.gnu.org; Thu, 03 Mar 2022 16:10:26 -0500
Received: from mout.gmx.net ([212.227.17.21]:56093)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pierre.langlois@HIDDEN>) id 1nPsiH-00023S-Cm
 for 54239 <at> debbugs.gnu.org; Thu, 03 Mar 2022 16:10:18 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1646341810;
 bh=A3h/i7g3fTL6GeH4Li9OT860R1SuGZFyC46oCKUTsrA=;
 h=X-UI-Sender-Class:References:From:To:Cc:Subject:Date:In-reply-to;
 b=QjOpL3nsmEIMc3/qb6szXLMT3GBOt/POZwWeA2lHdE0jYUG6qJA5Aquz4FiUVgBTU
 o4pSwN+HzIhn+jYpJWKg266+wR5imQWjZvMF7BbgGPnxtZwhp5mPvDQGc0z9Vk31ZR
 bYKNJ3TnGoyUQxEmlpplioGfy3UVQYfoOxRoM2ro=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from labiere ([82.69.64.142]) by mail.gmx.net (mrgmx105
 [212.227.17.174]) with ESMTPSA (Nemesis) id 1M6UZl-1nWDQu3DSr-006tGk; Thu, 03
 Mar 2022 22:10:09 +0100
References: <20220303170252.3caec0a6@HIDDEN>
User-agent: mu4e 1.6.10; emacs 27.2
From: Pierre Langlois <pierre.langlois@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>
Subject: Re: [bug#54239] [PATCH] gnu: Add cross-clang.
Date: Thu, 03 Mar 2022 20:51:01 +0000
In-reply-to: <20220303170252.3caec0a6@HIDDEN>
Message-ID: <87wnhapwsv.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Provags-ID: V03:K1:dOXLhE0fwPx7IHgpjFUrPGux+9f0bmUkEn4FBUhKr/vtc5cd/T2
 5rKVkAk6PVNormqNegDHLUmf327VFJHOmrYBf+HzjoCFT634cnlrPDNoCAJXPvppnr4m5Cw
 D2z7ropFMf4h0/Wk62zBJ4gnGOUnUJFoBuG+JsuKT8ZbBDZDU9iUXCyJLAC07rJxYz9WmgT
 0ppk4j2q7rKmyPTjE+KUg==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:7etvm6vpeos=:I3Zyb+dLrONjCvowdXMLNU
 //leLhafC0Tf4s3rwXfnkq4WXsAziGLJqNVJ5W/0/qmvKmdZUQhSyIpkxlmGBLenqNm/tS6i6
 0mErjmNBP7bslZ70GpsRhyaoEPiUZ6HjwgtTBZE/ef5bNIO+J4LGwicxyxbzzIOAXwZLmU67O
 ozKJ+1mHw59yVPkab3zM9EjV0uD2+ToBEO7blL8XvOvennEpxzhBvKVgEHnXcI2pov6QSeBFM
 a81KBr4iSxPgYhMeImkUErKATYlXNgStGySqEn+9iBeJsLRyH4EusA3OcxNm0hLd2yQjNqMLC
 BdA8B7+ZxRzhkyEzii71aTsmZd0dRu8B9fKECLEaIh2tGX2O9HF45X/DNGBfOslRH3JXs2d40
 BoSwNfFOh7qLBzPKuwWb5zmWwWW8AFs/tn8+KQ635/KBIZMCy1BvKkt5DrFkP7mhIS9MGNN88
 /euE9OQ3CHstQ/Cm4IZ4zuu5/ySKQKx4G9pernaG/vPoT5Gq8to2js91QLlKm7pmkeZnu2L0k
 JMK4CyDt349HMuysdK61WnEKwebH5TQnJi1lYTC9j4rfX+YbsNfR8f0lQGIc41rCIKQdKXLIp
 UKT91vxLOtzXjiw3V7yFCzi6jFrmHyOEdjitbfzOElfswxKfi2Gi9JE/i3NMnT57gIleDM3Ls
 EDDJODmyjmb/gTQoISrxs0VrSrxsWpgAQnS7TdDrbOpzGBAoMdVB+5Zz3HPkd4PUcowTIhbab
 BXH31aIg9AaZDCZjylLbrgp3FqlKmLXJJtne2l9SOkYsjHyRUz0zKSbxEGeZVDUcg6AeEd/er
 EgqIX/lHnEVwAzAu8CRzAPU/0SHLhSowqltWozjx45M9ViMVRksIqa3NEbcR65IXVBKlSiS1v
 ZsgkAS0vKMw7cxrdPutW/5/kQKPytcIspEPf02W9L3Yu8XsFc6A1W4BF/Y29RlUeXyrZUD5HC
 FTB7zlw2ZawNFa3imxRmCXPuHVTDUGCH36vfYHtJymVCTORfcM0ZJTIhyD/N7RF+F6B4BPaTJ
 S7FHspaBIMR52oevpMh3F3m/HZxuK5TOlgwDRhVd6ZNl0flsCNtLYKHJpXb2jQUE+evQpTjHr
 +YSceKolQkBZe8=
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 54239
Cc: 54239 <at> debbugs.gnu.org, guix-patches@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: multipart/signed; boundary="==-=-=";
	micalg=pgp-sha512; protocol="application/pgp-signature"

--==-=-=
Content-Type: text/plain

Hi Julien,

Julien Lepiller <julien@HIDDEN> writes:

> Hi Guix!
>
> 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:
>
> 1. it actually works
> 2. it targets (%current-target-architecture) by default
>
> The rest of the series ensures that libcxx and libcxxabi can be
> cross-compiled with it.

That's really cool! Out of curiosity, what target are you interested in
that clang supports and GCC doesn't?  For instance I'm interested in
WebAssembly, and I've actually been contemplating how we could improve
support for cross-compilers based on Clang in Guix, to be able to
provide a working WebAssembly toolchain.

For context, such a toolchain will be needed to enable potential use of
WebAssembly in IceCat, for security purposes, see
https://hacks.mozilla.org/2021/12/webassembly-and-back-again-fine-grained-sandboxing-in-firefox-95/

I actually have a toolchain that works already, which targets the
wasm32-wasi-unknown triplet, but I wasn't convinced the way I did it was
the right way to go long term, so it needs more work.  I'm attaching the
patch in case there's anything useful to you in there already!

The approach I took was to create wrappers around clang/clang++ in order
to set the correct include paths, and then provide an isolated sysroot
for wasm32-wasi using union-build. This will work for IceCat, where
their should be a flag to pass a sysroot path, but we should be able to
do better in Guix.

I though I'd share in case that's helpful! I'll take a look at your
patches to see if I can build on top of them for a future WebAssembly
toolchain in Guix.

Thanks,
Pierre


--==-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQFMBAEBCgA2FiEEctU9gYy29KFyWDdMqPyeRH9PfVQFAmIhLrAYHHBpZXJyZS5s
YW5nbG9pc0BnbXguY29tAAoJEKj8nkR/T31UR/YH/iEDqu/yeDZsPwvQfLNRk16h
Vs9BtkqAtHl5SLiDdC6BBaGTiJ814rE8gmHeJ5CuLo9YxOMFpYbo8MJi4DfhQr1r
cbBAy0cUJMRfDV963dJyA0HM1C9eUCzLZKnCNviYLdp11ZYsX0YlP6j6unUhac7t
gfsGa95zN/EhYZ2dSRiCpsH/WU6n36GrWkNQcQzlqgUzcFEKFvrkDOIiXpzdAb7L
8/kskeRh4mzJYiMNGrcnH1010okpPUyuOuW/aRRea34teFrwg45ogikenUEh5wRx
7kzKCagWgjvpK7XLappPi8stmNfJ5RV9OWWtjNnKKLixvM2an8+Cc/HlbZNERFQ=
=qGo9
-----END PGP SIGNATURE-----
--==-=-=--

--=-=-=
Content-Type: text/x-patch; charset=utf-8
Content-Disposition: inline;
 filename=0001-gnu-Add-wasm32-wasi-clang-toolchain.patch
Content-Transfer-Encoding: quoted-printable

From 7d3c2a54ad66d5c4b2aa96eb946537fac1a5ae75 Mon Sep 17 00:00:00 2001
From: Pierre Langlois <pierre.langlois@HIDDEN>
Date: Sun, 16 Jan 2022 16:55:59 +0000
Subject: [PATCH] gnu: Add wasm32-wasi-clang-toolchain.

WIP
---
 gnu/local.mk          |   1 +
 gnu/packages/llvm.scm |   1 +
 gnu/packages/wasm.scm | 273 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 275 insertions(+)
 create mode 100644 gnu/packages/wasm.scm

diff --git a/gnu/local.mk b/gnu/local.mk
index b7339ff472..952786827f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -603,6 +603,7 @@ GNU_SYSTEM_MODULES =3D				\
   %D%/packages/vpn.scm				\
   %D%/packages/vulkan.scm			\
   %D%/packages/w3m.scm				\
+  %D%/packages/wasm.scm			\
   %D%/packages/wdiff.scm			\
   %D%/packages/web.scm				\
   %D%/packages/web-browsers.scm			\
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index eb949bed1b..8821b2b6a7 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -74,6 +74,7 @@ (define-module (gnu packages llvm)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match)
   #:export (make-lld-wrapper
+            clang-from-llvm
             system->llvm-target))
=20
 (define* (system->llvm-target #:optional
diff --git a/gnu/packages/wasm.scm b/gnu/packages/wasm.scm
new file mode 100644
index 0000000000..f9f73505ef
--- /dev/null
+++ b/gnu/packages/wasm.scm
@@ -0,0 +1,273 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright =C2=A9 2021 Pierre Langlois <pierre.langlois@HIDDEN>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages wasm)
+  #:use-module (guix gexp)
+  #:use-module (guix packages)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix download)
+  #:use-module (guix git-download)
+  #:use-module (guix utils)
+  #:use-module (guix build-system cmake)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system trivial)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages llvm)
+  #:use-module (gnu packages python))
+
+(define-public wasi-libc
+  (let ((commit "ad5133410f66b93a2381db5b542aad5e0964db96")
+        (revision "1"))
+    (package
+      (name "wasi-libc")
+      (version (git-version "0.1-alpha" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/WebAssembly/wasi-libc")
+                      (commit commit)
+                      (recursive? #t)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "146jamq2q24vxjfpcwlqj84wzc80cbpbg0ns2wimyvzbanah48j6"))=
))
+      (build-system gnu-build-system)
+      (native-inputs (list clang-13))
+      (arguments
+       (list #:tests? #f ;No test suite
+             #:phases
+             #~(modify-phases %standard-phases
+                 (delete 'configure)
+                 (add-before 'build 'set-sysroot-include
+                   (lambda _
+                     (setenv "C_INCLUDE_PATH"
+                             (string-append (getcwd) "/sysroot/include"))))
+                 (add-before 'install 'set-install-dir
+                   (lambda _
+                     (setenv "INSTALL_DIR"
+                             (string-append #$output "/wasm32-wasi")))))))
+      (home-page "https://wasi.dev")
+      (synopsis "WASI libc implementation for WebAssembly")
+      (description
+       "WASI Libc is a libc for WebAssembly programs built on top of WASI
+system calls.  It provides a wide array of POSIX-compatible C APIs, includ=
ing
+support for standard I/O, file I/O, filesystem manipulation, memory
+management, time, string, environment variables, program startup, and many
+other APIs.")
+      (license (list
+                ;; For wasi-libc, with LLVM exceptions
+                license:asl2.0
+                ;; For malloc.c.
+                license:cc0
+                ;; For cloudlibc.
+                license:bsd-2
+                ;; For wasi-libc and musl-libc.
+                license:expat)))))
+
+(define-public wasm32-wasi-clang-runtime
+  (package (inherit clang-runtime-13)
+    (native-inputs
+     (list clang-13 wasi-libc))
+    (inputs (list llvm-13))
+    (arguments
+     (list
+      #:build-type "Release"
+      #:tests? #f
+      ;; Stripping binaries breaks wasm linking, resulting in the following
+      ;; error: "archive has no index; run ranlib to add one".
+      #:strip-binaries? #f
+      #:configure-flags
+      #~(list "-DCMAKE_C_COMPILER=3Dclang"
+              "-DCMAKE_C_COMPILER_TARGET=3Dwasm32-wasi"
+              (string-append
+               "-DCMAKE_SYSROOT=3D" #$wasi-libc "/wasm32-wasi")
+              (string-append
+               "-DCMAKE_C_FLAGS=3D-I " #$wasi-libc "/wasm32-wasi/include")
+
+              "-DCOMPILER_RT_OS_DIR=3Dwasi"
+
+              "-DCOMPILER_RT_BAREMETAL_BUILD=3DOn"
+              "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=3DOn"
+
+              ;; WASM only needs libclang_rt.builtins-wasm32.a from
+              ;; compiler-rt.
+              (string-append "../compiler-rt-"
+                             #$(package-version clang-runtime-13)
+                             ".src/lib/builtins"))))))
+
+;; FIXME: Ideally we wouldn't need to build a separate compiler because cl=
ang
+;; can support multiple targets at runtime.  However Guix patches the defa=
ult
+;; clang with a specific clang-runtime package.  It would be good to impro=
ve
+;; upstream Guix's support for cross-compiling with clang.
+
+(define clang-from-llvm (@@ (gnu packages llvm) clang-from-llvm))
+
+(define-public wasm32-wasi-clang
+  (let ((base (clang-from-llvm llvm-13 wasm32-wasi-clang-runtime
+                               "1j8pr5kk8iqyb4jds3yl7c6x672617h4ngkpl4575j=
7mk4nrwykq")))
+    (package (inherit base)
+      (name "wasm32-wasi-clang")
+      (inputs
+       (modify-inputs (package-inputs base)
+         (prepend wasi-libc)))
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:configure-flags flags)
+          #~(list "-DCLANG_INCLUDE_TESTS=3DTrue"
+                  ;; Use a sane default include directory.
+                  (string-append "-DC_INCLUDE_DIRS=3D"
+                                 #$wasi-libc
+                                 "/wasm32-wasi/include")))
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (delete 'symlink-cfi_ignorelist))))))))
+
+(define-public wasm32-wasi-libcxx
+  (package
+    (name "wasm32-wasi-libcxx")
+    (version "13.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/llvm/llvm-project")
+             (commit (string-append "llvmorg-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0cjl0vssi4y2g4nfr710fb6cdhxmn5r0vis15sf088zsc5zydfhw"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:configure-flags
+      #~(list (string-append "-S ../source/runtimes")
+
+              "-DLLVM_ENABLE_RUNTIMES=3Dlibcxx;libcxxabi"
+
+              (string-append
+               "-DCMAKE_SYSROOT=3D" #$wasi-libc "/wasm32-wasi")
+
+              (string-append
+               "-DCMAKE_INCLUDE_PATH=3D" #$wasi-libc "/wasm32-wasi/include=
")
+
+              (string-append
+               "-DCMAKE_STAGING_PREFIX=3D" #$output "/wasm32-wasi")
+
+              "-DCMAKE_C_COMPILER=3Dclang"
+              "-DCMAKE_C_COMPILER_WORKS=3DON"
+              "-DCMAKE_CXX_COMPILER=3Dclang++"
+              "-DCMAKE_CXX_COMPILER_WORKS=3DON"
+              "-DCMAKE_C_COMPILER_TARGET=3Dwasm32-wasi"
+              "-DCMAKE_CXX_COMPILER_TARGET=3Dwasm32-wasi"
+
+              "-DLIBCXX_LIBDIR_SUFFIX=3D/wasm32-wasi"
+
+              "-DLIBCXX_ENABLE_EXCEPTIONS=3DOFF"
+              "-DLIBCXX_ENABLE_SHARED=3DOFF"
+              "-DLIBCXX_ENABLE_THREADS=3DOFF"
+              "-DLIBCXX_ENABLE_FILESYSTEM=3DOFF"
+
+              "-DLIBCXXABI_LIBDIR_SUFFIX=3D/wasm32-wasi"
+
+              "-DLIBCXXABI_ENABLE_EXCEPTIONS=3DOFF"
+              "-DLIBCXXABI_ENABLE_SHARED=3DOFF"
+              "-DLIBCXXABI_ENABLE_THREADS=3DOFF"
+              "-DLIBCXXABI_ENABLE_FILESYSTEM=3DOFF")
+      #:tests? #f
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
+            (lambda _
+              (setenv "CPLUS_INCLUDE_PATH"
+                      (string-append #$wasi-libc "/wasm32-wasi/include:"
+                                     (getenv "CPLUS_INCLUDE_PATH"))))))))
+    (native-inputs
+     (list wasm32-wasi-clang lld python))
+    (inputs
+     (list wasi-libc))
+    (home-page "https://libcxx.llvm.org")
+    (synopsis "C++ standard library, for WebAssembly")
+    (description
+     "This package provides an implementation of the C++ standard library =
for
+use with Clang, targeting C++11, C++14 and above.  This package targets
+WebAssembly with WASI.")
+    (license license:expat)))
+
+(define-public wasm32-wasi-clang-toolchain
+  (package
+    (name "wasm32-wasi-clang-toolchain")
+    (version (package-version wasm32-wasi-clang))
+    (source #f)
+    (build-system trivial-build-system)
+    (arguments
+     (list
+      #:builder
+      (with-imported-modules '((guix build union)
+                               (guix build utils))
+        #~(begin
+            (use-modules (guix build union)
+                         (guix build utils))
+            (union-build #$output
+                         (list #$wasm32-wasi-clang-runtime
+                               #$wasi-libc
+                               #$wasm32-wasi-libcxx))
+            (mkdir-p (string-append #$output "/bin"))
+
+            ;; We provide clang and clang++ via a wrapped program that sets
+            ;; include paths correctly so that it does not include paths f=
rom
+            ;; the host.
+
+            ;; FIXME: Review how we can provide better support for
+            ;; cross-compiling with clang in Guix, maybe adding support for
+            ;; the CROSS_C_INCLUDE_PATH and CROSS_CPLUS_INCLUDE_PATH
+            ;; environment variables like GCC.
+
+            (for-each
+             (lambda (bin)
+               (symlink (string-append #$wasm32-wasi-clang bin)
+                        (string-append #$output bin))
+               (wrap-program (string-append #$output bin)
+                 #:sh (string-append #$bash-minimal "/bin/bash")
+                 `("C_INCLUDE_PATH" ":" =3D
+                   (,(string-append #$output "/wasm32-wasi/include")))
+                 `("CPLUS_INCLUDE_PATH" ":" =3D
+                   ;; Make sure inclure/c++/v1 comes first for #include_ne=
xt
+                   ;; to work.
+                   (,(string-append #$output "/wasm32-wasi/include/c++/v1")
+                    ,(string-append #$output "/wasm32-wasi/include")))))
+             '("/bin/clang" "/bin/clang++"))
+
+            (symlink (string-append #$lld "/bin/wasm-ld")
+                     (string-append #$output "/bin/wasm-ld"))))))
+    (inputs
+     (list bash-minimal
+           lld
+           wasm32-wasi-clang
+           wasm32-wasi-clang-runtime
+           wasi-libc
+           wasm32-wasi-libcxx))
+    (license (cons
+              (package-license wasm32-wasi-clang)
+              (package-license wasi-libc)))
+    (home-page "https://clang.llvm.org")
+    (synopsis "Complete Clang toolchain for C/C++ development, for WebAsse=
mbly.")
+    (description "This package provides a complete Clang toolchain for C/C=
++
+development targeting WebAssembly with WASI.  This includes Clang, as well=
 as
+libc, libc++ and wasm-ld.")))
--=20
2.34.0


--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Mar 2022 21:10:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 03 16:10:42 2022
Received: from localhost ([127.0.0.1]:43895 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nPsib-00024Y-JF
	for submit <at> debbugs.gnu.org; Thu, 03 Mar 2022 16:10:42 -0500
Received: from lists.gnu.org ([209.51.188.17]:45288)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pierre.langlois@HIDDEN>) id 1nPsiV-00024J-Cf
 for submit <at> debbugs.gnu.org; Thu, 03 Mar 2022 16:10:36 -0500
Received: from eggs.gnu.org ([209.51.188.92]:33706)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <pierre.langlois@HIDDEN>)
 id 1nPsiV-0000oC-5B
 for guix-patches@HIDDEN; Thu, 03 Mar 2022 16:10:31 -0500
Received: from mout.gmx.net ([212.227.17.21]:47319)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <pierre.langlois@HIDDEN>)
 id 1nPsiS-0006C5-5B
 for guix-patches@HIDDEN; Thu, 03 Mar 2022 16:10:30 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1646341810;
 bh=A3h/i7g3fTL6GeH4Li9OT860R1SuGZFyC46oCKUTsrA=;
 h=X-UI-Sender-Class:References:From:To:Cc:Subject:Date:In-reply-to;
 b=QjOpL3nsmEIMc3/qb6szXLMT3GBOt/POZwWeA2lHdE0jYUG6qJA5Aquz4FiUVgBTU
 o4pSwN+HzIhn+jYpJWKg266+wR5imQWjZvMF7BbgGPnxtZwhp5mPvDQGc0z9Vk31ZR
 bYKNJ3TnGoyUQxEmlpplioGfy3UVQYfoOxRoM2ro=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from labiere ([82.69.64.142]) by mail.gmx.net (mrgmx105
 [212.227.17.174]) with ESMTPSA (Nemesis) id 1M6UZl-1nWDQu3DSr-006tGk; Thu, 03
 Mar 2022 22:10:09 +0100
References: <20220303170252.3caec0a6@HIDDEN>
User-agent: mu4e 1.6.10; emacs 27.2
From: Pierre Langlois <pierre.langlois@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>
Subject: Re: [bug#54239] [PATCH] gnu: Add cross-clang.
Date: Thu, 03 Mar 2022 20:51:01 +0000
In-reply-to: <20220303170252.3caec0a6@HIDDEN>
Message-ID: <87wnhapwsv.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Provags-ID: V03:K1:dOXLhE0fwPx7IHgpjFUrPGux+9f0bmUkEn4FBUhKr/vtc5cd/T2
 5rKVkAk6PVNormqNegDHLUmf327VFJHOmrYBf+HzjoCFT634cnlrPDNoCAJXPvppnr4m5Cw
 D2z7ropFMf4h0/Wk62zBJ4gnGOUnUJFoBuG+JsuKT8ZbBDZDU9iUXCyJLAC07rJxYz9WmgT
 0ppk4j2q7rKmyPTjE+KUg==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:7etvm6vpeos=:I3Zyb+dLrONjCvowdXMLNU
 //leLhafC0Tf4s3rwXfnkq4WXsAziGLJqNVJ5W/0/qmvKmdZUQhSyIpkxlmGBLenqNm/tS6i6
 0mErjmNBP7bslZ70GpsRhyaoEPiUZ6HjwgtTBZE/ef5bNIO+J4LGwicxyxbzzIOAXwZLmU67O
 ozKJ+1mHw59yVPkab3zM9EjV0uD2+ToBEO7blL8XvOvennEpxzhBvKVgEHnXcI2pov6QSeBFM
 a81KBr4iSxPgYhMeImkUErKATYlXNgStGySqEn+9iBeJsLRyH4EusA3OcxNm0hLd2yQjNqMLC
 BdA8B7+ZxRzhkyEzii71aTsmZd0dRu8B9fKECLEaIh2tGX2O9HF45X/DNGBfOslRH3JXs2d40
 BoSwNfFOh7qLBzPKuwWb5zmWwWW8AFs/tn8+KQ635/KBIZMCy1BvKkt5DrFkP7mhIS9MGNN88
 /euE9OQ3CHstQ/Cm4IZ4zuu5/ySKQKx4G9pernaG/vPoT5Gq8to2js91QLlKm7pmkeZnu2L0k
 JMK4CyDt349HMuysdK61WnEKwebH5TQnJi1lYTC9j4rfX+YbsNfR8f0lQGIc41rCIKQdKXLIp
 UKT91vxLOtzXjiw3V7yFCzi6jFrmHyOEdjitbfzOElfswxKfi2Gi9JE/i3NMnT57gIleDM3Ls
 EDDJODmyjmb/gTQoISrxs0VrSrxsWpgAQnS7TdDrbOpzGBAoMdVB+5Zz3HPkd4PUcowTIhbab
 BXH31aIg9AaZDCZjylLbrgp3FqlKmLXJJtne2l9SOkYsjHyRUz0zKSbxEGeZVDUcg6AeEd/er
 EgqIX/lHnEVwAzAu8CRzAPU/0SHLhSowqltWozjx45M9ViMVRksIqa3NEbcR65IXVBKlSiS1v
 ZsgkAS0vKMw7cxrdPutW/5/kQKPytcIspEPf02W9L3Yu8XsFc6A1W4BF/Y29RlUeXyrZUD5HC
 FTB7zlw2ZawNFa3imxRmCXPuHVTDUGCH36vfYHtJymVCTORfcM0ZJTIhyD/N7RF+F6B4BPaTJ
 S7FHspaBIMR52oevpMh3F3m/HZxuK5TOlgwDRhVd6ZNl0flsCNtLYKHJpXb2jQUE+evQpTjHr
 +YSceKolQkBZe8=
Received-SPF: pass client-ip=212.227.17.21;
 envelope-from=pierre.langlois@HIDDEN; helo=mout.gmx.net
X-Spam_score_int: -25
X-Spam_score: -2.6
X-Spam_bar: --
X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7,
 RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: submit
Cc: 54239 <at> debbugs.gnu.org, guix-patches@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.4 (--)

--=-=-=
Content-Type: multipart/signed; boundary="==-=-=";
	micalg=pgp-sha512; protocol="application/pgp-signature"

--==-=-=
Content-Type: text/plain

Hi Julien,

Julien Lepiller <julien@HIDDEN> writes:

> Hi Guix!
>
> 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:
>
> 1. it actually works
> 2. it targets (%current-target-architecture) by default
>
> The rest of the series ensures that libcxx and libcxxabi can be
> cross-compiled with it.

That's really cool! Out of curiosity, what target are you interested in
that clang supports and GCC doesn't?  For instance I'm interested in
WebAssembly, and I've actually been contemplating how we could improve
support for cross-compilers based on Clang in Guix, to be able to
provide a working WebAssembly toolchain.

For context, such a toolchain will be needed to enable potential use of
WebAssembly in IceCat, for security purposes, see
https://hacks.mozilla.org/2021/12/webassembly-and-back-again-fine-grained-sandboxing-in-firefox-95/

I actually have a toolchain that works already, which targets the
wasm32-wasi-unknown triplet, but I wasn't convinced the way I did it was
the right way to go long term, so it needs more work.  I'm attaching the
patch in case there's anything useful to you in there already!

The approach I took was to create wrappers around clang/clang++ in order
to set the correct include paths, and then provide an isolated sysroot
for wasm32-wasi using union-build. This will work for IceCat, where
their should be a flag to pass a sysroot path, but we should be able to
do better in Guix.

I though I'd share in case that's helpful! I'll take a look at your
patches to see if I can build on top of them for a future WebAssembly
toolchain in Guix.

Thanks,
Pierre


--==-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQFMBAEBCgA2FiEEctU9gYy29KFyWDdMqPyeRH9PfVQFAmIhLrAYHHBpZXJyZS5s
YW5nbG9pc0BnbXguY29tAAoJEKj8nkR/T31UR/YH/iEDqu/yeDZsPwvQfLNRk16h
Vs9BtkqAtHl5SLiDdC6BBaGTiJ814rE8gmHeJ5CuLo9YxOMFpYbo8MJi4DfhQr1r
cbBAy0cUJMRfDV963dJyA0HM1C9eUCzLZKnCNviYLdp11ZYsX0YlP6j6unUhac7t
gfsGa95zN/EhYZ2dSRiCpsH/WU6n36GrWkNQcQzlqgUzcFEKFvrkDOIiXpzdAb7L
8/kskeRh4mzJYiMNGrcnH1010okpPUyuOuW/aRRea34teFrwg45ogikenUEh5wRx
7kzKCagWgjvpK7XLappPi8stmNfJ5RV9OWWtjNnKKLixvM2an8+Cc/HlbZNERFQ=
=qGo9
-----END PGP SIGNATURE-----
--==-=-=--

--=-=-=
Content-Type: text/x-patch; charset=utf-8
Content-Disposition: inline;
 filename=0001-gnu-Add-wasm32-wasi-clang-toolchain.patch
Content-Transfer-Encoding: quoted-printable

From 7d3c2a54ad66d5c4b2aa96eb946537fac1a5ae75 Mon Sep 17 00:00:00 2001
From: Pierre Langlois <pierre.langlois@HIDDEN>
Date: Sun, 16 Jan 2022 16:55:59 +0000
Subject: [PATCH] gnu: Add wasm32-wasi-clang-toolchain.

WIP
---
 gnu/local.mk          |   1 +
 gnu/packages/llvm.scm |   1 +
 gnu/packages/wasm.scm | 273 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 275 insertions(+)
 create mode 100644 gnu/packages/wasm.scm

diff --git a/gnu/local.mk b/gnu/local.mk
index b7339ff472..952786827f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -603,6 +603,7 @@ GNU_SYSTEM_MODULES =3D				\
   %D%/packages/vpn.scm				\
   %D%/packages/vulkan.scm			\
   %D%/packages/w3m.scm				\
+  %D%/packages/wasm.scm			\
   %D%/packages/wdiff.scm			\
   %D%/packages/web.scm				\
   %D%/packages/web-browsers.scm			\
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index eb949bed1b..8821b2b6a7 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -74,6 +74,7 @@ (define-module (gnu packages llvm)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match)
   #:export (make-lld-wrapper
+            clang-from-llvm
             system->llvm-target))
=20
 (define* (system->llvm-target #:optional
diff --git a/gnu/packages/wasm.scm b/gnu/packages/wasm.scm
new file mode 100644
index 0000000000..f9f73505ef
--- /dev/null
+++ b/gnu/packages/wasm.scm
@@ -0,0 +1,273 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright =C2=A9 2021 Pierre Langlois <pierre.langlois@HIDDEN>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages wasm)
+  #:use-module (guix gexp)
+  #:use-module (guix packages)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix download)
+  #:use-module (guix git-download)
+  #:use-module (guix utils)
+  #:use-module (guix build-system cmake)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system trivial)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages bash)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages llvm)
+  #:use-module (gnu packages python))
+
+(define-public wasi-libc
+  (let ((commit "ad5133410f66b93a2381db5b542aad5e0964db96")
+        (revision "1"))
+    (package
+      (name "wasi-libc")
+      (version (git-version "0.1-alpha" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/WebAssembly/wasi-libc")
+                      (commit commit)
+                      (recursive? #t)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "146jamq2q24vxjfpcwlqj84wzc80cbpbg0ns2wimyvzbanah48j6"))=
))
+      (build-system gnu-build-system)
+      (native-inputs (list clang-13))
+      (arguments
+       (list #:tests? #f ;No test suite
+             #:phases
+             #~(modify-phases %standard-phases
+                 (delete 'configure)
+                 (add-before 'build 'set-sysroot-include
+                   (lambda _
+                     (setenv "C_INCLUDE_PATH"
+                             (string-append (getcwd) "/sysroot/include"))))
+                 (add-before 'install 'set-install-dir
+                   (lambda _
+                     (setenv "INSTALL_DIR"
+                             (string-append #$output "/wasm32-wasi")))))))
+      (home-page "https://wasi.dev")
+      (synopsis "WASI libc implementation for WebAssembly")
+      (description
+       "WASI Libc is a libc for WebAssembly programs built on top of WASI
+system calls.  It provides a wide array of POSIX-compatible C APIs, includ=
ing
+support for standard I/O, file I/O, filesystem manipulation, memory
+management, time, string, environment variables, program startup, and many
+other APIs.")
+      (license (list
+                ;; For wasi-libc, with LLVM exceptions
+                license:asl2.0
+                ;; For malloc.c.
+                license:cc0
+                ;; For cloudlibc.
+                license:bsd-2
+                ;; For wasi-libc and musl-libc.
+                license:expat)))))
+
+(define-public wasm32-wasi-clang-runtime
+  (package (inherit clang-runtime-13)
+    (native-inputs
+     (list clang-13 wasi-libc))
+    (inputs (list llvm-13))
+    (arguments
+     (list
+      #:build-type "Release"
+      #:tests? #f
+      ;; Stripping binaries breaks wasm linking, resulting in the following
+      ;; error: "archive has no index; run ranlib to add one".
+      #:strip-binaries? #f
+      #:configure-flags
+      #~(list "-DCMAKE_C_COMPILER=3Dclang"
+              "-DCMAKE_C_COMPILER_TARGET=3Dwasm32-wasi"
+              (string-append
+               "-DCMAKE_SYSROOT=3D" #$wasi-libc "/wasm32-wasi")
+              (string-append
+               "-DCMAKE_C_FLAGS=3D-I " #$wasi-libc "/wasm32-wasi/include")
+
+              "-DCOMPILER_RT_OS_DIR=3Dwasi"
+
+              "-DCOMPILER_RT_BAREMETAL_BUILD=3DOn"
+              "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=3DOn"
+
+              ;; WASM only needs libclang_rt.builtins-wasm32.a from
+              ;; compiler-rt.
+              (string-append "../compiler-rt-"
+                             #$(package-version clang-runtime-13)
+                             ".src/lib/builtins"))))))
+
+;; FIXME: Ideally we wouldn't need to build a separate compiler because cl=
ang
+;; can support multiple targets at runtime.  However Guix patches the defa=
ult
+;; clang with a specific clang-runtime package.  It would be good to impro=
ve
+;; upstream Guix's support for cross-compiling with clang.
+
+(define clang-from-llvm (@@ (gnu packages llvm) clang-from-llvm))
+
+(define-public wasm32-wasi-clang
+  (let ((base (clang-from-llvm llvm-13 wasm32-wasi-clang-runtime
+                               "1j8pr5kk8iqyb4jds3yl7c6x672617h4ngkpl4575j=
7mk4nrwykq")))
+    (package (inherit base)
+      (name "wasm32-wasi-clang")
+      (inputs
+       (modify-inputs (package-inputs base)
+         (prepend wasi-libc)))
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:configure-flags flags)
+          #~(list "-DCLANG_INCLUDE_TESTS=3DTrue"
+                  ;; Use a sane default include directory.
+                  (string-append "-DC_INCLUDE_DIRS=3D"
+                                 #$wasi-libc
+                                 "/wasm32-wasi/include")))
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (delete 'symlink-cfi_ignorelist))))))))
+
+(define-public wasm32-wasi-libcxx
+  (package
+    (name "wasm32-wasi-libcxx")
+    (version "13.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/llvm/llvm-project")
+             (commit (string-append "llvmorg-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0cjl0vssi4y2g4nfr710fb6cdhxmn5r0vis15sf088zsc5zydfhw"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:configure-flags
+      #~(list (string-append "-S ../source/runtimes")
+
+              "-DLLVM_ENABLE_RUNTIMES=3Dlibcxx;libcxxabi"
+
+              (string-append
+               "-DCMAKE_SYSROOT=3D" #$wasi-libc "/wasm32-wasi")
+
+              (string-append
+               "-DCMAKE_INCLUDE_PATH=3D" #$wasi-libc "/wasm32-wasi/include=
")
+
+              (string-append
+               "-DCMAKE_STAGING_PREFIX=3D" #$output "/wasm32-wasi")
+
+              "-DCMAKE_C_COMPILER=3Dclang"
+              "-DCMAKE_C_COMPILER_WORKS=3DON"
+              "-DCMAKE_CXX_COMPILER=3Dclang++"
+              "-DCMAKE_CXX_COMPILER_WORKS=3DON"
+              "-DCMAKE_C_COMPILER_TARGET=3Dwasm32-wasi"
+              "-DCMAKE_CXX_COMPILER_TARGET=3Dwasm32-wasi"
+
+              "-DLIBCXX_LIBDIR_SUFFIX=3D/wasm32-wasi"
+
+              "-DLIBCXX_ENABLE_EXCEPTIONS=3DOFF"
+              "-DLIBCXX_ENABLE_SHARED=3DOFF"
+              "-DLIBCXX_ENABLE_THREADS=3DOFF"
+              "-DLIBCXX_ENABLE_FILESYSTEM=3DOFF"
+
+              "-DLIBCXXABI_LIBDIR_SUFFIX=3D/wasm32-wasi"
+
+              "-DLIBCXXABI_ENABLE_EXCEPTIONS=3DOFF"
+              "-DLIBCXXABI_ENABLE_SHARED=3DOFF"
+              "-DLIBCXXABI_ENABLE_THREADS=3DOFF"
+              "-DLIBCXXABI_ENABLE_FILESYSTEM=3DOFF")
+      #:tests? #f
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
+            (lambda _
+              (setenv "CPLUS_INCLUDE_PATH"
+                      (string-append #$wasi-libc "/wasm32-wasi/include:"
+                                     (getenv "CPLUS_INCLUDE_PATH"))))))))
+    (native-inputs
+     (list wasm32-wasi-clang lld python))
+    (inputs
+     (list wasi-libc))
+    (home-page "https://libcxx.llvm.org")
+    (synopsis "C++ standard library, for WebAssembly")
+    (description
+     "This package provides an implementation of the C++ standard library =
for
+use with Clang, targeting C++11, C++14 and above.  This package targets
+WebAssembly with WASI.")
+    (license license:expat)))
+
+(define-public wasm32-wasi-clang-toolchain
+  (package
+    (name "wasm32-wasi-clang-toolchain")
+    (version (package-version wasm32-wasi-clang))
+    (source #f)
+    (build-system trivial-build-system)
+    (arguments
+     (list
+      #:builder
+      (with-imported-modules '((guix build union)
+                               (guix build utils))
+        #~(begin
+            (use-modules (guix build union)
+                         (guix build utils))
+            (union-build #$output
+                         (list #$wasm32-wasi-clang-runtime
+                               #$wasi-libc
+                               #$wasm32-wasi-libcxx))
+            (mkdir-p (string-append #$output "/bin"))
+
+            ;; We provide clang and clang++ via a wrapped program that sets
+            ;; include paths correctly so that it does not include paths f=
rom
+            ;; the host.
+
+            ;; FIXME: Review how we can provide better support for
+            ;; cross-compiling with clang in Guix, maybe adding support for
+            ;; the CROSS_C_INCLUDE_PATH and CROSS_CPLUS_INCLUDE_PATH
+            ;; environment variables like GCC.
+
+            (for-each
+             (lambda (bin)
+               (symlink (string-append #$wasm32-wasi-clang bin)
+                        (string-append #$output bin))
+               (wrap-program (string-append #$output bin)
+                 #:sh (string-append #$bash-minimal "/bin/bash")
+                 `("C_INCLUDE_PATH" ":" =3D
+                   (,(string-append #$output "/wasm32-wasi/include")))
+                 `("CPLUS_INCLUDE_PATH" ":" =3D
+                   ;; Make sure inclure/c++/v1 comes first for #include_ne=
xt
+                   ;; to work.
+                   (,(string-append #$output "/wasm32-wasi/include/c++/v1")
+                    ,(string-append #$output "/wasm32-wasi/include")))))
+             '("/bin/clang" "/bin/clang++"))
+
+            (symlink (string-append #$lld "/bin/wasm-ld")
+                     (string-append #$output "/bin/wasm-ld"))))))
+    (inputs
+     (list bash-minimal
+           lld
+           wasm32-wasi-clang
+           wasm32-wasi-clang-runtime
+           wasi-libc
+           wasm32-wasi-libcxx))
+    (license (cons
+              (package-license wasm32-wasi-clang)
+              (package-license wasi-libc)))
+    (home-page "https://clang.llvm.org")
+    (synopsis "Complete Clang toolchain for C/C++ development, for WebAsse=
mbly.")
+    (description "This package provides a complete Clang toolchain for C/C=
++
+development targeting WebAssembly with WASI.  This includes Clang, as well=
 as
+libc, libc++ and wasm-ld.")))
--=20
2.34.0


--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 3 Mar 2022 18:59:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 03 13:59:26 2022
Received: from localhost ([127.0.0.1]:43783 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nPqfe-0007A9-MC
	for submit <at> debbugs.gnu.org; Thu, 03 Mar 2022 13:59:26 -0500
Received: from albert.telenet-ops.be ([195.130.137.90]:48538)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1nPqfc-00079y-TL
 for 54239 <at> debbugs.gnu.org; Thu, 03 Mar 2022 13:59:25 -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 1uzN2700a4UW6Th06uzNsp; Thu, 03 Mar 2022 19:59:23 +0100
Message-ID: <9cd9c6e72b5c3e2b32544fbcb46f14b2b52247b0.camel@HIDDEN>
Subject: Re: [bug#54239] [PATCH] gnu: Add cross-clang.
From: Maxime Devos <maximedevos@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>
Date: Thu, 03 Mar 2022 19:59:17 +0100
In-Reply-To: <20220303193503.4c055cec@HIDDEN>
References: <20220303170252.3caec0a6@HIDDEN>
 <70c3446488f9b76479f4f989c351403c461369d1.camel@HIDDEN>
 <20220303193503.4c055cec@HIDDEN>
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-zuT+tZTwUmP9u55hlB0I"
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=1646333963; bh=GolVXcGEsF6+ek70T38clPBmL/Uqa3s75mXitaDJ/9Q=;
 h=Subject:From:To:Cc:Date:In-Reply-To:References;
 b=V2SKMtbDJDsu/+kdr0B1gkkJ10RpT+WZzmto147Z2Vtwji3DwRfDi+WFfJjs5Cayb
 XWAQKDq9s+Vgtj3GlWyblUJGMtao/3Gn7J+M7KL8fM/oxbvE/Pdy2UxzsgJl0xpfBG
 NT+wZPoRZDVa2iQzaI+fDQYpdf/dyYPzN6iXbrT9VsBHt/AaSVAL0NjaS+EmCQQF+/
 lQFUn6P3DLNGdfd00sRMB1gKr2o8d+60LDlanRjeYH5cqtDv+hCkfsoSPU7zz48QI0
 isHl/HQpDaMHEajtR8a+oeXzpF1S1q8ng2tEHPfIckBlnW9JZN+RCZnOGMD9FRRTlC
 PfmhcXXNIOskA==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 54239
Cc: 54239 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)


--=-zuT+tZTwUmP9u55hlB0I
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Julien Lepiller schreef op do 03-03-2022 om 19:35 [+0100]:
> >=20
> > 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)?
>=20
> I don't know how to do that. Are there some examples around?

Search for 'cross-pkg-config' and 'standard-cross-packages'.

Greetings,
Maxime.

--=-zuT+tZTwUmP9u55hlB0I
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+4iGRcl7gUCYiEQBRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7uLEAP90t0ERq6Pr3LUBJkmKFEPqdC+B
utVy9xEI/3IEfH/EBgEA5rW4ZNTRdbA7i5mDlGHQUTXoIV8R9vW6iYxPYl9FaAA=
=+6Zd
-----END PGP SIGNATURE-----

--=-zuT+tZTwUmP9u55hlB0I--





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 3 Mar 2022 18:35:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 03 13:35:10 2022
Received: from localhost ([127.0.0.1]:43749 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nPqIA-0006Xy-Ad
	for submit <at> debbugs.gnu.org; Thu, 03 Mar 2022 13:35:10 -0500
Received: from lepiller.eu ([89.234.186.109]:57062)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <julien@HIDDEN>) id 1nPqI8-0006Xp-Jj
 for 54239 <at> debbugs.gnu.org; Thu, 03 Mar 2022 13:35:09 -0500
Received: from lepiller.eu (localhost [127.0.0.1])
 by lepiller.eu (OpenSMTPD) with ESMTP id e7eeefda;
 Thu, 3 Mar 2022 18:35:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from
 :to:cc:subject:message-id:in-reply-to:references:mime-version
 :content-type:content-transfer-encoding; s=dkim; bh=L45yZPkw/oya
 oby8/Ot2ZqHGrR+vdZ3EKd18A6CTmjs=; b=hkJvBSlozKiF7ZzW6yyLPU4BUX+W
 NOhXObftWKYgPxvCsisbrH+Of085pqJyQtH0c3h5LBianMDxN7ji8m+CEMxkig6s
 BHNngEbapy53iNdGyWaM3O0useazWAWX60HrjdQzPx9LIZezdB/PqBF8v0PNfkqn
 qyjqO/ey3oY2KDZJ/7SWhgKn0VWIGa+ZclevENNUmhq8nD8qj5BIG3dtHY6Gz4Pc
 fGWifWcHP+896bka5W8XlnwNo4ef7aivvBeNevsLbtyLAeqtuYd6yMWJRld1Vviu
 tPiP6Mljs/9pvo4JNpidRHo44oRArkDcZ1Jga68vfSKMWnNfgqZr8aHXyg==
Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 2d8b9e22
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); 
 Thu, 3 Mar 2022 18:35:05 +0000 (UTC)
Date: Thu, 3 Mar 2022 19:35:03 +0100
From: Julien Lepiller <julien@HIDDEN>
To: Maxime Devos <maximedevos@HIDDEN>
Subject: Re: [bug#54239] [PATCH] gnu: Add cross-clang.
Message-ID: <20220303193503.4c055cec@HIDDEN>
In-Reply-To: <70c3446488f9b76479f4f989c351403c461369d1.camel@HIDDEN>
References: <20220303170252.3caec0a6@HIDDEN>
 <70c3446488f9b76479f4f989c351403c461369d1.camel@HIDDEN>
X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 54239
Cc: 54239 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Le Thu, 03 Mar 2022 17:40:36 +0100,
Maxime Devos <maximedevos@HIDDEN> a =C3=A9crit :

> 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 =20
>=20
> Do you mean (%current-target-system)?

yes, that's what I meant.

>=20
> 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)?

I don't know how to do that. Are there some examples around?

>=20
> >      (native-inputs
> > -     (list clang llvm))
> > +     (list (if (%current-target-system)
> > +               (cross-clang (%current-target-system) #:clang
> > clang-9)
> > +               clang-9))) =20
>=20
> 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:
>=20
> (define (clang-for-target #:optional (clang clang))
>   (if (%current-target-system)
>       (cross-clang [...])
>       clang)) ; not cross-compiling
>=20
> then packages just need to do
>=20
>   (native-inputs (list (clang-for-target) libfoo libbar ...))

Great idea, I implemented that procedure.

>=20
> The rest of the series ensures that libcxx and libcxxabi can be
> cross-compiled with it.
>=20
> 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
>=20
> And perhaps the package name can be changed '$TARGET-clang' like done
> for gcc?

I can do that, but I don't think it'll be recognized by cmake. It's
building right now, and I'll have a try.

> > + ;; Support the same variables as clang, even in cross-compilation
> > + ;; context.
> > + ;; Clang does not make a difference between native and
> > + ;; cross-compilation. =20
>=20
> 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.
>=20

OK, fixed.

> > +           (files '("lib" "lib64")))) =20
>=20
> I don't think Guix does a "lib" / "lib64" split, "lib" might
> be sufficient.  At least, there are a few comments like
>=20
>   ;; Force powerpc libdir to be /lib and not /lib64
>=20
> in Guix (though the gcc packages still includes "lib64" but
> maybe that's only due to historical reasons).

I saw that in GCC, so I just used the same specification, but just
'("lib") is fine with me. Fixed.

> 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?

It won't work, just like it doesn't work for gcc-toolchain. When you do
(without my patches):

guix build hello --with-c-toolchain=3Dhello=3Dclang-toolchain
--target=3Di686-unknown-linux-gnu

it builds, but that's because --with-c-toolchain replaces "gcc"
(and friends), but the cross package uses "cross-gcc".

guix build hello --with-c-toolchain=3Dhello=3Dgcc-toolchain@7
--target=3Di686-unknown-linux-gnu

also builds, but uses the latest gcc instead of gcc-toolchain@7.

Will send v2 shortly, after I've tested the rename works.

> Greetings,
> Maxime.





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 3 Mar 2022 16:40:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 03 11:40:43 2022
Received: from localhost ([127.0.0.1]:43531 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nPoVP-0001I0-Eu
	for submit <at> 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 <maximedevos@HIDDEN>) id 1nPoVO-0001Hr-3w
 for 54239 <at> 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@HIDDEN>
Subject: Re: [bug#54239] [PATCH] gnu: Add cross-clang.
From: Maxime Devos <maximedevos@HIDDEN>
To: Julien Lepiller <julien@HIDDEN>, 54239 <at> debbugs.gnu.org
Date: Thu, 03 Mar 2022 17:40:36 +0100
In-Reply-To: <20220303170252.3caec0a6@HIDDEN>
References: <20220303170252.3caec0a6@HIDDEN>
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-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 54239
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)


--=-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--





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 3 Mar 2022 16:08:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 03 11:08:10 2022
Received: from localhost ([127.0.0.1]:43507 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nPnzu-0000Um-7c
	for submit <at> debbugs.gnu.org; Thu, 03 Mar 2022 11:08:10 -0500
Received: from lepiller.eu ([89.234.186.109]:57048)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <julien@HIDDEN>) id 1nPnzr-0000UA-11
 for 54239 <at> debbugs.gnu.org; Thu, 03 Mar 2022 11:08:07 -0500
Received: from lepiller.eu (localhost [127.0.0.1])
 by lepiller.eu (OpenSMTPD) with ESMTP id 2b59e5da
 for <54239 <at> debbugs.gnu.org>; Thu, 3 Mar 2022 16:08:01 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=from:to
 :subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding; s=dkim; bh=nx1SD4DivmfbsFfXPirGZOEIj
 a0iA/Dao6gRnqp6uKY=; b=jeN0AaigxijPXONyY2xWpCiGUDedL/X+5BDljN7dN
 +d/9g8t9vIiaDYEF7nbuxKqIlGRuSfsAlF7jXroAiTY9EqRtWOlOZrhNbJCxr2YB
 RGPcWvONQ+43dQSIOGH8wPXWWxw6aOwxg57wTgYM+2yJNvMRCoC1MV/5AMaifDOq
 D3Lz9ofS+YpU1bUU6VbDpQANF+JBKFiMjwDDHB3tnJyMPaGY+mXKyC4lvMLm5Owr
 qCVpoZZzMCFFoWWz/2RB8P1MimasZTyX9ApwVVSlL/6uj9uLua6ekSvywviXHakK
 cJaIXgxAc1c7KvpU/BkMY1k3kJFhQ9gyFVQ6pC6I6aDBA==
Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id de4e849a
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <54239 <at> debbugs.gnu.org>;
 Thu, 3 Mar 2022 16:08:01 +0000 (UTC)
From: Julien Lepiller <julien@HIDDEN>
To: 54239 <at> debbugs.gnu.org
Subject: [PATCH 5/5] gnu: Add libcxxabi-9.
Date: Thu,  3 Mar 2022 17:07:47 +0100
Message-Id: <4f9bdee16d84acc93f51a0f1a73149366de2b818.1646322873.git.julien@HIDDEN>
X-Mailer: git-send-email 2.34.0
In-Reply-To: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646322873.git.julien@HIDDEN>
References: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646322873.git.julien@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 54239
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/packages/llvm.scm (libcxxabi-9): New variable.
(libcxxabi-6): Inherit from it.
---
 gnu/packages/llvm.scm | 72 +++++++++++++++++++++++++++++++------------
 1 file changed, 53 insertions(+), 19 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 63b55ef3df..f1631bbe70 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1396,20 +1396,17 @@ (define-public libcxx-6
                (cross-clang (%current-target-system) #:clang clang-6)
                clang-6)))))
 
-(define-public libcxxabi-6
+(define-public libcxxabi-9
   (package
     (name "libcxxabi")
-    (version "6.0.1")
+    (version (package-version clang-9))
     (source
      (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://github.com/llvm/llvm-project")
-             (commit (string-append "llvmorg-" version))))
-       (file-name (git-file-name name version))
+       (method url-fetch)
+       (uri (llvm-uri "libcxxabi" version))
        (sha256
         (base32
-         "0ki6796b5z08kh3a3rbysr5wwb2dkl6wal5dzd03i4li5xfkvx1g"))))
+         "1b4aiaa8cirx52vk2p5kfk57qmbqf1ipb4nqnjhdgqps9jm7iyg8"))))
     (build-system cmake-build-system)
     (arguments
      `(#:configure-flags
@@ -1420,8 +1417,6 @@ (define-public libcxxabi-6
              "-DCMAKE_CXX_COMPILER=clang++")
        #:phases
        (modify-phases (@ (guix build cmake-build-system) %standard-phases)
-         (add-after 'unpack 'chdir
-           (lambda _ (chdir "libcxxabi")))
          (add-after 'unpack 'adjust-CPLUS_INCLUDE_PATH
            (lambda* (#:key inputs native-inputs #:allow-other-keys)
              (define (delete* what lst)
@@ -1455,10 +1450,10 @@ (define-public libcxxabi-6
                                         (string-append gcc "/include/c++"))
                                   (string-split (getenv "CROSS_CPLUS_INCLUDE_PATH")
                                                 #\:)))
-                          ":"))
-                 (format #true
-                         "environment variable `CROSS_CPLUS_INCLUDE_PATH' changed to ~a~%"
-                         (getenv "CROSS_CPLUS_INCLUDE_PATH")))
+                          ":")))
+               (format #true
+                       "environment variable `CROSS_CPLUS_INCLUDE_PATH' changed to ~a~%"
+                       (getenv "CROSS_CPLUS_INCLUDE_PATH"))
                (format #true
                        "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
                        (getenv "CPLUS_INCLUDE_PATH")))))
@@ -1466,13 +1461,19 @@ (define-public libcxxabi-6
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((include-dir (string-append
                                  (assoc-ref outputs "out") "/include")))
-               (install-file "../libcxxabi/include/__cxxabi_config.h" include-dir)
-               (install-file "../libcxxabi/include/cxxabi.h" include-dir)))))))
-    (inputs (list llvm-6 libcxx-6))
+               (mkdir-p include-dir)
+               (install-file ,(string-append "../libcxxabi-" version
+                                             ".src/include/__cxxabi_config.h")
+                             include-dir)
+               (install-file ,(string-append "../libcxxabi-" version
+                                             ".src/include/cxxabi.h")
+                             include-dir)))))))
+    (inputs
+     (list llvm-9 libcxx))
     (native-inputs
      (list (if (%current-target-system)
-               (cross-clang (%current-target-system) #:clang clang-6)
-               clang-6)))
+               (cross-clang (%current-target-system) #:clang clang-9)
+               clang-9)))
     (home-page "https://libcxxabi.llvm.org")
     (synopsis "C++ standard library support")
     (description
@@ -1480,6 +1481,39 @@ (define-public libcxxabi-6
 standard C++ library.")
     (license license:expat)))
 
+(define-public libcxxabi-6
+  (package
+    (inherit libcxxabi-9)
+    (name "libcxxabi")
+    (version "6.0.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/llvm/llvm-project")
+             (commit (string-append "llvmorg-" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0ki6796b5z08kh3a3rbysr5wwb2dkl6wal5dzd03i4li5xfkvx1g"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments libcxxabi-9)
+      ((#:phases phases)
+       `(modify-phases ,phases
+          (add-after 'unpack 'chdir
+            (lambda _ (chdir "libcxxabi")))
+          (replace 'install-headers
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let ((include-dir (string-append
+                                  (assoc-ref outputs "out") "/include")))
+                (install-file "../libcxxabi/include/__cxxabi_config.h" include-dir)
+                (install-file "../libcxxabi/include/cxxabi.h" include-dir))))))))
+    (inputs (list llvm-6 libcxx-6))
+    (native-inputs
+     (list (if (%current-target-system)
+               (cross-clang (%current-target-system) #:clang clang-6)
+               clang-6)))))
+
 (define-public libcxx+libcxxabi-6
   (package
     (inherit libcxx-6)
-- 
2.34.0





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 3 Mar 2022 16:08:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 03 11:08:10 2022
Received: from localhost ([127.0.0.1]:43505 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nPnzt-0000Ue-T4
	for submit <at> debbugs.gnu.org; Thu, 03 Mar 2022 11:08:10 -0500
Received: from lepiller.eu ([89.234.186.109]:57046)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <julien@HIDDEN>) id 1nPnzq-0000Tf-T3
 for 54239 <at> debbugs.gnu.org; Thu, 03 Mar 2022 11:08:07 -0500
Received: from lepiller.eu (localhost [127.0.0.1])
 by lepiller.eu (OpenSMTPD) with ESMTP id e5bbd3cb
 for <54239 <at> debbugs.gnu.org>; Thu, 3 Mar 2022 16:08:01 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=from:to
 :subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding; s=dkim; bh=orT2/iqQmmXH1q7soD3s2DNBR
 x7cVBARgPIaWAmZ1NQ=; b=PjwFxxcs/2cG9OXSZk9rw12iqTg/XClrgBvaKy0hi
 fF99TrVICYIKWfXXlhqHymeyT9yECI8BqmvZ1eqiw0QmIeH1aqjKbJxB8u+Xd2Xr
 QwpeTthDeKmI55snnAG9ky+Sq+SkKYICy7ReRvuU2LlcgEVNdshHEGIAiDRNElUx
 lwZ0P7lVedDmVGYaaF0v17KCi3m57pxtHqIdYSV3EWpAKzzEzEOZjnTzSsRtu7bg
 yWky4416DdNeE9nLNpGtf9VCo5lwy6WYQOOCGM6rUWhz/OwmHgtLCLob5xGC05HG
 ORtYoe1LBkqwRuazhfmsAcHOAMKSXnxY54jW4zQaQACtg==
Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 90af0f78
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <54239 <at> debbugs.gnu.org>;
 Thu, 3 Mar 2022 16:08:01 +0000 (UTC)
From: Julien Lepiller <julien@HIDDEN>
To: 54239 <at> debbugs.gnu.org
Subject: [PATCH 4/5] gnu: libcxxabi-6: Allow cross-compilation.
Date: Thu,  3 Mar 2022 17:07:46 +0100
Message-Id: <593b2077bd42bc8b045c638567ff451d114b0195.1646322873.git.julien@HIDDEN>
X-Mailer: git-send-email 2.34.0
In-Reply-To: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646322873.git.julien@HIDDEN>
References: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646322873.git.julien@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 54239
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/packages/llvm.scm (libcxxabi-6)[native-inputs]: Use cross-clang for
cross-compilation.  Move llvm and libcxx to...
[inputs]: ...here.
[arguments]<adjust-CPLUS_INCLUDE_PATH>: Also adjust
CROSS_CPLUS_INCLUDE_PATH when necessary.
---
 gnu/packages/llvm.scm | 41 ++++++++++++++++++++++++++++++++++-------
 1 file changed, 34 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 9b5e495d08..63b55ef3df 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1422,19 +1422,43 @@ (define-public libcxxabi-6
        (modify-phases (@ (guix build cmake-build-system) %standard-phases)
          (add-after 'unpack 'chdir
            (lambda _ (chdir "libcxxabi")))
-         (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((gcc (assoc-ref inputs  "gcc")))
+         (add-after 'unpack 'adjust-CPLUS_INCLUDE_PATH
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (define (delete* what lst)
+               (if (null? what)
+                   lst
+                   (delete* (cdr what) (delete (car what) lst))))
+
+             (let ((gcc (or (assoc-ref inputs  "gcc") (assoc-ref native-inputs "gcc")))
+                   (cross-gcc (assoc-ref native-inputs "cross-gcc")))
                ;; Hide GCC's C++ headers so that they do not interfere with
                ;; the ones we are attempting to build.
                (setenv "CPLUS_INCLUDE_PATH"
                        (string-join
                         (cons (string-append
                                (assoc-ref inputs "libcxx") "/include/c++/v1")
-                              (delete (string-append gcc "/include/c++")
-                                      (string-split (getenv "CPLUS_INCLUDE_PATH")
-                                                    #\:)))
+                              (delete*
+                                `(,(string-append gcc "/include/c++")
+                                  ,@(if cross-gcc
+                                        `(,(string-append cross-gcc "/include/c++"))
+                                        '()))
+                                (string-split (getenv "CPLUS_INCLUDE_PATH")
+                                              #\:)))
                         ":"))
+               (when cross-gcc
+                 (setenv "CROSS_CPLUS_INCLUDE_PATH"
+                         (string-join
+                          (cons (string-append
+                                  (assoc-ref inputs "libcxx") "/include/c++/v1")
+                                (delete*
+                                  (list (string-append cross-gcc "/include/c++")
+                                        (string-append gcc "/include/c++"))
+                                  (string-split (getenv "CROSS_CPLUS_INCLUDE_PATH")
+                                                #\:)))
+                          ":"))
+                 (format #true
+                         "environment variable `CROSS_CPLUS_INCLUDE_PATH' changed to ~a~%"
+                         (getenv "CROSS_CPLUS_INCLUDE_PATH")))
                (format #true
                        "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
                        (getenv "CPLUS_INCLUDE_PATH")))))
@@ -1444,8 +1468,11 @@ (define-public libcxxabi-6
                                  (assoc-ref outputs "out") "/include")))
                (install-file "../libcxxabi/include/__cxxabi_config.h" include-dir)
                (install-file "../libcxxabi/include/cxxabi.h" include-dir)))))))
+    (inputs (list llvm-6 libcxx-6))
     (native-inputs
-     (list clang-6 llvm-6 libcxx-6))
+     (list (if (%current-target-system)
+               (cross-clang (%current-target-system) #:clang clang-6)
+               clang-6)))
     (home-page "https://libcxxabi.llvm.org")
     (synopsis "C++ standard library support")
     (description
-- 
2.34.0





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 3 Mar 2022 16:08:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 03 11:08:09 2022
Received: from localhost ([127.0.0.1]:43503 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nPnzt-0000Uc-Ep
	for submit <at> debbugs.gnu.org; Thu, 03 Mar 2022 11:08:09 -0500
Received: from lepiller.eu ([89.234.186.109]:57046)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <julien@HIDDEN>) id 1nPnzq-0000Tf-4R
 for 54239 <at> debbugs.gnu.org; Thu, 03 Mar 2022 11:08:06 -0500
Received: from lepiller.eu (localhost [127.0.0.1])
 by lepiller.eu (OpenSMTPD) with ESMTP id 750c49a9
 for <54239 <at> debbugs.gnu.org>; Thu, 3 Mar 2022 16:08:01 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=from:to
 :subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding; s=dkim; bh=M8wZ+tf7N/VNXHLYZj3eu4IiU
 RXw2gai8NOLe/irvfM=; b=UBVz99Y1BH/q7A6t9L4hcbrbfauF/r/uofWEPnsw1
 va/SihRzM/n7cAKsxex3J2uoNG4LFsjiyJjcJ44GyT3x5rBJ8/FfcMCKq3sN4WYg
 wMwY0TEypgteFMU0OmMAjVrBckxfbhbcAbl5l6Mk3rpjcrKtgUGuG3F/hz+CqRk+
 cg8MuE0MKIUiU6I2c3GWCOYTvTzyB1pXXTh/hsRije0Mzz9gK/hViL45R+3oezhg
 myqwquUSI8zByVnPmiz9nKlxSht4D5XvWD1lrFSbbPKRGfGwN4FdMlRfSEsdqEfD
 geY6C9DtlQpozYTAj/YbYLP78FuJGO5BJgl1Zx+spyGnA==
Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 35546f9b
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <54239 <at> debbugs.gnu.org>;
 Thu, 3 Mar 2022 16:08:01 +0000 (UTC)
From: Julien Lepiller <julien@HIDDEN>
To: 54239 <at> debbugs.gnu.org
Subject: [PATCH 3/5] gnu: libcxx: Allow cross-compilation.
Date: Thu,  3 Mar 2022 17:07:45 +0100
Message-Id: <2c334d7e0557d21b59eb127b9384db954f57f79c.1646322873.git.julien@HIDDEN>
X-Mailer: git-send-email 2.34.0
In-Reply-To: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646322873.git.julien@HIDDEN>
References: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646322873.git.julien@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 54239
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/packages/llvm.scm (libcxx)[native-inputs]: Use cross-clang for
cross-compilation.  Move llvm to...
[inputs]: ...here.
[arguments]: adjust CROSS_INCLUDE_PATH when cross-compiling.
(libcxx-6)[native-inputs]: Use cross-clang for cross-compilation.  Move
llvm to...
[inputs]: ...here.
---
 gnu/packages/llvm.scm | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index c02f8e5c7a..9b5e495d08 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -1026,7 +1026,7 @@ (define-public clang clang-13)
 (define-public clang-toolchain clang-toolchain-13)
 
 (define* (cross-clang target
-                      #:optional
+                      #:key
                       (libc (cross-libc target))
                       (xgcc (cross-gcc target
                               #:xbinutils (cross-binutils target)
@@ -1343,8 +1343,9 @@ (define-public libcxx
      `(#:phases
        (modify-phases (@ (guix build cmake-build-system) %standard-phases)
          (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((gcc (assoc-ref inputs  "gcc")))
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (let ((gcc (or (assoc-ref (or native-inputs inputs) "gcc")))
+                   (cross-gcc (assoc-ref native-inputs "cross-gcc")))
                ;; Hide GCC's C++ headers so that they do not interfere with
                ;; the ones we are attempting to build.
                (setenv "CPLUS_INCLUDE_PATH"
@@ -1352,12 +1353,23 @@ (define-public libcxx
                                             (string-split (getenv "CPLUS_INCLUDE_PATH")
                                                           #\:))
                                     ":"))
+               (when cross-gcc
+                 (setenv "CROSS_CPLUS_INCLUDE_PATH"
+                         (string-join (delete (string-append cross-gcc "/include/c++")
+                                              (string-split (getenv "CPLUS_INCLUDE_PATH")
+                                                            #\:))
+                                      ":"))
+                 (format #t
+                         "environment variable `CROSS_CPLUS_INCLUDE_PATH' changed to ~a~%"
+                         (getenv "CROSS_CPLUS_INCLUDE_PATH")))
                (format #t
                        "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
-                       (getenv "CPLUS_INCLUDE_PATH"))
-               #t))))))
+                       (getenv "CPLUS_INCLUDE_PATH"))))))))
+    (inputs (list llvm-9))
     (native-inputs
-     (list clang llvm))
+     (list (if (%current-target-system)
+               (cross-clang (%current-target-system) #:clang clang-9)
+               clang-9)))
     (home-page "https://libcxx.llvm.org")
     (synopsis "C++ standard library")
     (description
@@ -1378,8 +1390,11 @@ (define-public libcxx-6
        (sha256
         (base32
          "0rzw4qvxp6qx4l4h9amrq02gp7hbg8lw4m0sy3k60f50234gnm3n"))))
+    (inputs (list llvm-6))
     (native-inputs
-     (list clang-6 llvm-6))))
+     (list (if (%current-target-system)
+               (cross-clang (%current-target-system) #:clang clang-6)
+               clang-6)))))
 
 (define-public libcxxabi-6
   (package
-- 
2.34.0





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 3 Mar 2022 16:08:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 03 11:08:07 2022
Received: from localhost ([127.0.0.1]:43499 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nPnzq-0000UH-U4
	for submit <at> debbugs.gnu.org; Thu, 03 Mar 2022 11:08:07 -0500
Received: from lepiller.eu ([89.234.186.109]:57046)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <julien@HIDDEN>) id 1nPnzo-0000Tf-Vb
 for 54239 <at> debbugs.gnu.org; Thu, 03 Mar 2022 11:08:05 -0500
Received: from lepiller.eu (localhost [127.0.0.1])
 by lepiller.eu (OpenSMTPD) with ESMTP id 3f778e49
 for <54239 <at> debbugs.gnu.org>; Thu, 3 Mar 2022 16:08:01 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=from:to
 :subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding; s=dkim; bh=LL98cMsYp37N6reHNAZN2FRGc
 8/iRP1UvJQxQ/xjN0M=; b=fDTAJW3oFQRCxWRK8Ky9bsOYpNbfQCQ03VZ2+5Tk9
 b4UvYg+yO9pWgSZV/WA62xA3POvQ0GCu4sCJ2Ux7EbUrQmdYuL/D2+WiL16tRckJ
 ozUAnGqby5S779PQU7Gt6OUOA0ksxT/0IA9lGAoXfX3o4GppJwcbfnvqgJO07VW8
 6A1lrWkXV46SOCtnO2dN4mFEgvmGIcO4dUQyi3VfsRWTEDPQjB5KBT3XsNEnKvnw
 nslPwhk5WVAyBn3mIHQk+oEaqSn8lK/c3wYeFB/up9LUSzHKCU3ixwMwjJ3Yv+/+
 hiyaN3vzlhEMzwY45CZdnccaE0HYqSHgIKql5cCYGsGfw==
Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id da5e0cd9
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <54239 <at> debbugs.gnu.org>;
 Thu, 3 Mar 2022 16:08:01 +0000 (UTC)
From: Julien Lepiller <julien@HIDDEN>
To: 54239 <at> debbugs.gnu.org
Subject: [PATCH 2/5] gnu: Add cross-clang.
Date: Thu,  3 Mar 2022 17:07:44 +0100
Message-Id: <ce088a32bd3493e881efd5a2bb789eaa08e4609a.1646322873.git.julien@HIDDEN>
X-Mailer: git-send-email 2.34.0
In-Reply-To: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646322873.git.julien@HIDDEN>
References: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646322873.git.julien@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 54239
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/packages/llvm.scm (cross-clang): New variable.
---
 gnu/packages/llvm.scm | 125 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 124 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index d6e9846699..c02f8e5c7a 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -54,6 +54,7 @@ (define-module (gnu packages llvm)
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages cross-base)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages bootstrap)           ;glibc-dynamic-linker
   #:use-module (gnu packages check)               ;python-lit
@@ -75,7 +76,8 @@ (define-module (gnu packages llvm)
   #:use-module (ice-9 match)
   #:export (make-lld-wrapper
             system->llvm-target
-            cross-llvm))
+            cross-llvm
+            cross-clang))
 
 (define* (system->llvm-target #:optional
                               (system (or (and=> (%current-target-system)
@@ -1023,6 +1025,127 @@ (define-public clang-runtime clang-runtime-13)
 (define-public clang clang-13)
 (define-public clang-toolchain clang-toolchain-13)
 
+(define* (cross-clang target
+                      #:optional
+                      (libc (cross-libc target))
+                      (xgcc (cross-gcc target
+                              #:xbinutils (cross-binutils target)
+                              #:libc (cross-libc target)))
+                      (clang clang))
+  "Return a cross-clang compiler for target."
+  (package
+    (inherit clang)
+    (version (package-version clang))
+    ;; Support the same variables as clang, even in cross-compilation context.
+    ;; Clang does not make a difference between native and cross-compilation.
+    (search-paths
+     (append
+       (list
+         (search-path-specification
+           (variable "CROSS_LIBRARY_PATH")
+           (files '("lib" "lib64"))))
+       (package-native-search-paths clang)))
+    (native-search-paths '())
+    (arguments
+     (substitute-keyword-arguments (package-arguments clang)
+       ((#:configure-flags _)
+        `(list "-DCLANG_INCLUDE_TESTS=True"
+               (string-append "-DGCC_INSTALL_PREFIX="
+                              (assoc-ref %build-inputs "cross-gcc-lib"))
+               (string-append "-DC_INCLUDE_DIRS="
+                              (assoc-ref %build-inputs "target-libc")
+                              "/include")))
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (add-after 'unpack 'add-missing-libdir
+             (lambda _
+               ;; cross-gcc installs its libraries in <target>/lib instead of
+               ;; lib.
+               (substitute* "lib/Driver/ToolChain.cpp"
+                 (("\"-L\"\\) \\+ LibPath\\)\\);")
+                  ,(string-append "\"-L\") + LibPath));
+  CmdArgs.push_back(Args.MakeArgString(StringRef(\"-L\") + "
+                                 "StringRef(GCC_INSTALL_PREFIX) + StringRef(\"/"
+                                 target "/lib\")));
+  CmdArgs.push_back(Args.MakeArgString(StringRef(\"-rpath=\") + "
+                                 "StringRef(GCC_INSTALL_PREFIX) + StringRef(\"/"
+                                 target "/lib\")));")))))
+           (add-after 'unpack 'support-cross-library-path
+             (lambda _
+               ;; LIBRARY_PATH is only supported for native builds, but we still
+               ;; need it (or CROSS_LIBRARY_PATH to be precise) when
+               ;; cross-compiling
+               (substitute* "lib/Driver/ToolChains/CommonArgs.cpp"
+                 (("LIBRARY_PATH\"")
+                  "LIBRARY_PATH\");
+  } else {
+    addDirectoryList(Args, CmdArgs, \"-L\", \"CROSS_LIBRARY_PATH\""))))
+           (replace 'set-glibc-file-names
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let ((libc (assoc-ref inputs "target-libc"))
+                     (compiler-rt (assoc-ref inputs "clang-runtime"))
+                     (gcc (assoc-ref inputs "cross-gcc")))
+                 (setenv "LIBRARY_PATH"
+                         (string-append
+                           (assoc-ref inputs "libc") "/lib:" (getenv "LIBRARY_PATH")))
+                 ,@(cond
+                    ((version>=? version "6.0")
+                     `(;; Link to libclang_rt files from clang-runtime.
+                       (substitute* "lib/Driver/ToolChain.cpp"
+                         (("getDriver\\(\\)\\.ResourceDir")
+                          (string-append "\"" compiler-rt "\"")))
+
+                       ;; Make "LibDir" refer to <glibc>/lib so that it
+                       ;; uses the right dynamic linker file name.
+                       (substitute* "lib/Driver/ToolChains/Linux.cpp"
+                         (("(^[[:blank:]]+LibDir = ).*" _ declaration)
+                          (string-append declaration "\"" libc "/lib\";\n"))
+
+                         ;; Make clang look for libstdc++ in the right
+                         ;; location.
+                         (("LibStdCXXIncludePathCandidates\\[\\] = \\{")
+                          (string-append
+                           "LibStdCXXIncludePathCandidates[] = { \"" gcc
+                           "/include/c++\","))
+
+                         ;; Make sure libc's libdir is on the search path, to
+                         ;; allow crt1.o & co. to be found.
+                         (("@GLIBC_LIBDIR@")
+                          (string-append libc "/lib")))))
+                    (else
+                     `((substitute* "lib/Driver/Tools.cpp"
+                         ;; Patch the 'getLinuxDynamicLinker' function so that
+                         ;; it uses the right dynamic linker file name.
+                         (("/lib64/ld-linux-x86-64.so.2")
+                          (string-append libc ,(glibc-dynamic-linker))))
+
+                       ;; Link to libclang_rt files from clang-runtime.
+                       ;; This substitution needed slight adjustment in 3.8.
+                       ,@(if (version>=? version "3.8")
+                             '((substitute* "lib/Driver/Tools.cpp"
+                                 (("TC\\.getDriver\\(\\)\\.ResourceDir")
+                                  (string-append "\"" compiler-rt "\""))))
+                             '((substitute* "lib/Driver/ToolChain.cpp"
+                                 (("getDriver\\(\\)\\.ResourceDir")
+                                  (string-append "\"" compiler-rt "\"")))))
+
+                       ;; Make sure libc's libdir is on the search path, to
+                       ;; allow crt1.o & co. to be found.
+                       (substitute* "lib/Driver/ToolChains.cpp"
+                         (("@GLIBC_LIBDIR@")
+                          (string-append libc "/lib")))))))))))))
+    (inputs
+     `(("target-libc" ,libc)
+       ("cross-gcc-lib" ,xgcc "lib")
+       ("cross-gcc" ,xgcc)
+       ,@(package-inputs clang)))
+    (propagated-inputs
+      (modify-inputs (package-propagated-inputs clang)
+        (replace "llvm"
+          (cross-llvm
+            (car (assoc-ref (package-propagated-inputs clang) "llvm"))
+            target))))))
+
 (define-public llvm-for-rocm
   (package
     ;; Actually based on LLVM 13 as of v4.3, but llvm-12 works just fine.
-- 
2.34.0





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at 54239 <at> debbugs.gnu.org:


Received: (at 54239) by debbugs.gnu.org; 3 Mar 2022 16:08:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 03 11:08:05 2022
Received: from localhost ([127.0.0.1]:43496 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nPnzp-0000Ty-Iv
	for submit <at> debbugs.gnu.org; Thu, 03 Mar 2022 11:08:05 -0500
Received: from lepiller.eu ([89.234.186.109]:57046)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <julien@HIDDEN>) id 1nPnzn-0000Tf-II
 for 54239 <at> debbugs.gnu.org; Thu, 03 Mar 2022 11:08:04 -0500
Received: from lepiller.eu (localhost [127.0.0.1])
 by lepiller.eu (OpenSMTPD) with ESMTP id bf5dab87
 for <54239 <at> debbugs.gnu.org>; Thu, 3 Mar 2022 16:08:01 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=from:to
 :subject:date:message-id:mime-version:content-type
 :content-transfer-encoding; s=dkim; bh=PVbHQsUpe7ZCSCXqtXYm4YfVJ
 4XJ1fuE4mRuGe9Iu+g=; b=l+VhyVOqGNtt309u0baHTG45m6fpmG4CAwsv7inMB
 XfmQAV3XnCeMKpKUDj71gq73YRVWOeUoSIB76Am9i/7IsOlJJcJp9J8sfnD2qZIg
 5FqmJNsBGJP7p7WCSXmQ2CRxVVushpPLV8Nhq11FzwxG4EMHUIkG0t87Mkd8F+Bh
 2ymz4oeD79floMBrlsM3h6b/+SYNC5S0Sgy56jIM484TSRUZbQO/DoeGZOgj4RUl
 k4QIpnsyWVkqzMaz4q5RSLd54wNZYg1I0y+ZarPyJFG1B35o7gsxt7G1Q1io7Mcv
 3RqRoZPhBTMBWmcl8Ebi88/688+OdVevehYmSGBSYf+0A==
Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 1a29609d
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <54239 <at> debbugs.gnu.org>;
 Thu, 3 Mar 2022 16:08:01 +0000 (UTC)
From: Julien Lepiller <julien@HIDDEN>
To: 54239 <at> debbugs.gnu.org
Subject: [PATCH 1/5] gnu: Add cross-llvm.
Date: Thu,  3 Mar 2022 17:07:43 +0100
Message-Id: <499e5dba47ef40df93a8b33fbb8e41cc2354e7a1.1646322873.git.julien@HIDDEN>
X-Mailer: git-send-email 2.34.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 54239
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

* gnu/packages/llvm.scm (cross-llvm): New variable.
---
 gnu/packages/llvm.scm | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index eb949bed1b..d6e9846699 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -18,7 +18,7 @@
 ;;; Copyright © 2020 Jakub Kądziołka <kuba@HIDDEN>
 ;;; Copyright © 2021 Maxime Devos <maximedevos@HIDDEN>
 ;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
-;;; Copyright © 2021 Julien Lepiller <julien@HIDDEN>
+;;; Copyright © 2021, 2022 Julien Lepiller <julien@HIDDEN>
 ;;; Copyright © 2021 Lars-Dominik Braun <lars@HIDDEN>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@HIDDEN>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@HIDDEN>
@@ -74,7 +74,8 @@ (define-module (gnu packages llvm)
   #:use-module (srfi srfi-1)
   #:use-module (ice-9 match)
   #:export (make-lld-wrapper
-            system->llvm-target))
+            system->llvm-target
+            cross-llvm))
 
 (define* (system->llvm-target #:optional
                               (system (or (and=> (%current-target-system)
@@ -99,6 +100,22 @@ (define* (system->llvm-target #:optional
              ("i686"        => "X86")
              ("i586"        => "X86"))))
 
+(define (cross-llvm llvm target)
+  "Return a native LLVM package that targets a different system.  The resulting
+libraries are running on the host but target a different system by default.
+This packge can be used to control clang's default target."
+  (package
+    (inherit llvm)
+    (arguments
+     (substitute-keyword-arguments (package-arguments llvm)
+      ((#:configure-flags flags)
+       #~(append
+           (list
+             (string-append "-DLLVM_DEFAULT_TARGET_TRIPLE=" #$target)
+             (string-append "-DLLVM_TARGET_ARCH="
+                            #$(system->llvm-target (gnu-triplet->nix-system target))))
+           #$flags))))))
+
 (define (llvm-uri component version)
   ;; LLVM release candidate file names are formatted 'tool-A.B.C-rcN/tool-A.B.CrcN.src.tar.xz'
   ;; so we specify the version as A.B.C-rcN and delete the hyphen when referencing the file name.
-- 
2.34.0





Information forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Mar 2022 16:03:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 03 11:03:12 2022
Received: from localhost ([127.0.0.1]:43479 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nPnv6-0000KQ-3f
	for submit <at> debbugs.gnu.org; Thu, 03 Mar 2022 11:03:12 -0500
Received: from lists.gnu.org ([209.51.188.17]:35996)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <julien@HIDDEN>) id 1nPnv5-0000KJ-2M
 for submit <at> debbugs.gnu.org; Thu, 03 Mar 2022 11:03:11 -0500
Received: from eggs.gnu.org ([209.51.188.92]:59364)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <julien@HIDDEN>)
 id 1nPnv4-0005xT-KE
 for guix-patches@HIDDEN; Thu, 03 Mar 2022 11:03:10 -0500
Received: from [2a00:5884:8208::1] (port=46232 helo=lepiller.eu)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <julien@HIDDEN>)
 id 1nPnut-0006zE-Fr
 for guix-patches@HIDDEN; Thu, 03 Mar 2022 11:03:01 -0500
Received: from lepiller.eu (localhost [127.0.0.1])
 by lepiller.eu (OpenSMTPD) with ESMTP id f3be507a
 for <guix-patches@HIDDEN>; Thu, 3 Mar 2022 16:02:54 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from
 :to:subject:message-id:mime-version:content-type
 :content-transfer-encoding; s=dkim; bh=yx/9FADobAGXgNQHKltaZnHs1
 WLYRM0m7fSjyHXoqi8=; b=YAGO+L6n6iudvgGqImCaKlZDaqONlGCDnUt2cVEAS
 TSAfTn9R46wCq14nc213Ct3n4DxzzLgY2CnzBPQxv4vAsViPW5Ri7CWUvARcJG1S
 EvKXii7sV0Nb8WD9uoDfxd/E1jAZhS8lbMBj2MiYTWr1k+4zVV9DPW21/R4d0xO9
 5/hYABvnNcqbTxDodcxC7LBH1QN60bqRLFjvUWw2dsJVeuds6Lbm9fbMwrA1DAox
 TAhGIrdeFo1qNpUZkqKiF7KVp7i2qhKmJBd6dQ5vfk69aNBUoST5linKsb0gnkvm
 DDHysPWBCq5AkpAFp7NpqzW7WDC4xSXIpJHiuHge7Ftrw==
Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 80824b58
 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <guix-patches@HIDDEN>;
 Thu, 3 Mar 2022 16:02:54 +0000 (UTC)
Date: Thu, 3 Mar 2022 17:02:52 +0100
From: Julien Lepiller <julien@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] gnu: Add cross-clang.
Message-ID: <20220303170252.3caec0a6@HIDDEN>
X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:5884:8208::1 (failed)
Received-SPF: pass client-ip=2a00:5884:8208::1;
 envelope-from=julien@HIDDEN; helo=lepiller.eu
X-Spam_score_int: -12
X-Spam_score: -1.3
X-Spam_bar: -
X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RDNS_NONE=0.793,
 SPF_HELO_PASS=-0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Hi Guix!

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:

1. it actually works
2. it targets (%current-target-architecture) by default

The rest of the series ensures that libcxx and libcxxabi can be
cross-compiled with it.




Acknowledgement sent to Julien Lepiller <julien@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#54239; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 21 May 2022 13:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.