[PATCH] gnu: dovecot: Add libunwind input.

  • Done
  • quality assurance status badge
Details
4 participants
  • Julien Lepiller
  • Ludovic Courtès
  • Tobias Geerinckx-Rice
  • Pierre Langlois
Owner
unassigned
Submitted by
Pierre Langlois
Severity
normal
P
P
Pierre Langlois wrote on 11 Apr 2020 17:42
(address . guix-patches@gnu.org)(name . Julien Lepiller)(address . julien@lepiller.eu)
87ftdahvut.fsf@gmx.com
Hi Guix, Julien,

I noticed I couldn't build dovecot on either aarch64 or arm :-/. I did a
little bit of debugging, and it looks like the backtrace_symbols()
function isn't working correctly. Dovecot is able to use libunwind
instead, and this appears to work.

I then noticed it was reported upstream already, coming to the same

I wonder what's wrong with backtrace_symbols() in guix, I'm not sure how
to investigate that. For now though, what do you think of using
libunwind?

Thanks,
Pierre
From b95b8f4769f5543d196fe7e334a891f8fe276816 Mon Sep 17 00:00:00 2001
From: Pierre Langlois <pierre.langlois@gmx.com>
Date: Sat, 11 Apr 2020 16:34:01 +0100
Subject: [PATCH] gnu: dovecot: Add libunwind input.

* gnu/packages/mail.scm (dovecot)[inputs]: Add libunwind.
---
gnu/packages/mail.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Toggle diff (31 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index a6ed776db1..4ea8fb6051 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -24,7 +24,7 @@
;;; Copyright © 2017 Kyle Meyer <kyle@kyleam.com>
;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2017, 2018 Rene Saavedra <pacoon@protonmail.com>
-;;; Copyright © 2018, 2019 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2018, 2019, 2020 Pierre Langlois <pierre.langlois@gmx.com>
;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
;;; Copyright © 2018 Gábor Boskovits <boskovits@gmail.com>
;;; Copyright © 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
@@ -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,7 @@ facilities for checking incoming mail.")
(inputs
`(("bzip2" ,bzip2)
("libsodium" ,libsodium) ; extra password algorithms
+ ("libunwind" ,libunwind)
("linux-pam" ,linux-pam)
("lz4" ,lz4)
("openssl" ,openssl)
--
2.26.0
T
T
Tobias Geerinckx-Rice wrote on 11 Apr 2020 18:17
875ze6ngmg.fsf@nckx
Pierre,

Pierre Langlois ???
Toggle quote (5 lines)
> I wonder what's wrong with backtrace_symbols() in guix, I'm not
> sure how
> to investigate that. For now though, what do you think of using
> libunwind?

OK, but it should only be included on platforms that require it:

;; Untested…
(inputs
`(…
,@(match (%current-system)
((or "aarch64-linux" "armhf-linux" …)
`(("libunwind" ,libunwind)))
(_ `()))
…))

Could you test that?

Kind regards,

T G-R
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEfo+u0AlEeO9y5k0W2Imw8BjFSTwFAl6R7YUACgkQ2Imw8BjF
STx6IQ//WPLh4KGleeZLs1RtOHT96fZ4qvJF/w1Xofg3o8OHroyoHiQ3w4BzeLTR
tCM5S0m1QqZjJd/zyEK903a4LMGORUvjHtLyUgZ0IhQCX4vF0f70ckS0CsppXl5e
YE+rGhR4hfOdwlpQz5VPz65YDsuT5OkmG8Bv3H2ijVSvTcF/UR9IXIl/64CqnhVH
q7/qKOwfMMoRLqbcMeH2fAMogCPLn1m5TZ2R2jWh8NeBr5wRfcfgO2CiORk1+orN
YjAPLkQ57N6nsIrIgffvtMDUmWN+qX3ngLgIWPrBBecP8fwNeMKw8KphBRDmjDm4
skWT9Ttnq9Vkoi7YOqwKJ2PnAlNjE0MzjiKEf553VjhWvGfdEknQ64yBcsMeJJpi
gHPBEajMTV74ub/CxCeC+eHfAf/nV4XB+LlTfiZ4TCArFa6R6AyGl5ZvxzGtT/U1
TxyEmXA2yHhfyYD434Z3Vn5akMiz8qMs48OyHT3NLzuCP2jrnnlmjSdy4eWgtWfp
apXN20GqzA/iyzj2+TJuemH+cDmBgJ7lOB69SikrLqUDMSSZOs0A24NlQWEdrlN5
K9ecySaIzSxqLJsvpWsKefSFVDZmjuBdaTLXMVhGPnNjHJSO7r3y9w6TlI3NQ3s+
OXL14DW2YnpysOKk9KCZjDRUjRVxnbur0aGqP3EOrPsqexrSkNM=
=lj1o
-----END PGP SIGNATURE-----

P
P
Pierre Langlois wrote on 11 Apr 2020 18:53
(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)
87eesuhsl2.fsf@gmx.com
Tobias Geerinckx-Rice writes:

Toggle quote (10 lines)
> Pierre,
>
> Pierre Langlois ???
>> I wonder what's wrong with backtrace_symbols() in guix, I'm not sure
>> how
>> to investigate that. For now though, what do you think of using
>> libunwind?
>
> OK, but it should only be included on platforms that require it:

Oh sure thing!

Toggle quote (12 lines)
>
> ;; Untested…
> (inputs
> `(…
> ,@(match (%current-system)
> ((or "aarch64-linux" "armhf-linux" …)
> `(("libunwind" ,libunwind)))
> (_ `()))
> …))
>
> Could you test that?

OK, the following patch works for me (tested building for armhf and
aarch64 on a rockpro64). I've also added a "FIXME" comment to mention
the issue so we can remove/keep it when we have a good understanding of
what's going on.
From ea4c7a2dec7c81951cf0d27cbb669ef39b07de95 Mon Sep 17 00:00:00 2001
From: Pierre Langlois <pierre.langlois@gmx.com>
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 if the system is
either aarch64-linux or armhf-linux.
---
gnu/packages/mail.scm | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

Toggle diff (36 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index a6ed776db1..91577f72b1 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -24,7 +24,7 @@
;;; Copyright © 2017 Kyle Meyer <kyle@kyleam.com>
;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2017, 2018 Rene Saavedra <pacoon@protonmail.com>
-;;; Copyright © 2018, 2019 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2018, 2019, 2020 Pierre Langlois <pierre.langlois@gmx.com>
;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
;;; Copyright © 2018 Gábor Boskovits <boskovits@gmail.com>
;;; Copyright © 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
@@ -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,12 @@ 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.
+ ,@(match (or (%current-target-system) (%current-system))
+ ((or "aarch64-linux" "armhf-linux")
+ `(("libunwind" ,libunwind)))
+ (_ '()))
("linux-pam" ,linux-pam)
("lz4" ,lz4)
("openssl" ,openssl)
--
2.26.0
Thanks,
Pierre
J
J
Julien Lepiller wrote on 11 Apr 2020 19:56
(address . 40556@debbugs.gnu.org)
5AA1CEE8-556B-48A9-BA51-86686EDD0482@lepiller.eu
Le 11 avril 2020 12:53:29 GMT-04:00, Pierre Langlois <pierre.langlois@gmx.com> a écrit :
Toggle quote (32 lines)
>
>Tobias Geerinckx-Rice writes:
>
>> Pierre,
>>
>> Pierre Langlois ???
>>> I wonder what's wrong with backtrace_symbols() in guix, I'm not sure
>>> how
>>> to investigate that. For now though, what do you think of using
>>> libunwind?
>>
>> OK, but it should only be included on platforms that require it:
>
>Oh sure thing!
>
>>
>> ;; Untested…
>> (inputs
>> `(…
>> ,@(match (%current-system)
>> ((or "aarch64-linux" "armhf-linux" …)
>> `(("libunwind" ,libunwind)))
>> (_ `()))
>> …))
>>
>> Could you test that?
>
>OK, the following patch works for me (tested building for armhf and
>aarch64 on a rockpro64). I've also added a "FIXME" comment to mention
>the issue so we can remove/keep it when we have a good understanding of
>what's going on.

Great, thanks for working on it, I had totally forgotten about it, because I fixed it in my systems by not running tests. There's also a bug report I sent to bug-guix I think. Adding libunwind should work. I remember testing it once, but it was just too long and I forgot about it ^^"
L
L
Ludovic Courtès wrote on 16 Apr 2020 18:24
(name . Pierre Langlois)(address . pierre.langlois@gmx.com)
877dyfgzzb.fsf@gnu.org
Hi,

Pierre Langlois <pierre.langlois@gmx.com> skribis:

Toggle quote (7 lines)
> + ;; 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”.

Use ‘target-arm?’ instead.

TIA!

Ludo’.
P
P
Pierre Langlois wrote on 16 Apr 2020 19:13
(name . Ludovic Courtès)(address . ludo@gnu.org)
87y2qvs6ar.fsf@gmx.com
Hi Ludo!

Ludovic Courtès writes:

Toggle quote (14 lines)
> Hi,
>
> Pierre Langlois <pierre.langlois@gmx.com> 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.

Toggle quote (3 lines)
>
> 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 <pierre.langlois@gmx.com>
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(-)

Toggle diff (35 lines)
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 <kyle@kyleam.com>
;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2017, 2018 Rene Saavedra <pacoon@protonmail.com>
-;;; Copyright © 2018, 2019 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2018, 2019, 2020 Pierre Langlois <pierre.langlois@gmx.com>
;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
;;; Copyright © 2018 Gábor Boskovits <boskovits@gmail.com>
;;; Copyright © 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
@@ -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
P
P
Pierre Langlois wrote on 16 Apr 2020 19:41
(name . Pierre Langlois)(address . pierre.langlois@gmx.com)
87o8rrl44h.fsf@gmx.com
Pierre Langlois writes:

Toggle quote (29 lines)
> Hi Ludo!
>
> Ludovic Courtès writes:
>
>> Hi,
>>
>> Pierre Langlois <pierre.langlois@gmx.com> 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.

Right, it seems dovecot isn't yet cross-compilable, but cross-compiling
libunwind works just fine. With dovecot I get a failure trying to
compile perl natively, as openssl's native-input I believe.

```
$ ./pre-inst-env guix build --target=aarch64-linux-gnu openssl
...
phase `install' succeeded after 21.6 seconds
starting phase `remove-extra-references'
Backtrace:
14 (primitive-load "/gnu/store/p51mz7mawiixjly3579bfyfv4hx…")
In ice-9/eval.scm:
191:35 13 (_ _)
In ice-9/boot-9.scm:
829:9 12 (catch _ _ #<procedure 7ffff3bba518 at /gnu/store/w3jl…> …)
In srfi/srfi-1.scm:
863:16 11 (every1 #<procedure 7ffff2d50cc0 at /gnu/store/w3jlc8p…> …)
In /gnu/store/w3jlc8pk8416m7h677r5vq92b66h8cqd-module-import/guix/build/gnu-build-system.scm:
839:30 10 (_ _)
In ice-9/eval.scm:
619:8 9 (_ #(#(#(#(#(#(#<directory (guile-user)…>) …) …) …) …) …))
In ice-9/boot-9.scm:
841:4 8 (with-throw-handler _ _ _)
In ice-9/ports.scm:
445:17 7 (call-with-input-file _ _ #:binary _ #:encoding _ # _)
In /gnu/store/w3jlc8pk8416m7h677r5vq92b66h8cqd-module-import/guix/build/utils.scm:
739:26 6 (_ _)
765:26 5 (_ #<input: /gnu/store/kbsn60lnf6vyim3b511qvnadlldmjv1…> …)
In srfi/srfi-1.scm:
466:18 4 (fold #<procedure 7ffff3b98790 at /gnu/store/w3jlc8pk8…> …)
In ice-9/eval.scm:
202:51 3 (_ #(#(#(#(#(#(#<directory (guile-user)…> …)) …) …) …) …))
163:9 2 (_ #(#(#(#(#(#(#<directory (guile-user)…> …)) …) …) …) …))
In unknown file:
1 (string-append "incpth='" #f "/include'\n")
In ice-9/boot-9.scm:
752:25 0 (dispatch-exception _ _ _)

ice-9/boot-9.scm:752:25: In procedure dispatch-exception:
In procedure string-append: Wrong type (expecting string): #f
builder for `/gnu/store/50wrwqkvryprlghiqnx3aq8w7ss8mak6-perl-5.30.0.drv' failed with exit code 1
build of /gnu/store/50wrwqkvryprlghiqnx3aq8w7ss8mak6-perl-5.30.0.drv failed
View build log at '/var/log/guix/drvs/50/wrwqkvryprlghiqnx3aq8w7ss8mak6-perl-5.30.0.drv.bz2'.
guix build: error: build of `/gnu/store/50wrwqkvryprlghiqnx3aq8w7ss8mak6-perl-5.30.0.drv' failed
```

But, I think perl has been fixed on core-updates, so we should be good
for this!

Thanks,
Pierre
L
L
Ludovic Courtès wrote on 17 Apr 2020 10:20
(name . Pierre Langlois)(address . pierre.langlois@gmx.com)
87r1wmcylp.fsf@gnu.org
Hi Pierre,

Pierre Langlois <pierre.langlois@gmx.com> skribis:

Toggle quote (4 lines)
> Right, it seems dovecot isn't yet cross-compilable, but cross-compiling
> libunwind works just fine. With dovecot I get a failure trying to
> compile perl natively, as openssl's native-input I believe.

Not your fault, and it’s fixed on core-updates as you write.

I’ve applied the patch, thank you!

Ludo’.
Closed
?