From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 2M+BA4wLLWGzawAAgWs5BA (envelope-from ) for ; Mon, 30 Aug 2021 18:47:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id sFmnOosLLWGCHQAAbx9fmQ (envelope-from ) for ; Mon, 30 Aug 2021 16:47:07 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8AF44C0C1 for ; Mon, 30 Aug 2021 18:47:07 +0200 (CEST) Received: from localhost ([::1]:57126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mKkR8-0007qM-NL for larch@yhetil.org; Mon, 30 Aug 2021 12:47:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKkR4-0007qE-Gt for guix-patches@gnu.org; Mon, 30 Aug 2021 12:47:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48566) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mKkR4-0006yg-6N for guix-patches@gnu.org; Mon, 30 Aug 2021 12:47:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mKkR3-00025D-UW for guix-patches@gnu.org; Mon, 30 Aug 2021 12:47:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50201] [PATCH core-updates-frozen 0/52] Support cross-compilation in glib-or-gtk-build-system and fix cross-compilation errors Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 30 Aug 2021 16:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50201 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: 50201@debbugs.gnu.org Received: via spool by 50201-submit@debbugs.gnu.org id=B50201.16303419697933 (code B ref 50201); Mon, 30 Aug 2021 16:47:01 +0000 Received: (at 50201) by debbugs.gnu.org; 30 Aug 2021 16:46:09 +0000 Received: from localhost ([127.0.0.1]:60112 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKkQC-00023s-PE for submit@debbugs.gnu.org; Mon, 30 Aug 2021 12:46:09 -0400 Received: from laurent.telenet-ops.be ([195.130.137.89]:60202) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mKkQ7-00023L-75 for 50201@debbugs.gnu.org; Mon, 30 Aug 2021 12:46:06 -0400 Received: from ptr-bvsjgyjmffd7q9timvx.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by laurent.telenet-ops.be with bizsmtp id nsm12501B0mfAB401sm1go; Mon, 30 Aug 2021 18:46:01 +0200 Message-ID: <8b124a24c7ffc56efcb0b44b064bce0ff0085123.camel@telenet.be> From: Maxime Devos Date: Mon, 30 Aug 2021 18:45:48 +0200 In-Reply-To: <87sfyr9jff.fsf_-_@gnu.org> References: <20210825180332.5720-1-maximedevos@telenet.be> <20210825180332.5720-17-maximedevos@telenet.be> <87sfyr9jff.fsf_-_@gnu.org> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-WZYAKHhGZus3SUCja51F" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1630341961; bh=GbGEVlRDzb8iJWtoeDeguqJagXTU7czNZUv8enL20p4=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=CBNQXTE3wQy1Tne2ssi9E+lydH2Lp1ZsaJxswjacsnhC1EUoHF7310o8FneEqsIv4 YMOFmUjZYvQjjzpczx+YbwlvTqFqpn2C4J4qKMHwWAEahj3v8hKzmzZVJZ7V98nuRK kHKvvePGvehUKb2juzPhJ2yfW6k/9efoqwyQXNmsKvK5E1KNBhoYQabAGv/9cyqUCn z1OLZGBHm3DpE471joX+66J0irOYzU3r8y8iZzubB8+URg3E1XpMaeVSao5ooE9Rgp cUw80wzfQZ4noUvHSbbuqK/0c5tf44ugQgxfJ3yQfDM3sGhBlrgETkrLZfl+QWpiHm 6PTIBxV0EWxwQ== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1630342027; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=GbGEVlRDzb8iJWtoeDeguqJagXTU7czNZUv8enL20p4=; b=tdryTJB0BMlAut/9yHs/svmP3g+uk8z5TJoAnP4c2JNDqMX93InaapjHn5FZe4+qTJ3QQZ hFvhcgQ40rkCKcB7W4PRAG+Ivh/ZEBaQYGSQOsU3G44TPPthRhTcCDiqG0TpGsL0WWU+jp sKWmFpWOx3MXeJdhUNeGyV1xfE/EeN789JcTZLp1nFQ7cUkhfs+yxgQa2by93GEhgZDKEE PP6E3pfuvucD7Boir8WIOcKnI/vq/fw5AZsAcGcT0bmtHktzHNEtBaDnV3G8y8mDnMXY3J 1G38e5aCvfsc6FlBYl8Z41lDTZz+aKYCOBqVf2P+Im5P+bYHyh0G0HS5eIYtiw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630342027; a=rsa-sha256; cv=none; b=qT2vhY4yIpxBHbrFnrbLYI1mAiEs0IMq9fkqt5y/rMOYh48WRrsp37XImpEfai1C7E9P14 fXRgxuwCgPnC+hDjoDj5xJdVqkPSX79YZ4tZeZ7g+DYocCuQ+diIuMpGzu5O2FTd8/Ggkh LIZhIiBysUos3dcSzqXpqKDyrhnx4unDjIBW3ZplsBCR4UDbrTxAqhXzszs7/BhjiS/h6q ZTM8dOgozbGb4hnBcCPGxPrRECyXfYD4ws3rEJQF/EUZxxq56XC6kIrMNDDl5ACPI3Ndkg Rqm76yFzRBg+0yt52HkFoZzQodqpAybbmkKR+HPb+l/eliCHav7Ys8TNdA48Tg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=CBNQXTE3; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -3.42 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r21 header.b=CBNQXTE3; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 8AF44C0C1 X-Spam-Score: -3.42 X-Migadu-Scanner: scn0.migadu.com X-TUID: RChhaFC+fJOi --=-WZYAKHhGZus3SUCja51F Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Mathieu Othacehe schreef op ma 30-08-2021 om 15:00 [+0200]: > Hey, >=20 > > + ;; introspection requires running binaries for the host= system > > + ;; on the build system. > > + '("-Dintrospection=3Dfalse")) >=20 > Nix is often ahead of Guix regarding cross-compilation support. Did you > have a chance to see how they are dealing with introspection in the > context of cross-compilation? It appears that, say, atk can be cross-compiled on Nix, but other than that= , Nix doesn't seem to be ahead here. We seem to be in good company here. I = found the following Nix setting -Dintrospection=3Dfalse too when cross-compiling: https://github.com/NixOS/nixpkgs/issues/72868 Nix people finding gobject-introspection is hard to cross-compile https://github.com/NixOS/nixpkgs/issues?q=3Dis%3Aissue+is%3Aopen+introspect= ion Nix people using an emulator (presumably QEMU?): https://github.com/NixOS/nixpkgs/pull/88222/files Unfortunately, it appears that introspection data is architecture-dependent= : , so just copying over the data from a natively compiled version won't work (*). One =E2=80=98solution=E2=80=99 is to run g-ir-scanner under QEMU: . That isn't really cross-comp= ilation though, but emulated compilation, so it won't work with the Hurd. Might be good enough for cross-compiling between Linux targets though ... Here is an alternative idea that I won't attempt in this patch series: (*) One solution would be to copy it over anyway and substitute things(***)= where needed, and re-generate the typelib data. That seems rather prone to mistakes = though, so maybe we should then hash the adjusted introspection data and compar= e the hash to the hash of what we now the introspection data must be (**). Of course, we can't just guess that, so maybe when compiling atk native= ly for, say, x86_64-linux, a message =E2=80=98new introspection hashes: ("x86_64-linux-gnu" ("Atk-1.0" "THE-= HASH"))=E2=80=99 or =E2=80=98stale introspection hash: "Atk-1.0" "THE-OLD-HASH" "THE-NEW-HA= SH" followed by: =E2=80=98Please add it to #:gir-hashes to help cross-compilers.=E2=80= =99 could be printed (maybe even fail the build?). This hash checking and substitution could be implemented with an additi= onal build phase for meson-build-system (#:gir would be an additional argume= nt for meson-build-system). Something like: (package (name "atk") [...] (arguments `(#:gir-hashes (("x86_64-linux-gnu" ("Atk-1.0" "THE-HASH")) ("powerpc64-linux-gnu" ("Atk-1.0" ;; XXX(core-updates): We forgot to update the hash, ;; and now we're stuck with it unless we want a world-rebuild ;; for powerpc64le-linux (other architectures would be unaffec= ted). ;; Use the right hash when cross-compiling. ,(if (%current-target-system) "THE-CORRECT-HASH" "THE-OLD-HASH")) ;; XXX I forgot the triplet, imagine you saw the triplet here in= stead ... ("i586-hurd" ...) ...) #:gir-substitutions ;; TODO: need to thing of a good scheme here ... ((replace-value c:identifier "ARCHITECTURE_DEPENDENT" ((? architecture "ppc64le") "x") ((? ...) "y")) (replace-value c:identifier "KERNEL_DEPENDENT" ((? kernel-os "linux-gnu") "x") ((? kernel-os "gnu") "y")) ;; Only x86_64 has this quirk. (replace-value c:identifier "QUIRK" ((? architecture "x86_64") "yes) (otherwise "no")))) [...]) A limitation of this solution is that someone needs to compile it nativ= ely for the target architecture first (possibly emulated with QEMU). (**) The .gir includes the name of the shared library, so maybe compute the= hash modulo store references to avoid invalidating the reference hashes eve= ry time an (indirect) dependency is updated. (***) An ordinary 'substitute*' won't work well, something specific for .gi= r XML would be needed. E.g., consider the following (in this case architec= ture-independent) snippet from Atk-1.0.gir: An object which is an alert to the user. Assistive= Technologies typically respond to ATK_ROLE_ALERT by reading the entire ons= creen co> Sometimes the =E2=80=98value=3D"..."=E2=80=99 part is architecture-de= pendent, and needs to be adjusted for the target architecture. Greetings, Maxime. --=-WZYAKHhGZus3SUCja51F 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+4iGRcl7gUCYS0LPRccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7nvoAQCrF4LCmZvZKx450LDekpNqAxLE P8qUIEod8PQbj30ARgD+MKFqCOarK1iXbwDUwWGVr5oHNO8IJ1zgWkNzHk2wPwc= =CWni -----END PGP SIGNATURE----- --=-WZYAKHhGZus3SUCja51F--