From 461a28a566aa7d752383a401d62396252c239cbd Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 14 Mar 2022 23:17:44 -0400 Subject: [PATCH] winsup: disable fortify source When using a compiler that automatically enables -D_FORTIFY_SOURCE, building winsup fails with errors like below. Since winsup is not setup to compile itself with _FORTIFY_SOURCE, disable it for now. make[4]: Entering directory '.../x86_64-pc-cygwin/winsup/cygwin' CC libc/minires-os-if.o In file included from .../newlib/newlib/libc/include/ssp/strings.h:34, from .../newlib/newlib/libc/include/strings.h:77, from .../newlib/newlib/libc/include/string.h:24, from ../../../../../winsup/cygwin/string.h:12, from /usr/x86_64-pc-cygwin/usr/include/w32api/guiddef.h:154, from /usr/x86_64-pc-cygwin/usr/include/w32api/winnt.h:635, from /usr/x86_64-pc-cygwin/usr/include/w32api/minwindef.h:163, from /usr/x86_64-pc-cygwin/usr/include/w32api/windef.h:9, from /usr/x86_64-pc-cygwin/usr/include/windows.h:69, from ../../../../../winsup/cygwin/winlean.h:56, from ../../../../../winsup/cygwin/winsup.h:84, from ../../../../../winsup/cygwin/libc/minires-os-if.c:13: .../newlib/winsup/cygwin/include/ssp/socket.h:9:1: error: conflicting types for 'recv'; have 'ssize_t(int, void *, size_t, int)' {aka 'long int(int, void *, long unsigned int, int)'} 9 | __ssp_redirect0(ssize_t, recv, \ | ^~~~~~~~~~~~~~~ In file included from /usr/x86_64-pc-cygwin/usr/include/w32api/ws2tcpip.h:17, from ../../../../../winsup/cygwin/libc/minires-os-if.c:14: /usr/x86_64-pc-cygwin/usr/include/w32api/winsock2.h:1022:34: note: previous declaration of 'recv' with type 'int(SOCKET, char *, int, int)' {aka 'int(long long unsigned int, char *, int, int)'} 1022 | WINSOCK_API_LINKAGE int WSAAPI recv(SOCKET s,char *buf,int len,int flags); | ^~~~ In file included from .../newlib/newlib/libc/include/ssp/strings.h:34, from .../newlib/newlib/libc/include/strings.h:77, from .../newlib/newlib/libc/include/string.h:24, from ../../../../../winsup/cygwin/string.h:12, from /usr/x86_64-pc-cygwin/usr/include/w32api/guiddef.h:154, from /usr/x86_64-pc-cygwin/usr/include/w32api/winnt.h:635, from /usr/x86_64-pc-cygwin/usr/include/w32api/minwindef.h:163, from /usr/x86_64-pc-cygwin/usr/include/w32api/windef.h:9, from /usr/x86_64-pc-cygwin/usr/include/windows.h:69, from ../../../../../winsup/cygwin/winlean.h:56, from ../../../../../winsup/cygwin/winsup.h:84, from ../../../../../winsup/cygwin/libc/minires-os-if.c:13: .../newlib/winsup/cygwin/include/ssp/socket.h:13:1: error: conflicting types for 'recvfrom'; have 'ssize_t(int, void *, size_t, int, struct sockaddr *, socklen_t *)' {aka 'long int(int, void *, long unsigned int, int, struct sockaddr *, int *)'} 13 | __ssp_redirect0(ssize_t, recvfrom, \ | ^~~~~~~~~~~~~~~ In file included from /usr/x86_64-pc-cygwin/usr/include/w32api/ws2tcpip.h:17, from ../../../../../winsup/cygwin/libc/minires-os-if.c:14: /usr/x86_64-pc-cygwin/usr/include/w32api/winsock2.h:1023:34: note: previous declaration of 'recvfrom' with type 'int(SOCKET, char *, int, int, struct sockaddr *, int *)' {aka 'int(long long unsigned int, char *, int, int, struct sockaddr *, int *)'} 1023 | WINSOCK_API_LINKAGE int WSAAPI recvfrom(SOCKET s,char *buf,int len,int flags,struct sockaddr *from,int *fromlen); | ^~~~~~~~ make[4]: *** [Makefile:1930: libc/minires-os-if.o] Error 1 CC gmon.o ../../../../../winsup/cygwin/gmon.c:60: error: "bzero" redefined [-Werror] 60 | #define bzero(ptr,size) memset (ptr, 0, size); | In file included from .../newlib/newlib/libc/include/strings.h:77, from .../newlib/newlib/libc/include/string.h:24, from ../../../../../winsup/cygwin/string.h:12, from /usr/x86_64-pc-cygwin/usr/include/w32api/guiddef.h:154, from /usr/x86_64-pc-cygwin/usr/include/w32api/winnt.h:635, from /usr/x86_64-pc-cygwin/usr/include/w32api/minwindef.h:163, from /usr/x86_64-pc-cygwin/usr/include/w32api/windef.h:9, from /usr/x86_64-pc-cygwin/usr/include/windows.h:69, from ../../../../../winsup/cygwin/winlean.h:56, from ../../../../../winsup/cygwin/winsup.h:84, from ../../../../../winsup/cygwin/gmon.h:69, from ../../../../../winsup/cygwin/gmon.c:47: .../newlib/newlib/libc/include/ssp/strings.h:43: note: this is the location of the previous definition 43 | #define bzero(dst, len) \ | cc1: all warnings being treated as errors --- winsup/acinclude.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/acinclude.m4 b/winsup/acinclude.m4 index 7c900d707..ffd15aaaa 100644 --- a/winsup/acinclude.m4 +++ b/winsup/acinclude.m4 @@ -16,7 +16,7 @@ if test -z "$newlib_headers"; then fi newlib_headers="$target_builddir/newlib/targ-include $newlib_headers" -AM_CPPFLAGS="-I${winsup_srcdir}/cygwin -I${target_builddir}/winsup/cygwin" +AM_CPPFLAGS="-U_FORTIFY_SOURCE -I${winsup_srcdir}/cygwin -I${target_builddir}/winsup/cygwin" AM_CPPFLAGS="${AM_CPPFLAGS} -isystem ${cygwin_headers}" for h in ${newlib_headers}; do AM_CPPFLAGS="${AM_CPPFLAGS} -isystem $h" -- 2.43.5