Bug 283034 - devel/openocd: Fix aarch64 build
Summary: devel/openocd: Fix aarch64 build
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm64 Any
: --- Affects Only Me
Assignee: Joel Bodenmann
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-29 04:50 UTC by Duane
Modified: 2024-12-23 13:04 UTC (History)
1 user (show)

See Also:
jbo: maintainer-feedback+


Attachments
Patch to fix building on AARCH64 (1.75 KB, patch)
2024-11-29 04:50 UTC, Duane
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Duane 2024-11-29 04:50:27 UTC
Created attachment 255519 [details]
Patch to fix building on AARCH64

There is a clash between a name in a header file within the port and a name within the system header files that has prevented this from building since Sept 2021 (https://cgit.freebsd.org/ports/commit/devel/openocd/Makefile?id=55d27db3cff9f49e743ce4bf9f3fbb37b06dc184)

A comment was updated to state that the offending code has been removed in the development branch and so a patch is not necessary as it will be resolved when the next release is cut (https://cgit.freebsd.org/ports/commit/devel/openocd/Makefile?id=70c2b83232415954356803e286ea2263f5e98c8d)

Given that this problem has existed for more than 3 years now, I think maybe a patch could be justified.  Luckily, I have provided one.

This particular fix is relevant to me because I have started using FreeBSD under emulation on the new M series Mac computers, and so to save translation I am now using the ARM64 version of FreeBSD instead of the AMD64 version.
Comment 1 Joel Bodenmann freebsd_committer freebsd_triage 2024-12-05 16:55:51 UTC
Thanks for the patch!

I'll have a look at the patch next week as I am currently on the road.

Generally, I'm happy to accept a patch for this. The idea was to not bother until somebody needs it which seems to be the case now :)
Comment 2 Robert Clausecker freebsd_committer freebsd_triage 2024-12-23 10:46:33 UTC
This patch seems defective.

The PAGE_SIZE_4K and PAGE_SIZE_8K macros of <machine/param.h> are unrelated to the enumeration constants defined in this project and using them in place of said constants will break the code as the enumeration constants seem to be used to form indices into an array.  This will also likely not build on other architectures, which do not all have these macros.

jbo@ reminded me that I had already prepared a patch for this long ago; it just undefines the system macros before ingesting the enumeration definition:

    http://fuz.su/~fuz/freebsd/patch-src_target_nds32__tlb.h

Please consider this patch instead of the submitter's.
Comment 3 commit-hook freebsd_committer freebsd_triage 2024-12-23 13:01:51 UTC
A commit in branch main references this bug:

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

commit 7ff81df978340dd7d36c28c38492eb5ec7af6cb9
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2024-12-23 12:34:16 +0000
Commit:     Joel Bodenmann <jbo@FreeBSD.org>
CommitDate: 2024-12-23 13:01:12 +0000

    devel/openocd: Unbreak aarch64 build

    Working around an issue where upstream provided page size macros are
    colliding with page size macros from <machine/param.h>.

    PR:             283034
    Reported by:    Duane (parakleta@darkreality.org)

 devel/openocd/Makefile                                  |  7 +------
 devel/openocd/files/patch-src_target_nds32__tlb.h (new) | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 6 deletions(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-12-23 13:03:53 UTC
A commit in branch 2024Q4 references this bug:

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

commit e328e7c218833412be5537690ffd61924b128593
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2024-12-23 12:34:16 +0000
Commit:     Joel Bodenmann <jbo@FreeBSD.org>
CommitDate: 2024-12-23 13:02:37 +0000

    devel/openocd: Unbreak aarch64 build

    Working around an issue where upstream provided page size macros are
    colliding with page size macros from <machine/param.h>.

    PR:             283034
    Reported by:    Duane (parakleta@darkreality.org)

    (cherry picked from commit 7ff81df978340dd7d36c28c38492eb5ec7af6cb9)

 devel/openocd/Makefile                                  |  7 +------
 devel/openocd/files/patch-src_target_nds32__tlb.h (new) | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 6 deletions(-)
Comment 5 Joel Bodenmann freebsd_committer freebsd_triage 2024-12-23 13:04:58 UTC
The patch by fuz@ has been merged.
testport completed by fuz@.

Thank you both!