all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: Efraim Flashner <efraim@flashner.co.il>
Cc: 70985@debbugs.gnu.org
Subject: [bug#70985] [PATCH v2 5/6] gnu: rust: Guard against cross-libc returning #f.
Date: Fri, 12 Jul 2024 14:56:04 +0100	[thread overview]
Message-ID: <87msmm7lzf.fsf@cbaines.net> (raw)
In-Reply-To: <Zo1VYQlcrrqv6Uld@pbp> (Efraim Flashner's message of "Tue, 9 Jul 2024 18:21:05 +0300")

[-- Attachment #1: Type: text/plain, Size: 3266 bytes --]

Efraim Flashner <efraim@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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

  reply	other threads:[~2024-07-12 13:57 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-16 14:59 [bug#70985] [PATCH 0/4] Use specific errors for unsupported targets Christopher Baines
2024-05-16 15:06 ` [bug#70985] [PATCH 1/4] guix: packages: Add new &package-unsupported-target-error Christopher Baines
2024-05-16 15:06   ` [bug#70985] [PATCH 2/4] gnu: tls: Raise conditions from target->openssl-target Christopher Baines
2024-05-16 15:06   ` [bug#70985] [PATCH 3/4] gnu: cross-libc*: Raise conditions rather than returning #f Christopher Baines
2024-05-16 15:15     ` Ludovic Courtès
2024-05-16 16:16       ` Christopher Baines
2024-05-16 15:06   ` [bug#70985] [PATCH 4/4] guix: build-system: meson: Don't error on unsupported targets Christopher Baines
2024-05-16 15:13     ` Ludovic Courtès
2024-05-16 16:10       ` Christopher Baines
2024-05-16 15:16 ` [bug#70985] [PATCH 0/4] Use specific errors for " Ludovic Courtès
2024-05-17  9:53 ` [bug#70985] [PATCH 3/4] gnu: cross-libc*: Raise conditions rather than returning #f Jean-Pierre De Jesus Diaz
2024-07-05 16:05 ` [bug#70985] [PATCH v2 1/6] guix: packages: Add new &package-unsupported-target-error Christopher Baines
2024-07-05 16:05   ` [bug#70985] [PATCH v2 2/6] gnu: tls: Raise conditions from target->openssl-target Christopher Baines
2024-07-05 16:06   ` [bug#70985] [PATCH v2 3/6] guix: packages: Add &unsupported-cross-compilation-target-error Christopher Baines
2024-07-05 16:06   ` [bug#70985] [PATCH v2 4/6] build-system: meson: Use a more specific exception Christopher Baines
2024-07-05 16:06   ` [bug#70985] [PATCH v2 5/6] gnu: rust: Guard against cross-libc returning #f Christopher Baines
2024-07-07 16:26     ` Efraim Flashner
2024-07-07 16:57     ` Efraim Flashner
2024-07-09  9:25       ` Christopher Baines
2024-07-09 15:21         ` Efraim Flashner
2024-07-12 13:56           ` Christopher Baines [this message]
2024-07-05 16:06   ` [bug#70985] [PATCH v2 6/6] build-system: go: Properly handle when a target is unsupported Christopher Baines
2024-07-12 13:41 ` [bug#70985] [PATCH v3 1/6] guix: packages: Add new &package-unsupported-target-error Christopher Baines
2024-07-12 13:41   ` [bug#70985] [PATCH v3 2/6] gnu: tls: Raise conditions from target->openssl-target Christopher Baines
2024-07-12 13:41   ` [bug#70985] [PATCH v3 3/6] guix: packages: Add &unsupported-cross-compilation-target-error Christopher Baines
2024-07-12 13:41   ` [bug#70985] [PATCH v3 4/6] build-system: meson: Use a more specific exception Christopher Baines
2024-07-12 13:41   ` [bug#70985] [PATCH v3 5/6] gnu: rust: Guard against unsupported rust targets Christopher Baines
2024-07-12 14:28     ` Efraim Flashner
2024-07-18 14:16       ` bug#70985: " Christopher Baines
2024-07-12 13:41   ` [bug#70985] [PATCH v3 6/6] build-system: go: Properly handle when a target is unsupported Christopher Baines

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87msmm7lzf.fsf@cbaines.net \
    --to=mail@cbaines.net \
    --cc=70985@debbugs.gnu.org \
    --cc=efraim@flashner.co.il \
    /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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.