Bug 262447

Summary: devel/libunwind: Fix aarch64 build
Product: Ports & Packages Reporter: Brad Davis <brd>
Component: Individual Port(s)Assignee: Po-Chuan Hsieh <sunpoet>
Status: Closed FIXED    
Severity: Affects Only Me CC: andrew.purtell, brd, emaste, karamelichkin, marklmi26-fbsd, mikael
Priority: --- Flags: bugzilla: maintainer-feedback? (sunpoet)
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262257
Attachments:
Description Flags
patch
none
v0 none

Description Brad Davis freebsd_committer freebsd_triage 2022-03-09 16:31:23 UTC
Created attachment 232347 [details]
patch
Comment 2 Mikael Urankar freebsd_committer freebsd_triage 2022-03-09 19:07:22 UTC
(In reply to Brad Davis from comment #0)
Do we have the same ucontext as linux?
Comment 3 Charlie Li freebsd_committer freebsd_triage 2022-03-16 05:09:27 UTC
*** Bug 262560 has been marked as a duplicate of this bug. ***
Comment 4 Mikael Urankar freebsd_committer freebsd_triage 2022-03-16 08:42:29 UTC
Created attachment 232482 [details]
v0

Try this patch please
Comment 5 Mark Millard 2022-03-17 20:46:54 UTC
(In reply to Mikael Urankar from comment #4)

# git -C /usr/ports apply ~/attachment.cgi\?id\=232482
/usr/home/root/attachment.cgi?id=232482:31: trailing whitespace.
 
/usr/home/root/attachment.cgi?id=232482:32: trailing whitespace.
 
/usr/home/root/attachment.cgi?id=232482:35: trailing whitespace.
 
/usr/home/root/attachment.cgi?id=232482:83: trailing whitespace.
@@ -59,6 +59,10 @@ extern int aarch64_local_resume (unw_addr_space_t as, 
/usr/home/root/attachment.cgi?id=232482:86: trailing whitespace.
 
warning: squelched 1 whitespace error
warning: 6 lines add whitespace errors.

The build completed without  reporting an error:

[00:00:53] [01] [00:00:28] Finished devel/libunwind | libunwind-20211201: Success

so previously skipped ports are starting to build.
Comment 6 Mark Millard 2022-03-17 22:09:56 UTC
(In reply to Mark Millard from comment #5)

The 42 previously skipped ports all built.
Comment 7 Andrew Purtell 2022-03-18 17:18:58 UTC
Patch also works for me:

git -C /usr/local/poudriere/ports/default apply attachment_232347.patch
...
[00:00:22] [01] [00:00:00] Building devel/libunwind | libunwind-20211201
[00:00:50] [01] [00:00:28] Finished devel/libunwind | libunwind-20211201: Success

and dependent ports are building again

[00:00:50] [01] [00:00:00] Building lang/ruby27 | ruby-2.7.5_1,1
[00:06:25] [01] [00:05:35] Finished lang/ruby27 | ruby-2.7.5_1,1: Success
...
Comment 8 Po-Chuan Hsieh freebsd_committer freebsd_triage 2022-03-19 00:45:14 UTC
(In reply to Brad Davis from comment #1)

Thanks for the report.
Though it is merged by upstream, I do feel that Mikael's patch (attachment 232482 [details]) seems more correct.

(In reply to Mikael Urankar from comment #4)

I do not have an aarch64 device but I asked another committer (kevlo@) to test it and it works.
Could you please send a pull request to upstream?
Thanks.
Comment 9 Ed Maste freebsd_committer freebsd_triage 2022-03-19 23:29:13 UTC
(In reply to Mikael Urankar from comment #2)
> Do we have the same ucontext as linux?
It does not appear so.
Comment 10 commit-hook freebsd_committer freebsd_triage 2022-03-23 08:33:41 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b53231cc31b2d4e933ba2893c8079cc7d1f07413

commit b53231cc31b2d4e933ba2893c8079cc7d1f07413
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2022-03-23 08:29:06 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2022-03-23 08:29:06 +0000

    devel/libunwind: Fix build on aarch64

    PR:             262447
    Approved by:    portmgr (build fix blanket)

 .../files/patch-include_libunwind-aarch64.h (new)  | 28 ++++++++++++++++++++++
 .../files/patch-src_aarch64_Ginit.c (new)          | 20 ++++++++++++++++
 .../files/patch-src_aarch64_unwind__i.h (new)      | 13 ++++++++++
 3 files changed, 61 insertions(+)
Comment 11 Mikael Urankar freebsd_committer freebsd_triage 2022-03-23 09:08:57 UTC
https://github.com/libunwind/libunwind/pull/344
Comment 12 Po-Chuan Hsieh freebsd_committer freebsd_triage 2022-03-25 15:17:03 UTC
Mikael: Thanks!