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

mingw compatibility - IPV6_V6ONL undefined and other symbols #5

Closed
davidm opened this issue May 2, 2012 · 2 comments
Closed

mingw compatibility - IPV6_V6ONL undefined and other symbols #5

davidm opened this issue May 2, 2012 · 2 comments

Comments

@davidm
Copy link
Contributor

davidm commented May 2, 2012

In the latest "unstable" branch, IPV6_V6ONL is not always defined (e.g. when I cross compiled mingw from Linux). A workaround is seen in:

http://svn.apache.org/repos/asf/apr/apr/trunk/network_io/win32/sockopt.c

So, I did

diff --git a/src/options.c b/src/options.c
index 6cae7ee..2844c0c 100644
--- a/src/options.c
+++ b/src/options.c
@@ -10,6 +10,11 @@
 #include "options.h"
 #include "inet.h"

+/* not available on older Windows SDK and mingw */
+#ifndef IPV6_V6ONLY
+#define IPV6_V6ONLY 27
+#endif
+
 /*=========================================================================*\
 * Internal functions prototypes
 \*=========================================================================*/
diff --git a/src/tcp.c b/src/tcp.c
index 94148c5..fdd85f4 100644
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -13,6 +13,11 @@
 #include "options.h"
 #include "tcp.h"

+/* not available on older Windows SDK and mingw */
+#ifndef IPV6_V6ONLY
+#define IPV6_V6ONLY 27
+#endif
+
 /*=========================================================================*\
 * Internal function prototypes
 \*=========================================================================*/
diff --git a/src/udp.c b/src/udp.c
index 0241cc5..6630744 100644
--- a/src/udp.c
+++ b/src/udp.c
@@ -13,6 +13,11 @@
 #include "options.h"
 #include "udp.h"

+/* not available on older Windows SDK and mingw */
+#ifndef IPV6_V6ONLY
+#define IPV6_V6ONLY 27
+#endif
+
 /* min and max macros */
 #ifndef MIN
 #define MIN(x, y) ((x) < (y) ? x : y)

However, inet.c and tcp.c still rely on some *nix specific functions:

CMakeFiles/socket_core.dir/objects.a(inet.c.obj):inet.c:(.text+0x2c5): undefined reference to `_socket_gaistrerror'
CMakeFiles/socket_core.dir/objects.a(inet.c.obj):inet.c:(.text+0x5ad): undefined reference to `_inet_ntop'
CMakeFiles/socket_core.dir/objects.a(inet.c.obj):inet.c:(.text+0x690): undefined reference to `_inet_ntop'
CMakeFiles/socket_core.dir/objects.a(inet.c.obj):inet.c:(.text+0x7b4): undefined reference to `_inet_ntop'
CMakeFiles/socket_core.dir/objects.a(inet.c.obj):inet.c:(.text+0x897): undefined reference to `_inet_ntop'
CMakeFiles/socket_core.dir/objects.a(inet.c.obj):inet.c:(.text+0xb5b): undefined reference to `_socket_gaistrerror'
CMakeFiles/socket_core.dir/objects.a(inet.c.obj):inet.c:(.text+0xc79): undefined reference to `_socket_gaistrerror'
CMakeFiles/socket_core.dir/objects.a(tcp.c.obj):tcp.c:(.text+0xb62): undefined reference to `_socket_gaistrerror'
@darkrain42
Copy link
Contributor

I was looking at this briefly a few weeks back (building with Visual Studio, which I quickly abandoned) -- wsocket.c needs to define socket_gaistrerror as a thin wrapper around wstrerror. See MSDN docs on getaddrinfo's return value

@darkrain42
Copy link
Contributor

And for inet_ntop (apparently only available in Windows Vista and Windows Server 2008 and newer), the Win32 API offers WSAAddressToString.

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

No branches or pull requests

3 participants