Opened 14 months ago

Last modified 14 months ago

#72587 assigned defect

gawk fails to build with gcc14 on Sonoma: gawkmisc.c: error: implicit declaration of function '_NSGetExecutablePath' [-Wimplicit-function-declaration]

Reported by: barracuda156 Owned by: Schamschula (Marius Schamschula)
Priority: Normal Milestone:
Component: ports Version: 2.10.7
Keywords: sonoma Cc:
Port: gawk

Description

	ccache /opt/local/bin/gcc-mp-14 -DDEFPATH='".:/opt/local/share/awk"' -DDEFLIBPATH="\"/opt/local/lib/gawk\"" -DSHLIBEXT="\"so"\" -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR='"/opt/local/share/locale"' -I"./support" -I.   -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64 -DNDEBUG -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64 -DNDEBUG -MT gawkmisc.o -MD -MP -MF $depbase.Tpo -c -o gawkmisc.o gawkmisc.c &&\
	mv -f $depbase.Tpo $depbase.Po
depbase=`echo int_array.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
	ccache /opt/local/bin/gcc-mp-14 -DDEFPATH='".:/opt/local/share/awk"' -DDEFLIBPATH="\"/opt/local/lib/gawk\"" -DSHLIBEXT="\"so"\" -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR='"/opt/local/share/locale"' -I"./support" -I.   -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64 -DNDEBUG -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64 -DNDEBUG -MT int_array.o -MD -MP -MF $depbase.Tpo -c -o int_array.o int_array.c &&\
	mv -f $depbase.Tpo $depbase.Po
In file included from gawkmisc.c:38:
posix/gawkmisc.c: In function 'os_disable_aslr':
posix/gawkmisc.c:359:29: error: implicit declaration of function '_NSGetExecutablePath' [-Wimplicit-function-declaration]
  359 |                         n = _NSGetExecutablePath(fullpath, &size);
      |                             ^~~~~~~~~~~~~~~~~~~~
depbase=`echo io.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
	ccache /opt/local/bin/gcc-mp-14 -DDEFPATH='".:/opt/local/share/awk"' -DDEFLIBPATH="\"/opt/local/lib/gawk\"" -DSHLIBEXT="\"so"\" -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR='"/opt/local/share/locale"' -I"./support" -I.   -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64 -DNDEBUG -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64 -DNDEBUG -MT io.o -MD -MP -MF $depbase.Tpo -c -o io.o io.c &&\
	mv -f $depbase.Tpo $depbase.Po
make[2]: *** [gawkmisc.o] Error 1

Change History (2)

comment:1 Changed 14 months ago by barracuda156

After adding the missing header, it fails with

In file included from gawkmisc.c:38:
posix/gawkmisc.c: In function 'os_disable_aslr':
posix/gawkmisc.c:363:60: error: passing argument 2 of '_NSGetExecutablePath' from incompatible pointer type [-Wincompatible-pointer-types]
  363 |                         n = _NSGetExecutablePath(fullpath, &size);
      |                                                            ^~~~~
      |                                                            |
      |                                                            size_t * {aka long unsigned int *}
In file included from posix/gawkmisc.c:39:
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/mach-o/dyld.h:105:54: note: expected 'uint32_t *' {aka 'unsigned int *'} but argument is of type 'size_t *' {aka 'long unsigned int *'}
  105 | extern int _NSGetExecutablePath(char* buf, uint32_t* bufsize)                 __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0);
      |                                            ~~~~~~~~~~^~~~~~~
make[2]: *** [gawkmisc.o] Error 1
make[2]: *** Waiting for unfinished jobs....

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

Owner: set to Schamschula
Status: newassigned

Port health indicators show the port builds fine with clang on 10.6 and above.

I don't recommend trying to use gcc on systems where MacPorts ordinarily chooses clang.

Perhaps you're filing this report as a way to say that it fails to build with gcc on much older systems where gcc is the default.

You can file a bug report with the developers of gawk if their code is wrong, but from a MacPorts perspective, the port is not broken on Sonoma since it builds fine there with clang.

Note: See TracTickets for help on using tickets.