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

Windows and USE_UNIX_SOCKETS #4040

Closed
gvanem opened this issue Jun 18, 2019 · 12 comments

Comments

@gvanem
Copy link
Member

commented Jun 18, 2019

Using MSVC or clang-cl, tried to build some program under tests/server.
This failed miserably with things like:

In file included from rtspd.c:55:
./server_sockaddr.h(41,24):  error: field has incomplete type 'struct sockaddr_un'
  struct sockaddr_un   sau;
                       ^

Since USE_UNIX_SOCKETS is set in ./lib/config-win32.h for NTDDI_WIN10_RS4.
But no #include <afunix.h> is present under tests/server.
The comment in sws.c:

* Systems which have Unix sockets will also have lstat */

is just assuming some Posix system; not Windows at.

My quick fix was simply:

--- a/server_sockaddr.h 2018-05-09 19:58:12
+++ b/server_sockaddr.h 2019-06-18 15:01:54
@@ -25,6 +25,8 @@

 #ifdef HAVE_SYS_UN_H
 #include <sys/un.h> /* for sockaddr_un */
+#elif WIN32
+#undef USE_UNIX_SOCKETS  /* No way */
 #endif

operating system

Win-10 (1809, build 17763.557).

@bagder

This comment has been minimized.

Copy link
Member

commented Jun 18, 2019

That makes an sws without unix-sockets support while curl in the same setup would get built with support, which then presumably will make those tests fail miserably...

@gvanem

This comment has been minimized.

Copy link
Member Author

commented Jun 18, 2019

But is seems impossible for sws to run using e.g. Strawberry Perl on Windows (due to fork() last time I tried). So building sws using MSVC (and running with that) is probably no point (?). Others probably know more.

@bagder

This comment has been minimized.

Copy link
Member

commented Jun 18, 2019

I don't know what magic that's needed (I bet @MarcelRaad can tell more), but appveyor runs the test suite on Windows for every PR and push to master like this:

bash.exe -e -l -c "cd /c/projects/curl/tests && ./runtests.pl -a -p !flaky !1139 %DISABLED_TESTS%" )

@gvanem

This comment has been minimized.

Copy link
Member Author

commented Jun 19, 2019

But I'm not sure AppVeyor uses a Windows Kit that has a #define NTDDI_WIN10_RS4.
So the problem is masked. I have the Windows Kit v. 10.0.18362.0 installed here.

Where is the log of AppVeyor's build of the tests/server source?

@jay

This comment has been minimized.

Copy link
Member

commented Jun 19, 2019

You'd have to view the full log of one of the TESTING=ON builds that uses MSVC and then search for sws. For example here's one from master.

@gvanem

This comment has been minimized.

Copy link
Member Author

commented Jun 19, 2019

Thanks Jay, but still there's no info of what Windows Kit version AppVeyor uses here.
Probably an older version that has no #define NTDDI_WIN10_RS4.
Besides the CMake test fails:

-- Performing Test USE_UNIX_SOCKETS - Failed

which is a lie since that is set here.

@bagder

This comment has been minimized.

Copy link
Member

commented Jun 19, 2019

The cmake build doesn't use config-win32.h, it generates a curl_config.h file much in the same style as configure does.

This might rather imply that the unix sockets check in cmake is broken?

@jzakrzewski

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2019

CMake bases the check on the presence of sockaddr_un.sun_path.

curl/CMakeLists.txt

Lines 636 to 642 in 4801683

option(ENABLE_UNIX_SOCKETS "Define if you want Unix domain sockets support" ON)
if(ENABLE_UNIX_SOCKETS)
include(CheckStructHasMember)
check_struct_has_member("struct sockaddr_un" sun_path "sys/un.h" USE_UNIX_SOCKETS)
else()
unset(USE_UNIX_SOCKETS CACHE)
endif()

@gvanem

This comment has been minimized.

Copy link
Member Author

commented Jun 19, 2019

... it generates a curl_config.h file ...

Oh, I didn't see that. Which means USE_UNIX_SOCKETS on Windows can never be set for tests/server/*.c? Rather confusing IMHO.

@bagder

This comment has been minimized.

Copy link
Member

commented Jun 19, 2019

Which means USE_UNIX_SOCKETS on Windows can never be set for tests/server/*.c?

Sure it can, if the cmake check detects it and then sets the define.

@gvanem

This comment has been minimized.

Copy link
Member Author

commented Jun 19, 2019

Then how does struct sockaddr_un gets pulled in for WIN32? It's in <afunix.h> which I fail to see gets included for tests/server/*.c.
Please give me a link to an AppVeyor log that compiles sws.c with USE_UNIX_SOCKETS.

@bagder

This comment has been minimized.

Copy link
Member

commented Jun 19, 2019

Right, as long as the cmake check is broken it doesn't work.

And since the check is then used for both curl and the test server, the unix-socket tests aren't attempted on windows since the client isn't built with the support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.