GNU bug report logs -
#44000
Guile-Git cross-compiled to i586-pc-gnu gets bytestructures wrong
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Ludovic Courtès <ludo <at> 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’.
[0001-Correctly-define-intptr_t-co.-when-cross-compiling.patch (text/x-patch, inline)]
From a44d04ed3f7031b4ab95b2f0da81c7ab020304d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo <at> 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
This bug report was last modified 4 years and 215 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.