[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#44000: Guile-Git cross-compiled to i586-pc-gnu gets bytestructures w
From: |
Ludovic Courtès |
Subject: |
bug#44000: Guile-Git cross-compiled to i586-pc-gnu gets bytestructures wrong |
Date: |
Thu, 15 Oct 2020 09:42:55 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
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’.
>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