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

Test 1541 fails on MinGW-w64 #1408

Closed
MarcelRaad opened this issue Apr 11, 2017 · 3 comments
Closed

Test 1541 fails on MinGW-w64 #1408

MarcelRaad opened this issue Apr 11, 2017 · 3 comments

Comments

@MarcelRaad
Copy link
Member

MarcelRaad commented Apr 11, 2017

I did this

Run test 1541 on MinGW-w64 (the following applies to the 32 bit version, but the failures are the same for the 64 bit version).

$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\msys64\mingw32\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/6.3.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../gcc-6.3.0/configure --prefix=/mingw32 --with-local-prefix=/mingw32/local --build=i686-w64-mingw32 --host=i686-w64-mingw32 --target=i686-w64-mingw32 --with-native-system-header-dir=/mingw32/i686-w64-mingw32/include --libexecdir=/mingw32/lib --enable-bootstrap --with-arch=i686 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw32 --with-mpfr=/mingw32 --with-mpc=/mingw32 --with-isl=/mingw32 --with-pkgversion='Rev2, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld --disable-sjlj-exceptions --with-dwarf2
Thread model: posix
gcc version 6.3.0 (Rev2, Built by MSYS2 project)
=== Start of file stderr1541
 URL: -
=== End of file stderr1541
=== Start of file stdout1541
 ===> Type detection failed <====
 [Detected]
 CURL_FORMAT_CURL_OFF_T:     I64d
 CURL_FORMAT_CURL_OFF_TU:    I64u
 CURL_SUFFIX_CURL_OFF_T:     LL
 CURL_SUFFIX_CURL_OFF_TU:    ULL
 CURL_SIZEOF_CURL_OFF_T:     8
 CURL_SIZEOF_LONG:           4
 CURL_TYPEOF_CURL_SOCKLEN_T: socklen_t
 CURL_PULL_SYS_TYPES_H:      Yes
 CURL_PULL_SYS_SOCKET_H:     No
 [System]
 CURL_FORMAT_CURL_OFF_T:     I64d
 CURL_FORMAT_CURL_OFF_TU:    I64u
 CURL_SUFFIX_CURL_OFF_T:     LL
 CURL_SUFFIX_CURL_OFF_TU:    ULL
 CURL_SIZEOF_CURL_OFF_T:     8
 CURL_SIZEOF_LONG:           4
 CURL_TYPEOF_CURL_SOCKLEN_T: int
 CURL_PULL_SYS_TYPES_H:      No
 CURL_PULL_SYS_SOCKET_H:     No
=== End of file stdout1541

I expected the following

Maybe MinGW-w64 has to be treated differently from the original MinGW? I'll try to get MinGW and run the test there too.

curl/libcurl version

git master 5ed16e6

operating system

Windows 10 / MSYS2

@bagder
Copy link
Member

bagder commented Apr 11, 2017

I don't think it needs to be treated differently, I think this is "just a bug". Can you check if adding this little line fixes the test case for you? (in the section following #elif defined(__MINGW32__)):

diff --git a/include/curl/system.h b/include/curl/system.h
index f4edc436d..8e441e3a1 100644
--- a/include/curl/system.h
+++ b/include/curl/system.h
@@ -243,10 +243,11 @@
 #  define CURLSYS_SIZEOF_CURL_OFF_T     8
 #  define CURLSYS_SUFFIX_CURL_OFF_T     LL
 #  define CURLSYS_SUFFIX_CURL_OFF_TU    ULL
 #  define CURLSYS_TYPEOF_CURL_SOCKLEN_T int
 #  define CURLSYS_SIZEOF_CURL_SOCKLEN_T 4
+#  define CURLSYS_PULL_SYS_TYPES_H      1
 
 #elif defined(__VMS)
 #  if defined(__VAX)
 #    define CURLSYS_SIZEOF_LONG           4
 #    define CURLSYS_TYPEOF_CURL_OFF_T     long

@MarcelRaad
Copy link
Member Author

MarcelRaad commented Apr 11, 2017

That fixes half of the issue, the other one is CURLSYS_TYPEOF_CURL_SOCKLEN_T as int vs. socklen_t. Just changing that results in a compile error because socklen_t is not defined. It is defined in <ws2tcpip.h>, which is pulled in by curlbuild.h in this block:

/* Configure process defines this to 1 when it finds out that system  */
/* header file ws2tcpip.h must be included by the external interface. */
#define CURL_PULL_WS2TCPIP_H 1
#ifdef CURL_PULL_WS2TCPIP_H
#  ifndef WIN32_LEAN_AND_MEAN
#    define WIN32_LEAN_AND_MEAN 1
#  endif
#  include <windows.h>
#  include <winsock2.h>
#  include <ws2tcpip.h>
#endif

So the #define CURL(SYS)_PULL_WS2TCPIP_H 1 should be included in the __MINGW32__ block and the #ifdef CURL(SYS)_PULL_WS2TCPIP_H block should be copied to the end of system.h to the sys/types.h and sys/socket.h blocks?

bagder added a commit that referenced this issue Apr 11, 2017
Reported-by: Marcel Raad
Fixes #1408
@bagder
Copy link
Member

bagder commented Apr 11, 2017

Converted my patch plus your amendment into PR #1409

bagder added a commit that referenced this issue Apr 11, 2017
Reported-by: Marcel Raad
Fixes #1408
@bagder bagder closed this as completed in f799130 Apr 11, 2017
MarcelRaad added a commit to MarcelRaad/curl that referenced this issue Apr 12, 2017
MarcelRaad added a commit to MarcelRaad/curl that referenced this issue Apr 12, 2017
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants