GNU bug report logs - #70985
[PATCH 0/4] Use specific errors for unsupported targets

Previous Next

Package: guix-patches;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Thu, 16 May 2024 15:01:02 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

Full log


Message #86 received at 70985 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: Efraim Flashner <efraim <at> flashner.co.il>
Cc: 70985 <at> debbugs.gnu.org
Subject: Re: [bug#70985] [PATCH v2 5/6] gnu: rust: Guard against cross-libc
 returning #f.
Date: Fri, 12 Jul 2024 14:56:04 +0100
[Message part 1 (text/plain, inline)]
Efraim Flashner <efraim <at> flashner.co.il> writes:

>> I'd also maybe stick with modify-inputs, as at least that avoids the
>> older inputs style.
>> 
>> If I've followed your first email correctly, are you thinking of
>> something like this?
>> 
>>       (native-inputs
>>        (if (target-mingw? target)
>>          (modify-inputs (package-native-inputs base-rust)
>>                         (prepend (cross-gcc target
>>                                             #:libc (cross-libc target))
>>                                  (cross-binutils target)
>>                                  (if (string=? "i686-w64-mingw32" target)
>>                                      mingw-w64-i686-winpthreads
>>                                      mingw-w64-x86_64-winpthreads)))
>>          (modify-inputs (or (and=> (cross-libc target)
>>                                    (lambda (x-libc)
>>                                      (modify-inputs
>>                                          (package-native-inputs base-rust)
>>                                        (prepend x-libc))))
>>                             (package-native-inputs base-rust))
>>                         (prepend (cross-gcc target
>>                                             #:libc (cross-libc target))
>>                                  (cross-binutils target)))))
>
> Thanks, I hate it :) That said, if it works then it's fine. (I lose my
> confidence from (cross-libc target) getting renamed to x-libc)
>
> I played around with it a bit more. The problem is that we can only
> logic our way around before modify-inputs or inside
> prepend/append/delete, so options are a bit limited as to what we can
> do. I came up with the following, which I think should also work:
>
>       (native-inputs
>        (modify-inputs (package-native-inputs base-rust)
>          (prepend (cross-binutils target))
>          (prepend
>            (cond ((and (target-mingw? target)
>                        (target-x86-32? target))
>                   mingw-w64-i686-winpthreads)
>                  ((and (target-mingw? target)
>                        (target-x86-64? target))
>                   mingw-w64-x86_64-winpthreads)
>                  ((or (target-linux? target)
>                       (target-hurd? target))
>                   (cross-libc target))
>                  ;; We need something, and duplicating cross-binutils
>                  ;; doesn't cause any problems.
>                  (#t (cross-binutils target))))
>          (prepend (cross-gcc target
>                              #:libc (cross-libc target)))))

I looked at this further and actually tried building the derivations for
different targets, and realised that there needs to be a
platform-rust-target set for it to work.

So maybe we don't need to bother with the inputs here and can just add a
guard at the top, e.g.

 (define make-rust-sysroot/implementation
   (mlambda (target base-rust)
+    (unless (platform-rust-target (lookup-platform-by-target target))
+      (raise
+       (condition
+        (&package-unsupported-target-error
+         (package base-rust)
+         (target target)))))
+


I've sent a new patch series to this effect.
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 1 year and 26 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.