Skip to content

[bug] Unable to build with github msys action #95

Open

Description

@caiiiycuk

Description

I have following action configuration:

    - uses: msys2/setup-msys2@v2
      with:
          msystem: mingw64

And trying to build wsServer. It fails because of this:

ws.c:1778:71: error: passing argument 4 of 'setsockopt' from incompatible pointer type [-Wincompatible-pointer-types]
 1778 |                         setsockopt(new_sock, SOL_SOCKET, SO_SNDTIMEO, &time,
      |                                                                       ^~~~~
      |                                                                       |
      |                                                                       struct timeval *

source code link.

I don't know the reason but problematic parameter defined as const char* in mingw headers:

  WINSOCK_API_LINKAGE int WSAAPI setsockopt(SOCKET s,int level,int optname,const char *optval,int optlen);

I can bypass this by changing error level to warning, but I think it's good to fix. Other than this wsServer works fine on windows! Thank you!

Activity

  1. added
    possible-bug
    on Aug 30, 2024
  2. caiiiycuk commented on Aug 30, 2024

    @caiiiycuk
    ContributorAuthor

    Quick workaround, just defined this in cmake:

        add_compile_options(-Wno-incompatible-pointer-types)
  3. Theldus commented on Sep 2, 2024

    @Theldus
    Owner

    Hi @caiiiycuk,
    The parameter in question is a const char*, but it can also accept other pointer types, such as struct timeval*. However, it appears that this generates a warning on Windows builds. This issue was addressed in commit 0d09382, as there’s no harm in casting to char* and void* since they are the only pointer types that are safe to cast.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    possible-bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions