unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* %current-system and --system
@ 2023-03-03 15:37 Greg Hogan
  2023-03-07 12:08 ` Efraim Flashner
  2023-03-07 16:09 ` Ludovic Courtès
  0 siblings, 2 replies; 3+ messages in thread
From: Greg Hogan @ 2023-03-03 15:37 UTC (permalink / raw)
  To: Guix Help

Hi Guix,

From my x86_64 machine I am executing offload builds targeting an
aarch64 machine:

$ guix build --system=aarch64-linux --manifest=manifest.scm

Several packages do not build for aarch64 and need to be filtered out.
%current-target-system is #f as these are offload builds not cross
compilation, and %current-system is reported as "x86_64-linux". How
can I access the current "build system"?

If it helps, the manifest is defined at
https://github.com/greghogan/guix-manifest

Thanks,
Greg


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: %current-system and --system
  2023-03-03 15:37 %current-system and --system Greg Hogan
@ 2023-03-07 12:08 ` Efraim Flashner
  2023-03-07 16:09 ` Ludovic Courtès
  1 sibling, 0 replies; 3+ messages in thread
From: Efraim Flashner @ 2023-03-07 12:08 UTC (permalink / raw)
  To: Greg Hogan; +Cc: Guix Help

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

On Fri, Mar 03, 2023 at 10:37:44AM -0500, Greg Hogan wrote:
> Hi Guix,
> 
> From my x86_64 machine I am executing offload builds targeting an
> aarch64 machine:
> 
> $ guix build --system=aarch64-linux --manifest=manifest.scm
> 
> Several packages do not build for aarch64 and need to be filtered out.
> %current-target-system is #f as these are offload builds not cross
> compilation, and %current-system is reported as "x86_64-linux". How
> can I access the current "build system"?
> 
> If it helps, the manifest is defined at
> https://github.com/greghogan/guix-manifest
> 
> Thanks,
> Greg

Here's a (reduced) snippet I have from my home-config (and previously in
my manifest file):

(define %my-package-list
  (list "git"
        "git:send-email"
        "git-annex")

(define package-list
  (map (compose list specification->package+output)
       (filter (lambda (pkg)
                 (member (or (%current-system)
                             (%current-target-system))
                         (package-transitive-supported-systems
                           (specification->package+output pkg))))
              %my-package-list)))

(%current-target-system) doesn't currently work with guix-home but I
figured I'd have it ready. package-transitive-supported-systems makes it
so that git-annex, which shows as supported on aarch64-linux, isn't
added because ghc, one of its dependencies, isn't supported on
aarch64-linux.


-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: %current-system and --system
  2023-03-03 15:37 %current-system and --system Greg Hogan
  2023-03-07 12:08 ` Efraim Flashner
@ 2023-03-07 16:09 ` Ludovic Courtès
  1 sibling, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2023-03-07 16:09 UTC (permalink / raw)
  To: Greg Hogan; +Cc: Guix Help

Hi,

Greg Hogan <code@greghogan.com> skribis:

> From my x86_64 machine I am executing offload builds targeting an
> aarch64 machine:
>
> $ guix build --system=aarch64-linux --manifest=manifest.scm
>
> Several packages do not build for aarch64 and need to be filtered out.
> %current-target-system is #f as these are offload builds not cross
> compilation, and %current-system is reported as "x86_64-linux". How
> can I access the current "build system"?

Not via ‘%current-system’ because at the time the manifest is evaluated,
it can be bound to anything, as you saw.

What you could do is wrap packages in ‘let-system’, which lets you check
the “current system” as the time the object is “lowered” (untested):

  (define (package-or-emptiness p)
    (let-system system
      (if (supported-package? p system)
          p
          (plain-file "emptyness" "Nothing to see here."))))

   (manifest
    (map (lambda (p)
           (manifest-entry
             (inherit (package->manifest-entry p))
             (item (package-or-emptiness p))))
         the-packages))

Obviously that’s not great because you still end up with entries for
non-existing packages.  It’s good enough for ‘guix build -m’ though.

HTH!

Ludo’.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-07 16:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-03 15:37 %current-system and --system Greg Hogan
2023-03-07 12:08 ` Efraim Flashner
2023-03-07 16:09 ` Ludovic Courtès

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).