Bug 269878 - devel/binutils: Binutils needs to install include/ansidecl.h
Summary: devel/binutils: Binutils needs to install include/ansidecl.h
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Cy Schubert
URL:
Keywords:
: 260914 (view as bug list)
Depends on: 269885
Blocks:
  Show dependency treegraph
 
Reported: 2023-02-28 17:10 UTC by Yuri Victorovich
Modified: 2023-03-17 18:44 UTC (History)
2 users (show)

See Also:
cy: maintainer-feedback?
cy: merge-quarterly?


Attachments
fix-bfd.h.patch (1.07 KB, patch)
2023-03-06 22:21 UTC, Yuri Victorovich
no flags Details | Diff
Proposed patch with commit log message. (1.74 KB, patch)
2023-03-08 20:10 UTC, Cy Schubert
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2023-02-28 17:10:45 UTC
libbfd.h fails because ENUM_BITFIELD is unknown:

|| [ 50%] Building CXX object src/CMakeFiles/elf2llvm.dir/main.cpp.o
|| In file included from /home/yuri/binary-to-llvm/src/main.cpp:2:
/usr/local/include/bfd.h|2039 col 3| error: unknown type name 'ENUM_BITFIELD'
||   ENUM_BITFIELD (complain_overflow) complain_on_overflow:2;
||   ^
/usr/local/include/bfd.h|2039 col 36| error: expected ';' at end of declaration list
||   ENUM_BITFIELD (complain_overflow) complain_on_overflow:2;
||                                    ^


ENUM_BITFIELD is defined in include/ansidecl.h
Comment 1 Yuri Victorovich freebsd_committer freebsd_triage 2023-02-28 17:11:18 UTC
It looks like these 2 lines should be removed:
        ${RM} ${STAGEDIR}${PREFIX}/include/ansidecl.h
        ${REINPLACE_CMD} '/#include "ansidecl.h"/d' ${STAGEDIR}${PREFIX}/include/bfd.h
Comment 2 Cy Schubert freebsd_committer freebsd_triage 2023-02-28 20:38:25 UTC
(In reply to Yuri Victorovich from comment #1)

It was removed in r336642 (b9c90aa46af1067eabd22c7d490335a4496964e0) to:

commit b9c90aa46af1067eabd22c7d490335a4496964e0
Author:     Niclas Zeising <zeising@FreeBSD.org>
AuthorDate: Mon Dec 16 14:52:26 2013 +0000
Commit:     Niclas Zeising <zeising@FreeBSD.org>
CommitDate: Mon Dec 16 14:52:26 2013 +0000

    Update to 2.24
    
    Do not install libiberty.a to aviod conflicts with devel/gnulibiberty [0]
    Do not install include/ansidecl.h, to avoid conflicts with gcc49 [1]
    Fix gold usage when linking c++ code, related to ctors [2]
    
    Thanks to dim for help with getting gold to build with libc++!
    
    PR:             ports/176406 [0], ports/184327 [1]
    Submitted by:   Craig Leres <leres@ee.lbl.gov> [0]
                    Gerald Pfeifer <gerald@pfeifer.com> [1]
    Requested by:   rdivacky [2]

Notes:
    svn path=/head/; revision=336642

gcc49 isn't a thing anymore but devel/libbfd is. I think we need to update libbfd and you will need to install it instead. (Added joerg@ to cc.)

I will submit an update PR for libbfd instead of changing binutils.
Comment 3 Cy Schubert freebsd_committer freebsd_triage 2023-02-28 21:42:33 UTC
Your port will need to depend on devel/libbfd.
Comment 4 Yuri Victorovich freebsd_committer freebsd_triage 2023-03-01 09:10:51 UTC
(In reply to Cy Schubert from comment #3)

But why does it install a broken include/bfd.h and include/bfdlink.h? When ENUM_BITFIELD isn't defined this header can't be used. Same for lib/libbfd.a - it is useless without include/bfd.h



$ grep -r ENUM_BITFIELD /usr/local/include/ 2>/dev/null
/usr/local/include/bfdlink.h:  ENUM_BITFIELD (bfd_link_hash_type) type : 8;
/usr/local/include/bfdlink.h:  ENUM_BITFIELD (output_type) type : 2;
/usr/local/include/bfdlink.h:  ENUM_BITFIELD (bfd_link_strip) strip : 2;
/usr/local/include/bfdlink.h:  ENUM_BITFIELD (bfd_link_discard) discard : 2;
/usr/local/include/bfdlink.h:  ENUM_BITFIELD (bfd_link_elf_stt_common) elf_stt_common : 2;
/usr/local/include/bfdlink.h:  ENUM_BITFIELD (bfd_link_common_skip_ar_symbols) common_skip_ar_symbols : 2;
/usr/local/include/bfdlink.h:  ENUM_BITFIELD (report_method) unresolved_syms_in_objects : 2;
/usr/local/include/bfdlink.h:  ENUM_BITFIELD (report_method) unresolved_syms_in_shared_libs : 2;
/usr/local/include/bfdlink.h:  ENUM_BITFIELD (textrel_check_method) textrel_check: 2;
/usr/local/include/bfd.h:  ENUM_BITFIELD (complain_overflow) complain_on_overflow:2;
/usr/local/include/bfd.h:  ENUM_BITFIELD (bfd_format) format : 3;
/usr/local/include/bfd.h:  ENUM_BITFIELD (bfd_direction) direction : 2;
/usr/local/include/bfd.h:  ENUM_BITFIELD (bfd_plugin_format) plugin_format : 2;
Comment 5 Yuri Victorovich freebsd_committer freebsd_triage 2023-03-06 22:21:28 UTC
Created attachment 240626 [details]
fix-bfd.h.patch

The attached patch makes include/bfd.h functional again.

In 2014 in include/ansidecl.h was removed to prevent conflicts with gcc.
Back then it also broke include/bfd.h

Now there is no conflict with gcc any more.

The attached patch restores include/bfd.h and adds back include/ansidecl.h
Comment 6 Cy Schubert freebsd_committer freebsd_triage 2023-03-08 14:34:17 UTC
(In reply to Yuri Victorovich from comment #5)
What about the conflict with libbfd this patch creates? How are users with both ports installed supposed to navigate this?
Comment 7 Yuri Victorovich freebsd_committer freebsd_triage 2023-03-08 17:59:13 UTC
(In reply to Cy Schubert from comment #6)

The conflict already exists now because both install include/bfd.h
Comment 8 Cy Schubert freebsd_committer freebsd_triage 2023-03-08 18:02:13 UTC
Approved to commit. Remember to MFH.
Comment 9 Cy Schubert freebsd_committer freebsd_triage 2023-03-08 20:10:34 UTC
Created attachment 240677 [details]
Proposed patch with commit log message.

I haven't been able to ascertain why the file was removed. This the reason why commit log messages must document, why.

I will test on the all the flavors supported by the port. Wondering whether the file caused problems with one of the flavors (or flavors equivalents at the time).
Comment 10 commit-hook freebsd_committer freebsd_triage 2023-03-09 16:22:13 UTC
A commit in branch main references this bug:

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

commit 844981cb54e8d2ba2c77022e014c52f3c6ff47e9
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2023-03-08 20:02:56 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2023-03-09 16:20:21 +0000

    devel/binutils: Bring back ansidecl.h

    A missing ansidecl.h is causing some ports build failures because of
    and unknown ENUM_BITFIELD. This commit brings it back.

    Previous commits which removed ansidecl.h, 8b115343ad84e and 95c499bbd7f34,
    failed to say why the file was removed. We can only guess the reason, to
    solve an undocumented problem at the time.

    PR:             269878
    Submitted by:   yuri
    Reported by:    yuri
    MFH:            2023Q1

 devel/binutils/Makefile  | 3 +--
 devel/binutils/pkg-plist | 1 +
 2 files changed, 2 insertions(+), 2 deletions(-)
Comment 11 Joerg Wunsch freebsd_committer freebsd_triage 2023-03-09 19:58:48 UTC
*** Bug 260914 has been marked as a duplicate of this bug. ***
Comment 12 Cy Schubert freebsd_committer freebsd_triage 2023-03-17 18:44:28 UTC
Fixed.