unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Thiago Jung Bauermann via Guix-patches via <guix-patches@gnu.org>
To: 49569@debbugs.gnu.org, Efraim Flashner <efraim@flashner.co.il>
Subject: [bug#49569] [PATCH] gnu: Add make-single-arch-llvm procedure.
Date: Tue, 27 Jul 2021 10:09:19 -0300	[thread overview]
Message-ID: <2615631.XO7ydEMPkx@popigai> (raw)
In-Reply-To: <77ec80a001bb04229289f1e3efff7633c94c71dc.1626343320.git.efraim@flashner.co.il>

Hello,

Em quinta-feira, 15 de julho de 2021, às 07:04:52 -03, Efraim Flashner
escreveu:
> * gnu/packages/llvm.scm (make-single-arch-llvm): New procedure.
> (llvm-native-12, llvm-native): New variables.
> ---
> 
> Using this copy of llvm for packages like mesa will reduce the closure
> of those packages. I don't suppose it would work as well for compilers
> like rust which use LLVM for compiling and targeting different
> architectures.
> 
> This drops the size of llvm-12 from 167M to 111M.

I don’t have an opinion on the issue that Ludo’ raised, just one comment
about the code below.

>  gnu/packages/llvm.scm | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
> index 575c63c713..35cecdfd84 100644
> --- a/gnu/packages/llvm.scm
> +++ b/gnu/packages/llvm.scm
> @@ -1347,3 +1347,27 @@ LLVM."))))
>  (define-public ocaml-llvm-9 (make-ocaml-llvm llvm-9))
>  (define-public ocaml-llvm-10 (make-ocaml-llvm llvm-10))
>  (define-public ocaml-llvm-11 (make-ocaml-llvm llvm-11))
> +
> +(define* (make-single-arch-llvm llvm #:optional (system (or (%current-target-system)
> +                                                            (%current-system))))
> +  (package
> +    (inherit llvm)
> +    (name (string-append "llvm-for-" (string-downcase
> +                                       (system->llvm-target system))))

‘system->llvm-target’ needs a Nix system identifier but
‘%current-target-system’ contains a GNU triplet, so the above won’t work
when cross-compiling for armhf-linux – whose GNU triplet is
“arm-unknown-linux-gnueabihf”.

I suggest changing the default value of ‘system’ to

    (or (and=> (%current-target-system) gnu-triplet->nix-system)
        (%current-system))

which is the default argument for ‘system->llvm-target’.

If I can add a shameless plug, patch 2 of my “Target check fixes and
cleanups” series¹ adds a helper procedure with the code above. :-)

> +    (arguments
> +     (substitute-keyword-arguments (package-arguments llvm)
> +       ((#:configure-flags cf)
> +        `(cons* ,(string-append "-DLLVM_TARGETS_TO_BUILD="
> +                                (system->llvm-target system))

Same problem here.

-- 
Thanks,
Thiago

¹ https://issues.guix.gnu.org/49672






      parent reply	other threads:[~2021-07-27 13:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-15 10:04 [bug#49569] [PATCH] gnu: Add make-single-arch-llvm procedure Efraim Flashner
2021-07-26 16:47 ` Ludovic Courtès
2021-07-27 12:29   ` Efraim Flashner
2021-07-27 17:10     ` Ludovic Courtès
2023-01-30 18:12       ` bug#49569: " Efraim Flashner
2021-07-27 13:09 ` Thiago Jung Bauermann via Guix-patches via [this message]

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=2615631.XO7ydEMPkx@popigai \
    --to=guix-patches@gnu.org \
    --cc=49569@debbugs.gnu.org \
    --cc=bauermann@kolabnow.com \
    --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 public inbox

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

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