Subject: [bug#40556] [PATCH] gnu: dovecot: Add libunwind input.

From: Pierre Langlois <[email-masked]>
Date: Thu, 16 Apr 2020 19:13:21 +0200

Hi Ludo!

Ludovic Courtès writes:

> Hi,
>
> Pierre Langlois <[email-masked]> skribis:
>
>> +       ;; FIXME: The 'test-backtrace' tests fail on arm when using glibc's
>> +       ;; backtrace_symbol() function so fallback to using libunwind.
>> +       ,@(match (or (%current-target-system) (%current-system))
>> +           ((or "aarch64-linux" "armhf-linux")
>> +            `(("libunwind" ,libunwind)))
>> +           (_ '()))
>
> This isn’t quite correct because ‘%current-target-system’ returns a
> triplet, like “arm-linux-gnueabihf”.

Oups, I didn't realize the cross-compilation target was different.

>
> Use ‘target-arm?’ instead.

Yep, that works really nicely, it's much clearer.

I've tested on x86_64, arm and aarch64 natively. I'll try
cross-compiling with --target=arm-linux-gnueabihf and
--target=aarch64-linux-gnu as well but that'll take a little longer.

Thanks!
Pierre

>From d56005a2d839e36cd9f718041d8634f34cf2177a Mon Sep 17 00:00:00 2001
From: Pierre Langlois <[email-masked]>
Date: Sat, 11 Apr 2020 16:34:01 +0100
Subject: [PATCH] gnu: dovecot: Add libunwind input for arm.

* gnu/packages/mail.scm (dovecot)[inputs]: Add libunwind when targetting arm.
---
 gnu/packages/mail.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 0a88c20a6e..8d55d157e5 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -24,7 +24,7 @@
 ;;; Copyright © 2017 Kyle Meyer <[email-masked]>
 ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2017, 2018 Rene Saavedra <[email-masked]>
-;;; Copyright © 2018, 2019 Pierre Langlois <[email-masked]>
+;;; Copyright © 2018, 2019, 2020 Pierre Langlois <[email-masked]>
 ;;; Copyright © 2018 Alex Vong <[email-masked]>
 ;;; Copyright © 2018 Gábor Boskovits <[email-masked]>
 ;;; Copyright © 2018, 2019, 2020 Ricardo Wurmus <[email-masked]>
@@ -89,6 +89,7 @@
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages libidn)
   #:use-module (gnu packages libunistring)
+  #:use-module (gnu packages libunwind)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages lsof)
   #:use-module (gnu packages lua)
@@ -1435,6 +1436,11 @@ facilities for checking incoming mail.")
     (inputs
      `(("bzip2" ,bzip2)
        ("libsodium" ,libsodium)         ; extra password algorithms
+       ;; FIXME: The 'test-backtrace' tests fail on arm when using glibc's
+       ;; backtrace_symbol() function so fallback to using libunwind.
+       ,@(if (target-arm?)
+          `(("libunwind" ,libunwind))
+          '())
        ("linux-pam" ,linux-pam)
        ("lz4" ,lz4)
        ("openssl" ,openssl)
-- 
2.26.1