Skip to content

Build fails on Windows. #289

Open
Open
@jeffdav

Description

@jeffdav

Describe the bug

Building on Windows using swift build fails with errors.

Expected Behavior

swift build should build the project on Windows.

Current Behavior

PS C:\Users\jeffd\src\aws-crt-swift> git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
PS C:\Users\jeffd\src\aws-crt-swift> git pull
Already up to date.
PS C:\Users\jeffd\src\aws-crt-swift> swift build
warning: 'aws-crt-swift': Invalid Exclude 'C:\Users\jeffd\src\aws-crt-swift\aws-common-runtime\aws-checksums\source\intel\visualc': File not found.
Building for debugging...
...snip warnings about format specifiers...
C:\Users\jeffd\src\aws-crt-swift\aws-common-runtime\aws-c-io\source\windows\iocp\socket.c:293:27: error: field has incomplete type 'struct aws_overlapped'
  293 |     struct aws_overlapped signal;
      |                           ^
C:\Users\jeffd\src\aws-crt-swift\aws-common-runtime\aws-c-io\source\windows\iocp\socket.c:293:12: note: forward declaration of 'struct aws_overlapped'
  293 |     struct aws_overlapped signal;
      |            ^
C:\Users\jeffd\src\aws-crt-swift\aws-common-runtime\aws-c-io\source\windows\iocp\socket.c:844:57: error: incomplete definition of type 'struct aws_overlapped'
  844 |     struct socket_connect_args *socket_args = overlapped->user_data;
      |                                               ~~~~~~~~~~^
C:\Users\jeffd\src\aws-crt-swift\aws-common-runtime\aws-c-io\source\windows\iocp\socket.c:293:12: note: forward declaration of 'struct aws_overlapped'
  293 |     struct aws_overlapped signal;
      |            ^
C:\Users\jeffd\src\aws-crt-swift\aws-common-runtime\aws-c-io\source\windows\iocp\socket.c:974:5: error: call to undeclared function 'aws_overlapped_init'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  974 |     aws_overlapped_init(&socket_impl->read_io_data->signal, s_socket_connection_completion, connect_args);
      |     ^
C:\Users\jeffd\src\aws-crt-swift\aws-common-runtime\aws-c-io\source\windows\iocp\socket.c:990:9: error: call to undeclared function 'aws_overlapped_to_windows_overlapped'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  990 |         aws_overlapped_to_windows_overlapped(&socket_impl->read_io_data->signal));
      |         ^
C:\Users\jeffd\src\aws-crt-swift\aws-common-runtime\aws-c-io\source\windows\iocp\socket.c:1626:43: error: incomplete definition of type 'struct aws_overlapped'
 1626 |     struct aws_socket *socket = overlapped->user_data;
      |                                 ~~~~~~~~~~^
C:\Users\jeffd\src\aws-crt-swift\aws-common-runtime\aws-c-io\source\windows\iocp\socket.c:293:12: note: forward declaration of 'struct aws_overlapped'
  293 |     struct aws_overlapped signal;
      |            ^
...snip more errors saying basically the same thing...
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
[20/227] Compiling AwsCIo source\windows\iocp\socket.c
PS C:\Users\jeffd\src\aws-crt-swift>

Reproduction Steps

  1. Clone the repo.
  2. Run swift build from the repo root.
  3. Observe.

Possible Solution

My initial investigation indicated defining AWS_USE_IO_COMPLETION_PORTS might solve the issue. Indeed, that does allow things to progress further:

PS C:\Users\jeffd\src\aws-crt-swift> swift build -Xcc -DAWS_USE_IO_COMPLETION_PORTS
warning: 'aws-crt-swift': Invalid Exclude 'C:\Users\jeffd\src\aws-crt-swift\aws-common-runtime\aws-checksums\source\intel\visualc': File not found.
Building for debugging...
...snip format specifier warnings...
C:\Users\jeffd\src\aws-crt-swift\aws-common-runtime\aws-c-io\source\bsd\kqueue_event_loop.c:22:10: fatal error: 'sys/event.h' file not found
   22 | #include <sys/event.h>
      |          ^~~~~~~~~~~~~
1 error generated.
[40/224] Compiling AwsCIo source\bsd\kqueue_event_loop.c
PS C:\Users\jeffd\src\aws-crt-swift>

This seems like a different problem. Perhaps this shouldn't be built at all on Windows?

Additional Information/Context

No response

aws-crt-swift version used

commit 7b42e03 (HEAD -> main, tag: v0.36.0, origin/main, origin/HEAD)

Compiler and Version used

compnerd.org Swift version 6.0-dev (LLVM a527f49f462b0d7, Swift eef85a7be270421) Target: x86_64-unknown-windows-msvc

Operating System and version

Windows 11 Version 23H2 OS Build 22631.4249

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.p3This is a minor priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions