GNU bug report logs - #48525
[PATCH core-updates] gnu: rust: Add profiling support.

Previous Next

Package: guix-patches;

Reported by: Milkey Mouse <milkeymouse <at> meme.institute>

Date: Wed, 19 May 2021 18:39:01 UTC

Severity: normal

Tags: patch

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #25 received at 48525-done <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Milkey Mouse <milkeymouse <at> meme.institute>
Cc: Marius Bakke <mbakke <at> fastmail.com>, 48525-done <at> debbugs.gnu.org
Subject: Re: bug#48525: [PATCH core-updates] gnu: rust: Add profiling support.
Date: Sat, 20 Jan 2024 17:42:51 -0500
Hi,

Milkey Mouse <milkeymouse <at> meme.institute> writes:

> * gnu/packages/rust.scm (rust-1.52)
> [phases]{unpack-profiler-rt, enable-profiling}: New phases.
> [native-inputs]{compiler-rt-source}: New input.
> ---
>  gnu/packages/rust.scm | 24 +++++++++++++++++++++++-
>  1 file changed, 23 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
> index 6b769bfab2..7b77d791d1 100644
> --- a/gnu/packages/rust.scm
> +++ b/gnu/packages/rust.scm
> @@ -853,7 +853,29 @@ safety and thread safety guarantees.")
>        (inherit base-rust)
>        (inputs
>          (alist-replace "llvm" (list llvm-12)
> -                       (package-inputs base-rust))))))
> +                       (package-inputs base-rust)))
> +      ;; Add compiler-rt-source for libprofiler_builtins (needed for profiling
> +      ;; support), which normally vendors its own copy of compiler-rt.
> +      (native-inputs (cons*
> +                      `("compiler-rt-source" ,(package-source clang-runtime-12))
> +                      (package-native-inputs base-rust)))
> +      (arguments
> +       (substitute-keyword-arguments (package-arguments base-rust)
> +         ((#:phases phases)
> +          `(modify-phases ,phases
> +             (add-after 'unpack 'unpack-profiler-rt
> +               ;; Copy compiler-rt sources to where libprofiler_builtins
> +               ;; looks for its vendored copy.
> +               (lambda* (#:key inputs #:allow-other-keys)
> +                 (mkdir-p "src/llvm-project/compiler-rt")
> +                 (invoke "tar" "-xf" (assoc-ref inputs "compiler-rt-source")
> +                   "-C" "src/llvm-project/compiler-rt" "--strip-components=1")
> +                   #t))
> +             (add-after 'enable-codegen-tests 'enable-profiling
> +               (lambda _
> +                 (substitute* "config.toml"
> +                   (("^profiler =.*$") "")
> +                   (("[[]build[]]") "\n[build]\nprofiler = true\n")))))))))))
>  
>  ;;; Note: Only the latest versions of Rust are supported and tested.  The
>  ;;; intermediate rusts are built for bootstrapping purposes and should not

I've ported this change to our current rust (using clang-runtime-15 to
match the llvm version used) and added it to the queued changes I'll
push shortly.

-- 
Thanks,
Maxim




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

Previous Next


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