Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Werror=implicit-function-declaration breaks compilation of perl5184-5.18.4-4 #1075

Open
cooljeanius opened this issue Oct 5, 2023 · 8 comments

Comments

@cooljeanius
Copy link

Entire failure is too long to paste comfortably here, so I'll just paste the last part of it:

reentr.c:513:16: error: implicit declaration of function 'getservbyport_r' [-Werror,-Wimplicit-function-declaration]
                    retptr = getservbyport(anint, (char *)p0); break;
                             ^
./reentr.h:1286:60: note: expanded from macro 'getservbyport'
#       define getservbyport(a, b) ((PL_reentrant_retint = getservbyport_r(a, b, &PL_reentrant_buffer->_servent_struct, PL_reentrant_buffer->_servent_buffer, PL_reentrant_buffer->_servent_size, &PL_reentrant_buffer->_servent_ptr)) == 0 ? PL_reentrant_buffer->_servent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct servent *) Perl_reentrant_retry("getservbyport", a, b) : 0))
                                                           ^
reentr.c:513:16: note: did you mean 'getservbyport'?
./reentr.h:1286:60: note: expanded from macro 'getservbyport'
#       define getservbyport(a, b) ((PL_reentrant_retint = getservbyport_r(a, b, &PL_reentrant_buffer->_servent_struct, PL_reentrant_buffer->_servent_buffer, PL_reentrant_buffer->_servent_size, &PL_reentrant_buffer->_servent_ptr)) == 0 ? PL_reentrant_buffer->_servent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct servent *) Perl_reentrant_retry("getservbyport", a, b) : 0))
                                                           ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netdb.h:287:17: note: 'getservbyport' declared here
struct servent  *getservbyport(int, const char *);
                 ^
reentr.c:515:16: error: implicit declaration of function 'getservent_r' [-Werror,-Wimplicit-function-declaration]
                    retptr = getservent(); break;
                             ^
./reentr.h:1301:53: note: expanded from macro 'getservent'
#       define getservent() ((PL_reentrant_retint = getservent_r(&PL_reentrant_buffer->_servent_struct, PL_reentrant_buffer->_servent_buffer, PL_reentrant_buffer->_servent_size, &PL_reentrant_buffer->_servent_ptr)) == 0 ? PL_reentrant_buffer->_servent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct servent *) Perl_reentrant_retry("getservent") : 0))
                                                    ^
reentr.c:515:16: note: did you mean 'getservent'?
./reentr.h:1301:53: note: expanded from macro 'getservent'
#       define getservent() ((PL_reentrant_retint = getservent_r(&PL_reentrant_buffer->_servent_struct, PL_reentrant_buffer->_servent_buffer, PL_reentrant_buffer->_servent_size, &PL_reentrant_buffer->_servent_ptr)) == 0 ? PL_reentrant_buffer->_servent_ptr : ((PL_reentrant_retint == ERANGE) ? (struct servent *) Perl_reentrant_retry("getservent") : 0))
                                                    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netdb.h:288:17: note: 'getservent' declared here
struct servent  *getservent(void);
                 ^
16 warnings and 12 errors generated.
make: *** [GNUmakefile:262: reentr.o] Error 1
make: *** Waiting for unfinished jobs....
16 warnings generated.
98 warnings generated.
59 warnings generated.
25 warnings generated.
148 warnings generated.
599 warnings generated.
152 warnings generated.
### execution of /tmp/fink.3bu2R failed, exit code 2
### execution of /tmp/fink.N0gr4 failed, exit code 2
Removing runtime build-lock...
Removing build-lock package...
/opt/sw/bin/dpkg-lockwait -r fink-buildlock-perl5184-5.18.4-4
(Reading database ... 
dpkg: serious warning: files list file for package `fink-buildlock-ccp4-6.5-1' missing, assuming package has no files currently installed.
1030938 files and directories currently installed.)
Removing fink-buildlock-perl5184-5.18.4-4 ...

Note that this blocks the upgrading of all the "*-pm5184" packages that I had installed from previous installations. I'm on Big Sur with Xcode 13.

@nieder
Copy link
Member

nieder commented Oct 6, 2023

Just built for me on 13.5. I also don't see the implicit-function-declaration flag anywhere in the build process. Can you search for the compiler command for reentr.c and post that?

man getservbyport in Xcode 14.3 says that the function is available with #include <netdb.h>. Do you get the same man output? reentr.h does #include the netdb.h header:

#ifdef I_NETDB
#   include <netdb.h>
#endif

In config.log, I do have I_NETDB defined:

/* I_NETDB:
 *	This symbol, if defined, indicates that <netdb.h> exists and
 *	should be included.
 */
#define I_NETDB		/**/

(and configure output):

endgrent_r() NOT found.
endhostent() found.
<netdb.h> found.
endhostent_r() NOT found.

@cooljeanius
Copy link
Author

Just built for me on 13.5. I also don't see the implicit-function-declaration flag anywhere in the build process.

It's on by default, so you wouldn't necessarily see it.

Can you search for the compiler command for reentr.c and post that?

man getservbyport in Xcode 14.3 says that the function is available with #include <netdb.h>. Do you get the same man output?

Yes.

reentr.h does #include the netdb.h header:

#ifdef I_NETDB
#   include <netdb.h>
#endif

In config.log, I do have I_NETDB defined:

/* I_NETDB:
 *	This symbol, if defined, indicates that <netdb.h> exists and
 *	should be included.
 */
#define I_NETDB		/**/

er, you mean config.h? It's the same in mine, too:

/* I_NETDB:
 *	This symbol, if defined, indicates that <netdb.h> exists and
 *	should be included.
 */
#define I_NETDB		/**/

(and configure output):

endgrent_r() NOT found.
endhostent() found.
<netdb.h> found.
endhostent_r() NOT found.

For me, that part was:

endgrent_r() NOT found.
endhostent() found.
<netdb.h> found.
endhostent_r() found.
Hmm.  Based on the hints in hints/darwin.sh, 
the recommended value for $d_endhostent_r_proto on this machine was "define"!
    Keep the recommended value? [y]  
endnetent() found.

Also, the getservbyport part:

getservbyname() found.
getservbyport() found.
getservent() found.
getservbyname_r() found.
Hmm.  Based on the hints in hints/darwin.sh, 
the recommended value for $d_getservbyname_r_proto on this machine was "define"!
    Keep the recommended value? [y]  
getservbyport_r() found.
Hmm.  Based on the hints in hints/darwin.sh, 
the recommended value for $d_getservbyport_r_proto on this machine was "define"!
    Keep the recommended value? [y]  
getservent_r() found.
Hmm.  Based on the hints in hints/darwin.sh, 
the recommended value for $d_getservent_r_proto on this machine was "define"!
    Keep the recommended value? [y]  
getspnam() NOT found.

@cooljeanius
Copy link
Author

@nieder do you need any additional info from me?

@nieder
Copy link
Member

nieder commented Nov 3, 2024

@cooljeanius I've rebuilt perl5184 several times on 13.6, and I've added an explicit -Werror=implicit-function-declaration to $ccflags

`sh  cflags "optimize='-O3'" reentr.o`  reentr.c
	  CCCMD =  gcc -DPERL_CORE -c -I/opt/sw/include -Werror=implicit-function-declaration -fno-common -DPERL_DARWIN -no-cpp-precomp -mmacosx-version-min=13.6 -fno-strict-aliasing -pipe -fstack-protector -I/opt/sw/include  -std=c89 -O3  -Wall -ansi -W -Wextra -Wdeclaration-after-statement -Wendif-labels -Wc++-compat -Wwrite-strings 

Yet, no error about implicit declarations.

Do you happen to have any netdb.h except what's in the Xcode SDKs? The real question seems to be why is your build detecting symbols that should not be available.

@cooljeanius
Copy link
Author

I have a lot of other netdb.h available:

$ locate /netdb.h
/Applications/GRASS-7.9.app/Contents/Resources/include/gssrpc/netdb.h
/Applications/GRASS-7.9.app/Contents/Resources/include/server/port/win32/netdb.h
/Applications/Playgrounds.app/Contents/Resources/Mac Catalyst.platform/MacOSX.sdk/usr/include/netdb.h
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/netdb.h
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include/netdb.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/netdb.h
/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/include/netdb.h
/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/include/netdb.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/netdb.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/netdb.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/netdb.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/netdb.h
/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/usr/include/netdb.h
/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/netdb.h
/Users/Shared/Previously Relocated Items/Security/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/include/netdb.h
/Users/Shared/Previously Relocated Items/Security/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/include/netdb.h
/Users/Shared/Previously Relocated Items/Security/Developer/SDKs/MacOSX10.1.5.sdk/usr/include/netdb.h
/Users/Shared/Previously Relocated Items/Security/Developer/SDKs/MacOSX10.2.8.sdk/usr/include/netdb.h
/Users/Shared/Previously Relocated Items/Security/Developer/SDKs/MacOSX10.3.0.sdk/usr/include/netdb.h
/Users/Shared/Previously Relocated Items/Security/Developer/SDKs/MacOSX10.4u.sdk/usr/include/netdb.h
/Users/Shared/Previously Relocated Items/Security/Developer/SDKs/MacOSX10.5.sdk/usr/include/netdb.h
/Users/Shared/Previously Relocated Items/Security/Developer/SDKs/MacOSX10.6.sdk/usr/include/netdb.h
/Users/Shared/Previously Relocated Items/Security/Developer/SDKs/MacOSX10.7.sdk/usr/include/netdb.h
/Users/Shared/Previously Relocated Items/Security/Developer/SDKs/MacOSX10.7.sdk/usr/include/postgresql/server/port/win32/netdb.h
/Users/Shared/Previously Relocated Items/Security/Developer/SDKs/MacOSX10.8.sdk/usr/include/netdb.h
/Users/Shared/Previously Relocated Items/Security/Developer/SDKs/MacOSX10.8.sdk/usr/include/postgresql/server/port/win32/netdb.h
/Users/Shared/Previously Relocated Items/Security/Developer/SDKs/MacOSX10.9.sdk/usr/include/netdb.h
/Users/Shared/Previously Relocated Items/Security/Developer/usr/include/netdb.h
/Users/Shared/Previously Relocated Items/Security/sw/include/bind/netdb.h
/Users/Shared/Previously Relocated Items/Security/sw/include/isc/netdb.h
/Users/Shared/Previously Relocated Items/Security/sw/include/lwres/netdb.h
/Users/Shared/Previously Relocated Items/Security/sw/opt/postgresql-9.2/include/server/port/win32/netdb.h
/Users/ericgallager/.nuget/packages/microsoft.net.runtime.emscripten.2.0.23.sdk.win-x64/6.0.24/tools/emscripten/cache/sysroot/include/compat/netdb.h
/Users/ericgallager/.nuget/packages/microsoft.net.runtime.emscripten.2.0.23.sdk.win-x64/6.0.24/tools/emscripten/cache/sysroot/include/netdb.h
/Users/ericgallager/.nuget/packages/microsoft.net.runtime.emscripten.2.0.23.sdk.win-x64/6.0.24/tools/emscripten/system/include/compat/netdb.h
/Users/ericgallager/.nuget/packages/microsoft.net.runtime.emscripten.2.0.23.sdk.win-x64/6.0.24/tools/emscripten/system/lib/libc/musl/include/netdb.h
/Users/ericgallager/Documents/GitHub/Darwin-0.3/kernel-7/bsd/include/netdb.h
/Users/ericgallager/Documents/GitHub/Darwin-0.3/ntp-1/ntp/include/winnt/netdb.h
/Users/ericgallager/Documents/GitHub/Darwin-0.3/ntp-1/ntp/ports/winnt/include/netdb.h
/Users/ericgallager/Documents/GitHub/Darwin-0.3/perl-1/perl/win32/include/netdb.h
/Users/ericgallager/Documents/GitHub/DragonFlyBSD/include/netdb.h
/Users/ericgallager/Documents/GitHub/scotty/tnm/compat/rpc/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.1.5.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.10.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.11.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.12.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.13.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.14.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.15.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.2.8.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.3.0.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.3.9.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.4u.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.5.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.6.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.7.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.7.sdk/usr/include/postgresql/server/port/win32/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.8.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.8.sdk/usr/include/postgresql/server/port/win32/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX10.9.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX11.0.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX11.1.sdk/usr/include/netdb.h
/Users/ericgallager/MacOSX-SDKs/MacOSX11.3.sdk/usr/include/netdb.h
/Users/ericgallager/ZCE-CDDL-FILES/usr/src/head/netdb.h
/Users/ericgallager/emacs/lib/netdb.h
/Users/ericgallager/emacs/nt/inc/netdb.h
/Users/ericgallager/emacs-savannah/nt/inc/netdb.h
/Users/ericgallager/miniconda3/include/gssrpc/netdb.h
/Users/ericgallager/miniconda3/pkgs/krb5-1.20.1-h428f121_1/include/gssrpc/netdb.h
/opt/local/Developer/SDKs/MacOSX10.12.sdk/usr/include/netdb.h
/opt/local/Developer/SDKs/MacOSX10.13.sdk/usr/include/netdb.h
/opt/local/Developer/SDKs/MacOSX10.14.sdk/usr/include/netdb.h
/opt/local/Developer/SDKs/MacOSX10.15.sdk/usr/include/netdb.h
/opt/local/arm-none-linux-gnueabi/usr/include/bits/netdb.h
/opt/local/arm-none-linux-gnueabi/usr/include/netdb.h
/opt/local/arm-none-linux-gnueabi/usr/include/rpc/netdb.h
/opt/local/include/LegacySupport/netdb.h
/opt/local/include/bind/netdb.h
/opt/local/include/gssrpc/netdb.h
/opt/local/include/postgresql10/server/port/win32/netdb.h
/opt/local/include/postgresql11/server/port/win32/netdb.h
/opt/local/include/postgresql12/server/port/win32/netdb.h
/opt/local/include/postgresql13/server/port/win32/netdb.h
/opt/local/include/postgresql14/server/port/win32/netdb.h
/opt/local/include/postgresql15/server/port/win32/netdb.h
/opt/local/include/postgresql16/server/port/win32/netdb.h
/opt/local/include/postgresql90/server/port/win32/netdb.h
/opt/local/include/postgresql95/server/port/win32/netdb.h
/opt/local/include/postgresql96/server/port/win32/netdb.h
/opt/local/var/calendarserver/Library/CalendarServer/ccs-calendarserver.previous/roots/PostgreSQL/include/postgresql/server/port/win32/netdb.h
/opt/local/var/macports/software/postgresql12/postgresql12-12.20_0+perl+tcl.darwin_20.x86_64/opt/local/include/postgresql12/server/port/win32/netdb.h
/opt/local/var/macports/software/postgresql13/postgresql13-13.16_0.darwin_20.x86_64/opt/local/include/postgresql13/server/port/win32/netdb.h
/opt/local/var/macports/software/postgresql14/postgresql14-14.13_0.darwin_20.x86_64/opt/local/include/postgresql14/server/port/win32/netdb.h
/opt/local/var/macports/software/postgresql15/postgresql15-15.8_0.darwin_20.x86_64/opt/local/include/postgresql15/server/port/win32/netdb.h
/opt/local/var/macports/software/postgresql16/postgresql16-16.4_0.darwin_20.x86_64/opt/local/include/postgresql16/server/port/win32/netdb.h
/opt/sw/include/bind/netdb.h
/opt/sw/opt/postgresql-12/include/server/port/win32/netdb.h
/opt/sw/src/fink.build/arch-tla-1.3.5-4/tla-1.3.5/src/hackerlab/os/netdb.h
/opt/sw/src/fink.build/perl5182-5.18.2-1001/perl-5.18.2/win32/include/netdb.h
/opt/sw/src/fink.build/perl5184-5.18.4-4/perl-5.18.4/win32/include/netdb.h
/opt/sw/src/fink.build/postgresql96-9.6.19-1/postgresql-9.6.19/src/include/port/win32/netdb.h
/opt/sw/src/fink.build/stellarium-x11-0.11.0-4/stellarium-0.11.0/src/core/external/kdewin32/netdb.h

How do I tell which one is getting used?

@nieder
Copy link
Member

nieder commented Nov 3, 2024

/opt/sw/include/bind/netdb.h is your problem. I think that comes from the libbind6-dev package. It's masking the system netdb.h from either /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/netdb.h

@cooljeanius
Copy link
Author

ah, so then presumably fixing #1092 would also fix this?

@cooljeanius
Copy link
Author

...well anyways, I tried removing my libbind6-dev package, but it still failed, and I can't find the error this time... is there anything we can do about all those -Wcompound-token-split-by-macro warnings? They make it impossible to see anything useful in the output...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants