From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id NvWUH0R7h186WAAA0tVLHw (envelope-from ) for ; Wed, 14 Oct 2020 22:27:16 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id sCYxG0R7h19uCgAA1q6Kng (envelope-from ) for ; Wed, 14 Oct 2020 22:27:16 +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 A4D479400C9 for ; Wed, 14 Oct 2020 22:27:15 +0000 (UTC) Received: from localhost ([::1]:57076 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSpEn-00037B-97 for larch@yhetil.org; Wed, 14 Oct 2020 18:27:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSpEc-000371-RD for bug-guix@gnu.org; Wed, 14 Oct 2020 18:27:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41829) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kSpEc-0008DV-Hh for bug-guix@gnu.org; Wed, 14 Oct 2020 18:27:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kSpEc-0006Su-EQ for bug-guix@gnu.org; Wed, 14 Oct 2020 18:27:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#44000: Guile-Git cross-compiled to i586-pc-gnu gets bytestructures wrong Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 14 Oct 2020 22:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 44000 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 44000@debbugs.gnu.org X-Debbugs-Original-To: Received: via spool by submit@debbugs.gnu.org id=B.160271436824777 (code B ref -1); Wed, 14 Oct 2020 22:27:02 +0000 Received: (at submit) by debbugs.gnu.org; 14 Oct 2020 22:26:08 +0000 Received: from localhost ([127.0.0.1]:53375 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kSpDk-0006RY-8C for submit@debbugs.gnu.org; Wed, 14 Oct 2020 18:26:08 -0400 Received: from lists.gnu.org ([209.51.188.17]:45824) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kSpDg-0006RP-V1 for submit@debbugs.gnu.org; Wed, 14 Oct 2020 18:26:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50106) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSpDe-00033T-7w for bug-guix@gnu.org; Wed, 14 Oct 2020 18:26:02 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37712) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSpDc-00086e-6b for bug-guix@gnu.org; Wed, 14 Oct 2020 18:26:01 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=49766 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kSpDY-00012I-E9 for bug-guix@gnu.org; Wed, 14 Oct 2020 18:25:59 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 23 =?UTF-8?Q?Vend=C3=A9miaire?= an 229 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 15 Oct 2020 00:25:54 +0200 Message-ID: <87v9fccuml.fsf@inria.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: -1.51 X-TUID: qHe0uev58ILP Hello! You might have seen that =E2=80=98guix pull=E2=80=99 doesn=E2=80=99t work i= n your childhurd: --8<---------------cut here---------------start------------->8--- Updating channel 'guix' from Git repository at 'https://git.savannah.gnu.or= g/git/guix.git'... guix pull: error: Git error: invalid version 0 on git_proxy_options --8<---------------cut here---------------end--------------->8--- This is due to an ABI breakage whereby the Guile-Git code (cross-compiled from x86_64-linux) fills in the =E2=80=98fetch_opts=E2=80= =99 member of =E2=80=98git_clone=C2=A0options=E2=80=99 offset by one word. On closer inspection, the problem is: --8<---------------cut here---------------start------------->8--- scheme@(git structs)> (bytestructure-descriptor-size (bs:struct `(("x" ,(bs= :pointer uint8)) ("y" ,size_t)))) $20 =3D 12 scheme@(git structs)> %host-type $21 =3D "i586-pc-gnu" --8<---------------cut here---------------end--------------->8--- Compare with the correct answer: --8<---------------cut here---------------start------------->8--- $ guix environment --ad-hoc -C -s i686-linux guile guile-bytestructures --= guile [...] scheme@(guile-user)> ,use(bytestructures guile) scheme@(guile-user)> %host-type $1 =3D "i686-unknown-linux-gnu" scheme@(guile-user)> (bytestructure-descriptor-size (bs:struct `(("x" ,(bs:= pointer uint8))("y" ,size_t)))) $2 =3D 8 --8<---------------cut here---------------end--------------->8--- More specifically, the size of =E2=80=98size_t=E2=80=99 is wrong, but point= er size is right: --8<---------------cut here---------------start------------->8--- scheme@(git structs)> (bytestructure-descriptor-size size_t) $27 =3D 8 scheme@(git structs)> (bytestructure-descriptor-size uintptr_t ) $28 =3D 8 scheme@(git structs)> (bytestructure-descriptor-size (bs:pointer uint8)) $29 =3D 4 --8<---------------cut here---------------end--------------->8--- =E2=80=98numeric.scm=E2=80=99 in bytestructures reads: --8<---------------cut here---------------start------------->8--- (define arch32bit? (cond-expand (lp32 #t) (ilp32 #t) (else #f))) ;; =E2=80=A6 (define uintptr_t (if arch32bit? uint32 uint64)) (define size_t uintptr_t) --8<---------------cut here---------------end--------------->8--- But (bytestructures guile numeric-data-model) has this: --8<---------------cut here---------------start------------->8--- (define data-model (if (=3D 4 (sizeof '*)) (if (=3D 2 (sizeof int)) 'lp32 'ilp32) (cond ((=3D 8 (sizeof int)) 'ilp64) ((=3D 4 (sizeof long)) 'llp64) (else 'lp64)))) (cond-expand-provide (current-module) (list architecture data-model)) --8<---------------cut here---------------end--------------->8--- The problem is that the =E2=80=98cond-expand=E2=80=99 used to define =E2=80= =98arch32bit?=E2=80=99 is a expansion-time thing when (cross-)building Bytestructures itself, so it=E2=80=99s incorrect from cross-building from 64-bit to 32-bit. I believe that changing it to: (define arch32bit? (memq data-model '(ilp32 lp32))) would fix it because then the test would happen at run time. (Note that Guile-Git uses only the procedural layer of Bytestructures. The syntactic layer is likely not cross-compilation-capable for similar reasons.) To be continued=E2=80=A6 Thanks, Ludo=E2=80=99.