* bug#35405: Guile stable-2.2 HEAD fails to compile on MingGW-W64.
@ 2019-04-23 22:04 John Ralls
2019-04-23 22:12 ` bug#35405: Patch for 35405 John Ralls
0 siblings, 1 reply; 4+ messages in thread
From: John Ralls @ 2019-04-23 22:04 UTC (permalink / raw)
To: 35405
1.
In file included from C:/gcdev64/gnucash/maint/src/guile/lib/poll.c:39:0:
C:/gcdev64/msys2/mingw32/i686-w64-mingw32/include/winsock2.h:1155:16: error: redefinition of 'struct pollfd'
typedef struct pollfd {
^~~~~~
In file included from C:/gcdev64/gnucash/maint/src/guile/lib/poll.c:32:0:
./poll.h:405:8: note: originally defined here
struct pollfd
^~~~~~
CC recvfrom.lo
C:/gcdev64/gnucash/maint/src/guile/lib/poll.c:329:1: error: conflicting types for 'poll'
poll (struct pollfd *pfd, nfds_t nfd, int timeout)
^~~~
In file included from C:/gcdev64/gnucash/maint/src/guile/lib/poll.c:32:0:
./poll.h:435:1: note: previous declaration of 'poll' was here
_GL_FUNCDECL_SYS (poll, int, (struct pollfd *pfd, nfds_t nfd, int timeout));
^
2.
C:/gcdev64/gnucash/maint/src/guile/libguile/socket.c:43:10: fatal error: netinet/tcp.h: No such file or directory
#include <netinet/tcp.h>
^~~~~~~~~~~~~~~
3.
../lib/.libs/libgnu.a(timegm.o): In function `timegm':
C:/gcdev64/gnucash/maint/src/guile/lib/timegm.c:39: undefined reference to `mktime_internal'
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#35405: Patch for 35405
2019-04-23 22:04 bug#35405: Guile stable-2.2 HEAD fails to compile on MingGW-W64 John Ralls
@ 2019-04-23 22:12 ` John Ralls
2019-06-30 15:30 ` Ludovic Courtès
2019-06-30 15:30 ` Ludovic Courtès
0 siblings, 2 replies; 4+ messages in thread
From: John Ralls @ 2019-04-23 22:12 UTC (permalink / raw)
To: 35405
[-- Attachment #1: 0001-Fix-build-on-MinGW-w64.patch --]
[-- Type: application/octet-stream, Size: 2222 bytes --]
From f2de9d206b33bc2e27acde1e751df9ba8faf60a9 Mon Sep 17 00:00:00 2001
From: John Ralls <jralls@ceridwen.us>
Date: Tue, 23 Apr 2019 15:06:48 -0700
Subject: [PATCH] Fix build on MinGW-w64
Fixes bug 35405
* lib/poll.h: MinGW provides struct pollfd in winsock2.h and
lib/threads.h includes it so disable declaring it in poll.h and
get the declaration from winsock2.h. Otherwise gcc complains that
poll() has a different signature between the declaration and
definition.
* libguile/socket.c: TCP declarations are in winsock.h on Windows.
* libguile/timegm.c: MinGW doesn't include mktime so include mktime.c to
provide it.
---
lib/poll.in.h | 5 +++++
lib/timegm.c | 2 ++
libguile/socket.c | 6 +++++-
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/lib/poll.in.h b/lib/poll.in.h
index e9b141d8f..3b0a99165 100644
--- a/lib/poll.in.h
+++ b/lib/poll.in.h
@@ -40,6 +40,9 @@
#if !@HAVE_POLL_H@
+# ifdef __MINGW32__
+# include <winsock2.h>
+# endif
/* fake a poll(2) environment */
# define POLLIN 0x0001 /* any readable data available */
@@ -55,12 +58,14 @@
# if !GNULIB_defined_poll_types
+# ifndef __MINGW32__
struct pollfd
{
int fd; /* which file descriptor to poll */
short events; /* events we are interested in */
short revents; /* events found on return */
};
+# endif
typedef unsigned long nfds_t;
diff --git a/lib/timegm.c b/lib/timegm.c
index 168da8ead..35bc67dc1 100644
--- a/lib/timegm.c
+++ b/lib/timegm.c
@@ -38,3 +38,5 @@ timegm (struct tm *tmp)
tmp->tm_isdst = 0;
return __mktime_internal (tmp, __gmtime_r, &gmtime_offset);
}
+
+#include "mktime.c"
diff --git a/libguile/socket.c b/libguile/socket.c
index 71c17e892..f5371b6c8 100644
--- a/libguile/socket.c
+++ b/libguile/socket.c
@@ -40,7 +40,11 @@
#include <sys/un.h>
#endif
#include <netinet/in.h>
-#include <netinet/tcp.h>
+#ifdef __MINGW32__
+# include <winsock.h>
+#else
+# include <netinet/tcp.h>
+#endif
#include <netdb.h>
#include <arpa/inet.h>
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#35405: Patch for 35405
2019-04-23 22:12 ` bug#35405: Patch for 35405 John Ralls
@ 2019-06-30 15:30 ` Ludovic Courtès
2019-06-30 15:30 ` Ludovic Courtès
1 sibling, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2019-06-30 15:30 UTC (permalink / raw)
To: John Ralls; +Cc: 35405
Hi John,
Apologies for the late reply.
John Ralls <jralls@ceridwen.us> skribis:
> From f2de9d206b33bc2e27acde1e751df9ba8faf60a9 Mon Sep 17 00:00:00 2001
> From: John Ralls <jralls@ceridwen.us>
> Date: Tue, 23 Apr 2019 15:06:48 -0700
> Subject: [PATCH] Fix build on MinGW-w64
>
> Fixes bug 35405
>
> * lib/poll.h: MinGW provides struct pollfd in winsock2.h and
> lib/threads.h includes it so disable declaring it in poll.h and
> get the declaration from winsock2.h. Otherwise gcc complains that
> poll() has a different signature between the declaration and
> definition.
> * libguile/socket.c: TCP declarations are in winsock.h on Windows.
> * libguile/timegm.c: MinGW doesn't include mktime so include mktime.c to
> provide it.
The portability later in lib/ comes from the Gnulib project:
https://gnu.org/s/gnulib
Could you check whether the issue is fixed there in current Git
‘master’, and if not report it to bug-gnulib@gnu.org?
Thank you,
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#35405: Patch for 35405
2019-04-23 22:12 ` bug#35405: Patch for 35405 John Ralls
2019-06-30 15:30 ` Ludovic Courtès
@ 2019-06-30 15:30 ` Ludovic Courtès
1 sibling, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2019-06-30 15:30 UTC (permalink / raw)
To: John Ralls; +Cc: 35405
Hi John,
Apologies for the late reply.
John Ralls <jralls@ceridwen.us> skribis:
> From f2de9d206b33bc2e27acde1e751df9ba8faf60a9 Mon Sep 17 00:00:00 2001
> From: John Ralls <jralls@ceridwen.us>
> Date: Tue, 23 Apr 2019 15:06:48 -0700
> Subject: [PATCH] Fix build on MinGW-w64
>
> Fixes bug 35405
>
> * lib/poll.h: MinGW provides struct pollfd in winsock2.h and
> lib/threads.h includes it so disable declaring it in poll.h and
> get the declaration from winsock2.h. Otherwise gcc complains that
> poll() has a different signature between the declaration and
> definition.
> * libguile/socket.c: TCP declarations are in winsock.h on Windows.
> * libguile/timegm.c: MinGW doesn't include mktime so include mktime.c to
> provide it.
The portability layer in lib/ comes from the Gnulib project:
https://gnu.org/s/gnulib
Could you check whether the issue is fixed there in current Git
‘master’, and if not report it to bug-gnulib@gnu.org?
Thank you,
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-06-30 15:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-23 22:04 bug#35405: Guile stable-2.2 HEAD fails to compile on MingGW-W64 John Ralls
2019-04-23 22:12 ` bug#35405: Patch for 35405 John Ralls
2019-06-30 15:30 ` Ludovic Courtès
2019-06-30 15:30 ` Ludovic Courtès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).