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

Compilation errors #342

Open
Gerzer opened this issue Feb 3, 2022 · 1 comment
Open

Compilation errors #342

Gerzer opened this issue Feb 3, 2022 · 1 comment

Comments

@Gerzer
Copy link

Gerzer commented Feb 3, 2022

I know that in the past, swift-nio-ssl wasn't officially supported on Windows, but now that Swift itself has an official Windows port, I figured that I should report a compilation issue that occurs with the official Swift for Windows toolchain:

In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:116:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared\ws2def.h:240:16: error: redefinition of 'sockaddr'
typedef struct sockaddr {
               ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:482:8: note: previous definition is here
struct sockaddr {
       ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:116:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared\ws2def.h:442:5: error: expected identifier
    IPPROTO_ICMP          = 1,
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:211:33: note: expanded from macro 'IPPROTO_ICMP'
#define IPPROTO_ICMP            1               /* control message protocol */
                                ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:116:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared\ws2def.h:443:5: error: expected identifier
    IPPROTO_IGMP          = 2,
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:212:33: note: expanded from macro 'IPPROTO_IGMP'
#define IPPROTO_IGMP            2               /* group management protocol */
                                ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:116:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared\ws2def.h:444:5: error: expected identifier
    IPPROTO_GGP           = 3,
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:213:33: note: expanded from macro 'IPPROTO_GGP'
#define IPPROTO_GGP             3               /* gateway^2 (deprecated) */
                                ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:116:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared\ws2def.h:451:5: error: expected identifier
    IPPROTO_TCP           = 6,
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:214:33: note: expanded from macro 'IPPROTO_TCP'
#define IPPROTO_TCP             6               /* tcp */
                                ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:116:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared\ws2def.h:457:5: error: expected identifier
    IPPROTO_PUP           = 12,
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:215:33: note: expanded from macro 'IPPROTO_PUP'
#define IPPROTO_PUP             12              /* pup */
                                ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:116:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared\ws2def.h:458:5: error: expected identifier
    IPPROTO_UDP           = 17,
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:216:33: note: expanded from macro 'IPPROTO_UDP'
#define IPPROTO_UDP             17              /* user datagram protocol */
                                ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:116:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared\ws2def.h:459:5: error: expected identifier
    IPPROTO_IDP           = 22,
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:217:33: note: expanded from macro 'IPPROTO_IDP'
#define IPPROTO_IDP             22              /* xns idp */
                                ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:116:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared\ws2def.h:475:5: error: expected identifier
    IPPROTO_ND            = 77,
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:218:33: note: expanded from macro 'IPPROTO_ND'
#define IPPROTO_ND              77              /* UNOFFICIAL net disk proto */
                                ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:116:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared\ws2def.h:485:5: error: expected identifier
    IPPROTO_RAW           = 255,
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:220:33: note: expanded from macro 'IPPROTO_RAW'
#define IPPROTO_RAW             255             /* raw IP packet */
                                ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:116:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared\ws2def.h:487:5: error: expected identifier
    IPPROTO_MAX           = 256,
    ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:221:33: note: expanded from macro 'IPPROTO_MAX'
#define IPPROTO_MAX             256
                                ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
In file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:116:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared\ws2def.h:638:16: error: redefinition of 'sockaddr_in'
typedef struct sockaddr_in {
               ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:309:8: note: previous definition is here
struct sockaddr_in {
       ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:136:16: error: redefinition of 'fd_set'
typedef struct fd_set {
               ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:65:16: note: previous definition is here
typedef struct fd_set {
               ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:180:8: error: redefinition of 'timeval'
struct timeval {
       ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:108:8: note: previous definition is here
struct timeval {
       ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:236:9: error: redefinition of 'hostent'
struct  hostent {
        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:164:9: note: previous definition is here
struct  hostent {
        ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:249:9: error: redefinition of 'netent'
struct  netent {
        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:177:9: note: previous definition is here
struct  netent {
        ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:256:9: error: redefinition of 'servent'
struct  servent {
        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:184:9: note: previous definition is here
struct  servent {
        ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:268:9: error: redefinition of 'protoent'
struct  protoent {
        ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:196:9: note: previous definition is here
struct  protoent {
        ^
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl\tls_record.cc:118:
In file included from C:\Users\gjaco\Desktop\Shuttle-Tracker-Server\.build\checkouts\swift-nio-ssl\Sources\CNIOBoringSSL\ssl/internal.h:173:
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock2.h:364:16: error: redefinition of 'WSAData'
typedef struct WSAData {
               ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um\winsock.h:319:16: note: previous definition is here
typedef struct WSAData {
               ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
[0/901] Compiling CNIOBoringSSL ssl\tls_record.cc

Some research that I've done seems to indicate that this issue arises because on Windows, swift-nio-ssl runs #include <windows.h> before #include <winsock2.h>. If my diagnosis is correct, then I imagine that it wouldn't be too difficult to fix.

Here's a relevant Stack Overflow thread: https://stackoverflow.com/questions/1372480/c-redefinition-header-files-winsock2-h

@Lukasa
Copy link
Contributor

Lukasa commented Feb 3, 2022

Thanks for filing this issue! Unfortunately, swift-nio itself doesn’t compile on Windows, and without getting that working we can’t get swift-nio-ssl working either.

@Gerzer Gerzer changed the title Compilation Errors Compilation errors Feb 6, 2022
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