From: "Ludovic Courtès" <ludo@gnu.org>
To: 44000@debbugs.gnu.org
Subject: bug#44000: Guile-Git cross-compiled to i586-pc-gnu gets bytestructures wrong
Date: Thu, 15 Oct 2020 09:42:55 +0200 [thread overview]
Message-ID: <871ri0c4u8.fsf@gnu.org> (raw)
In-Reply-To: <87v9fccuml.fsf@inria.fr> ("Ludovic Courtès"'s message of "Thu, 15 Oct 2020 00:25:54 +0200")
[-- Attachment #1: Type: text/plain, Size: 632 bytes --]
Ludovic Courtès <ludo@gnu.org> skribis:
> The problem is that the ‘cond-expand’ used to define ‘arch32bit?’ is a
> expansion-time thing when (cross-)building Bytestructures itself, so
> it’s 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.
I confirm that the attached patch for Bytestructures solves the problem
(running ‘guix pull’ in my childhurd :-)).
Let’s see whether it needs to be adapted for inclusion upstream.
Ludo’.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Correctly-define-intptr_t-co.-when-cross-compiling.patch --]
[-- Type: text/x-patch, Size: 1696 bytes --]
From a44d04ed3f7031b4ab95b2f0da81c7ab020304d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Thu, 15 Oct 2020 08:47:06 +0200
Subject: [PATCH] Correctly define 'intptr_t' & co. when cross-compiling.
Fixes <https://issues.guix.gnu.org/44000>.
* bytestructures/guile/numeric-data-model.scm (data-model): Export.
* bytestructures/body/numeric.scm (arch32bit?): Check the value of
DATA-MODEL rather than use 'cond-expand'.
---
bytestructures/body/numeric.scm | 8 ++++----
bytestructures/guile/numeric-data-model.scm | 3 ++-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/bytestructures/body/numeric.scm b/bytestructures/body/numeric.scm
index 842575d..e23cc24 100644
--- a/bytestructures/body/numeric.scm
+++ b/bytestructures/body/numeric.scm
@@ -282,10 +282,10 @@
(define long-long int64)
(define unsigned-long-long uint64)
-(define arch32bit? (cond-expand
- (lp32 #t)
- (ilp32 #t)
- (else #f)))
+(define arch32bit? (case data-model
+ ((lp32) #t)
+ ((ilp32) #t)
+ (else #f)))
(define intptr_t (if arch32bit?
int32
diff --git a/bytestructures/guile/numeric-data-model.scm b/bytestructures/guile/numeric-data-model.scm
index 773b6cd..bd40c69 100644
--- a/bytestructures/guile/numeric-data-model.scm
+++ b/bytestructures/guile/numeric-data-model.scm
@@ -1,4 +1,5 @@
-(define-module (bytestructures guile numeric-data-model))
+(define-module (bytestructures guile numeric-data-model)
+ #:export (data-model))
(import (system foreign))
(import (system base target))
--
2.28.0
next prev parent reply other threads:[~2020-10-15 7:44 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-14 22:25 bug#44000: Guile-Git cross-compiled to i586-pc-gnu gets bytestructures wrong Ludovic Courtès
2020-10-15 7:42 ` Ludovic Courtès [this message]
2020-10-15 8:09 ` Ludovic Courtès
2020-10-15 8:48 ` Mathieu Othacehe
2020-10-15 10:06 ` Jan Nieuwenhuizen
2020-10-16 15:58 ` Taylan Kammer
2020-10-17 17:44 ` Taylan Kammer
2020-10-19 8:23 ` Ludovic Courtès
2020-10-22 18:47 ` Taylan Kammer
2020-11-16 16:10 ` Ludovic Courtès
2020-11-16 17:07 ` Taylan Kammer
2020-11-16 17:37 ` Ludovic Courtès
2020-11-16 22:01 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871ri0c4u8.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=44000@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).