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

(MSYS2/MinGW/GCC 14) nonblock.c: In function 'curlx_nonblock': no non-blocking method was found/used/set #13579

Closed
LigH-de opened this issue May 10, 2024 · 13 comments
Labels
build Windows Windows-specific

Comments

@LigH-de
Copy link

LigH-de commented May 10, 2024

I did this

Compiling in media-autobuild suite for Win32 target

  CC       libcurl_la-nonblock.lo
../../lib/nonblock.c: In function 'curlx_nonblock':
../../lib/nonblock.c:82:4: error: #error "no non-blocking method was found/used/set"
   82 | #  error "no non-blocking method was found/used/set"
      |    ^~~~~
make[2]: *** [Makefile:2831: libcurl_la-nonblock.lo] Error 1

logs.zip

HAVE_IOCTLSOCKET_FIONBIO should be defined as 1 in lib/config-win32.h

I expected the following

successful compilation

curl/libcurl version

HEAD

operating system

MSYS2/MinGW

@bagder
Copy link
Member

bagder commented May 10, 2024

How do you build curl?

@LigH-de
Copy link
Author

LigH-de commented May 10, 2024

I start the media-autobuild_suite.bat and wait...

Details are in the attached logs.zip file (several logs and configurations collected by M-AB-S). Head of the make log:

CPPFLAGS:  -DGNUTLS_INTERNAL_BUILD -DNGHTTP2_STATICLIB -DPSL_STATIC
CFLAGS: -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -mthreads
CXXFLAGS: -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1
LDFLAGS: -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -static-libgcc -static-libstdc++
make -j4 

Configuration:
$ ../configure --prefix=/local32 --disable-shared --enable-static --bindir=/local32/bin-global --with-nghttp2 --with-openssl --without-gnutls --without-mbedtls --without-libssh2 --without-random --without-ca-bundle --without-ca-path --without-librtmp --with-brotli --enable-sspi --disable-debug

@vszakats
Copy link
Member

Normally for mingw-w64, HAVE_IOCTLSOCKET_FIONBIO is defined by autotools via the generated curl_config.h.
Since it isn't, it suggests that the auto-detection fails for some unrelated reason, maybe due to the extra passed options.
Peeking into config.log could give the answer.

@vszakats vszakats added the Windows Windows-specific label May 10, 2024
@LigH-de
Copy link
Author

LigH-de commented May 10, 2024

Yesterday and the day before it still compiled...

@vszakats
Copy link
Member

Our tests are silent about this. It's the line checking if ioctl FIONBIO might be used... yes in the configure output.

Is there any clue in your config.log about this particular check?

@LigH-de
Copy link
Author

LigH-de commented May 10, 2024

https://github.com/curl/curl/files/15273796/logs.zip contains all the log files.

configure:41533: checking if ioctlsocket FIONBIO is compilable
configure:41553: ccache gcc -c -D_FORTIFY_SOURCE=2 -fstack-protector-strong -mtune=generic -O2 -pipe -D__USE_MINGW_ANSI_STDIO=1 -mthreads -Werror-implicit-function-declaration -Wno-system-headers -DGNUTLS_INTERNAL_BUILD -DNGHTTP2_STATICLIB -DPSL_STATIC -IG:/MABS/msys64/mingw32/include -IG:/MABS/msys64/mingw32/include  -IG:/MABS/msys64/mingw32/include -IG:/MABS/local32/include -IG:/MABS/msys64/mingw32/include conftest.c >&5
conftest.c: In function 'main':
conftest.c:152:41: error: passing argument 3 of 'ioctlsocket' from incompatible pointer type [-Wincompatible-pointer-types]
  152 |         if(0 != ioctlsocket(0, FIONBIO, &flags))
      |                                         ^~~~~~
      |                                         |
      |                                         int *
In file included from conftest.c:144:
G:/MABS/msys64/mingw32/include/winsock2.h:1007:76: note: expected 'u_long *' {aka 'long unsigned int *'} but argument is of type 'int *'
 1007 |   WINSOCK_API_LINKAGE int WSAAPI ioctlsocket(SOCKET s,__LONG32 cmd,u_long *argp);
      |                                                                    ~~~~~~~~^~~~
...
configure:41562: result: no
configure:41585: checking if ioctlsocket FIONBIO might be used
configure:41596: result: no

@vszakats
Copy link
Member

Thanks. It's a legit complaint from the compiler, but this check has been like this since forever.

Would this be explained by a compiler upgrade? gcc 14 just happened.

@LigH-de
Copy link
Author

LigH-de commented May 10, 2024

Indeed possible...

gcc.exe (Rev2, Built by MSYS2 project) 14.1.0

@LigH-de LigH-de changed the title (MSYS2/MinGW) nonblock.c: In function 'curlx_nonblock': no non-blocking method was found/used/set (MSYS2/MinGW/GCC 14) nonblock.c: In function 'curlx_nonblock': no non-blocking method was found/used/set May 10, 2024
vszakats added a commit to vszakats/curl that referenced this issue May 10, 2024
```
conftest.c:152:41: error: passing argument 3 of 'ioctlsocket' from incompatible pointer type [-Wincompatible-pointer-types]
  152 |         if(0 != ioctlsocket(0, FIONBIO, &flags))
      |                                         ^~~~~~
      |                                         |
      |                                         int *
```

Reported-by: LigH
Fixes curl#13579
Closes #xxxxx
@vszakats
Copy link
Member

Would this patch fix the build for you?:
4bab28f

@LigH-de
Copy link
Author

LigH-de commented May 10, 2024

I have only little experience in editing the shell scripts used by the suite.
Are you able to provide this change as diff patch? Maybe github can do that if I just know how to build the matching URL...

@vszakats
Copy link
Member

@LigH-de
Copy link
Author

LigH-de commented May 10, 2024

Yes, I discovered how to add this patch and curl builds again.

@vszakats
Copy link
Member

@LigH-de Thanks for testing, and reporting! The fix is merged now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Windows Windows-specific
Development

Successfully merging a pull request may close this issue.

3 participants