Opened 6 months ago

Last modified 6 months ago

#72693 new defect

gdb @15.1+multiarch: fails to build on macOS 15.5 with XCode 16.4

Reported by: tcwan (TC Wan) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: sequoia Cc:
Port: gdb

Description (last modified by jmroot (Joshua Root))

The release version of XCode 16.4 has new clang version 17.0 chokes when building gdb 15.1 +multiarch on macOS 15.5 (Sequoia) running on Mac Mini M2. This was

I'm not sure what is the root cause. There are some warnings which may be contributing:

:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gdb/gdb/work/gdb-15.1/zlib/gzlib.c:534:22: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C23 [-Wdeprecated-non-prototype]
:info:build   534 | const char * ZEXPORT gzerror(file, errnum)
:info:build       |                      ^
:info:build In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gdb/gdb/work/gdb-15.1/zlib/zutil.c:10: 
:info:build In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_gdb/gdb/work/gdb-15.1/zlib/gzguts.h:21:
:info:build In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/stdio.h:61:
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/_stdio.h:318:7: error: expected identifier or '('
:info:build   318 | FILE    *fdopen(int, const char *) __DARWIN_ALIAS_STARTING(__MAC_10_6, __IPHONE_2_0, __DARWIN_ALIAS(fdopen));
:info:build       |          ^

Attachments (1)

gdb-15.1-build-main.log (198.5 KB) - added by tcwan (TC Wan) 6 months ago.
Build log for gdb 15.1 +multiarch

Download all attachments as: .zip

Change History (12)

Changed 6 months ago by tcwan (TC Wan)

Attachment: gdb-15.1-build-main.log added

Build log for gdb 15.1 +multiarch

comment:1 Changed 6 months ago by tcwan (TC Wan)

All port dependencies were updated prior to the build (i.e., 'sudo port selfupdate; sudo port upgrade outdated')

comment:2 Changed 6 months ago by jmroot (Joshua Root)

Description: modified (diff)

comment:3 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)

Summary: GDB 15.1 multiarch fails to build on macOS 15.5 with XCode 16.4gdb @15.1: multiarch fails to build on macOS 15.5 with XCode 16.4

The error is occurring in zlib code bundled with gdb. If gdb offers this option, a fix might be to use MacPorts zlib instead of the bundled copy. In fact, the gdb port already depends on the zlib port, but perhaps is not actually using it.

Otherwise, the bundled copy will need to be fixed. It may be outdated and might need to be updated by the gdb developers. That was the fix used by another project experiencing this problem.

Here's another more helpful report. It points out that this is the zlib commit that fixes the problem; if we cannot make gdb use MacPorts zlib, we could backport just that commit.

comment:4 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)

Keywords: sequoia added
Summary: gdb @15.1: multiarch fails to build on macOS 15.5 with XCode 16.4gdb @15.1+multiarch: fails to build on macOS 15.5 with XCode 16.4

The gdb bug report is:

https://sourceware.org/bugzilla/show_bug.cgi?id=32933

It doesn't look like they have updated their bundled zlib to a fixed version yet so I've asked them to do so.

Last edited 6 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:5 Changed 6 months ago by pmetzger (Perry E. Metzger)

Long term using an unbundled zlib would seem like the right thing, but would anyone mind if I apply the short term patch?

comment:6 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)

I do not mind. Note there are several gdb ports, probably many or all of which are affected, and it would be great to fix all of them, if you have time. See e.g. #72736 for another.

comment:7 Changed 6 months ago by pmetzger (Perry E. Metzger)

I have temporarily added a patch to the bundled zlib for gdb itself but clearly this cannot be the long term solution. I'll go through trying to fix a few of these but the real fix will have to come from either unbundling zlib or upstream fixing their zlib.

comment:8 Changed 6 months ago by pmetzger (Perry E. Metzger)

I've changed my mind; there's a standard configure option "--with-system-zlib" that we could use. I'm going to try it out.

comment:9 Changed 6 months ago by pmetzger (Perry E. Metzger)

I have added "--with-system-zlib" to the config flags and have bumped the revision number. I haven't closed the ticket yet because I need confirmation that this actually fixes the problem for everyone. I have also added "--with-system-zlib" in the crossgdb portgroup, but I have not closed any other tickets pending confirmation that everything now builds okay.

comment:10 Changed 6 months ago by pmetzger (Perry E. Metzger)

I note that the current gdb release seems to be 16.2, which is way ahead of what we have. Should we be upgrading? It would appear to be important, but I feel somewhat uncomfortable with the work.

comment:11 in reply to:  10 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)

Replying to pmetzger:

Should we be upgrading?

Presumably, but since the latest version doesn't fix this problem there's no need to think about updating in conjunction with this ticket unless you want to.

Note: See TracTickets for help on using tickets.