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

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

Open
caiiiycuk opened this issue Aug 30, 2024 · 2 comments
Open

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

caiiiycuk opened this issue Aug 30, 2024 · 2 comments
Labels
possible-bug A bug not confirmed yet

Comments

@caiiiycuk
Copy link
Contributor

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!

@caiiiycuk caiiiycuk added the possible-bug A bug not confirmed yet label Aug 30, 2024
@caiiiycuk
Copy link
Contributor Author

Quick workaround, just defined this in cmake:

    add_compile_options(-Wno-incompatible-pointer-types)

@Theldus
Copy link
Owner

Theldus commented Sep 2, 2024

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
Labels
possible-bug A bug not confirmed yet
Projects
None yet
Development

No branches or pull requests

2 participants