Bug 264095 - devel/gdb: no member named 'debug_regs_probed' on aarch64
Summary: devel/gdb: no member named 'debug_regs_probed' on aarch64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm64 Any
: --- Affects Some People
Assignee: John Baldwin
URL:
Keywords:
: 264204 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-05-20 08:46 UTC by JohannesNeu
Modified: 2022-06-01 15:34 UTC (History)
3 users (show)

See Also:
pizzamig: maintainer-feedback+


Attachments
contains stderr and stdout for the icinga2 build (52.39 KB, text/plain)
2022-05-20 08:46 UTC, JohannesNeu
no flags Details
build_fix.patch (495 bytes, patch)
2022-05-23 22:20 UTC, John Baldwin
no flags Details | Diff
log output about make install icinga2 after applying the patch of John baldwin (10.20 KB, text/plain)
2022-05-24 23:08 UTC, JohannesNeu
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description JohannesNeu 2022-05-20 08:46:48 UTC
Created attachment 234046 [details]
contains stderr and stdout for the icinga2 build

Hi,

I try to compile icinga2 as a required package for opnsense on freebsd 13.0 stable.
During compilation I run into the following error:

/usr/obj/usr/ports/devel/gdb/work-py38/gdb-12.1/gdb/aarch64-fbsd-nat.c:79:31: error: no member named 'debug_regs_probed' in 'aarch64_fbsd_nat_target'
bool aarch64_fbsd_nat_target::debug_regs_probed;
     ~~~~~~~~~~~~~~~~~~~~~~~~~^

I have mentioned this problem in the following locations as well:
https://community.icinga.com/t/build-error-on-freebsd-for-incinga2-aarch64/9862
https://github.com/opnsense/tools/issues/290

There is a file attached with more stderr and stdout.
I ran both “make ports-icinga2” and “make MAKE_JOBS_UNSAFE=yes ports-icinga2” and get the same error.

kind regards,
Johannes
Comment 1 Luca Pizzamiglio freebsd_committer freebsd_triage 2022-05-21 16:55:01 UTC
Hi. Thanks for reporting.
It seems that there is an issue on arm64.
I'm quite busy at the moment, so it could take some time to get a fix.
Comment 2 JohannesNeu 2022-05-22 18:14:25 UTC
Hi Luca,
sphex on IRC had a look at the output and came to the following conclusions:

"hmm. the last commit to devel/gdb might have build errors on aarch64 for __FreeBSD_version < 1400005."

"I just checked that line in that file with an error in your output. one of the gdb ports patch for aarch64 seems to have an error (trying to define an undeclared static member due to conditional code exluding the declaration depending on freebsd version). IIUC"

maybe this is helpful.
kind regards,
Johannes
Comment 3 John Baldwin freebsd_committer freebsd_triage 2022-05-23 22:20:17 UTC
Created attachment 234165 [details]
build_fix.patch

I think this is all that is needed.  If you can confirm this fixes it, I will merge to upstream GDB master and then backport the patch to the port.
Comment 4 JohannesNeu 2022-05-24 10:14:07 UTC
Hi John Baldwin,
thank you very much for the patch.
I have actually never patched something, is there a howto that details how it would be applied?
I assume I would need to change the file "aarch64-fbsd-nat.c" in ports by hand and then try to run make again?
Where can I find it?
Comment 5 Luca Pizzamiglio freebsd_committer freebsd_triage 2022-05-24 15:01:34 UTC
*** Bug 264204 has been marked as a duplicate of this bug. ***
Comment 6 John Baldwin freebsd_committer freebsd_triage 2022-05-24 17:17:38 UTC
You can download the patch and save it in /usr/ports/devel/gdb/files/patch-test and see if the port builds.  The patch will get applied for you by the ports system when building the port.
Comment 7 JohannesNeu 2022-05-24 23:07:50 UTC
John Baldwin,

thank you for your advice.
I had modified "/usr/obj/usr/tools/config/22.1/OpenSSL:aarch64/usr/obj/usr/ports/devel/gdb/work-py38/gdb-12.1/gdb/aarch64-fbsd-nat.c" according to your patch, directly.
Then I changed directory to /usr/ports/net-mgmt/icinga2 and ran "make install icinga2" and it ran for quite some time. In the end the following message came up: "make: don't know how to make icinga2. Stop", I attach a new file with the log: "make_icinga2_after_patch.txt".

Does this mean it worked or did I make a mistake?
Comment 8 JohannesNeu 2022-05-24 23:08:56 UTC
Created attachment 234177 [details]
log output about make install icinga2 after applying the patch of John baldwin
Comment 9 John Baldwin freebsd_committer freebsd_triage 2022-05-26 23:35:04 UTC
I figured out a way to test the build fix locally and have merged a fix upstream into GDB.  I've uploaded a fix for the port at https://reviews.freebsd.org/D35332
Comment 10 JohannesNeu 2022-05-29 14:11:06 UTC
Hi John Baldwin,

does this mean that once I reinstall the OS I can try it again and it should work?
If that is the case I would do so and then close this ticket.
Comment 11 commit-hook freebsd_committer freebsd_triage 2022-05-31 16:22:51 UTC
A commit in branch main references this bug:

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

commit c5722abb6a5cfdb83d8e2fcce271cba48dbd7281
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-05-30 23:24:21 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-05-30 23:24:21 +0000

    devel/gdb: Fix build of GDB 12.1 on older aarch64 systems.

    Backport a patch from GDB to fix the build on aarch64 systems that do
    not support hardware breakpoints/watchpoints.

    PR:             264095
    Reviewed by:    pizzamig (maintainer), mikael
    Differential Revision:  https://reviews.freebsd.org/D35332

 devel/gdb/Makefile                       |  3 ++-
 devel/gdb/files/commit-b2fdd31b03e (new) | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)
Comment 12 JohannesNeu 2022-06-01 15:34:48 UTC
I tested it and it seems to work now.
@John Baldwin: thank your very much!