-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
DECLSPEC_IMPORT make all curl_cv_func_recv_test Failed when building in windows #4764
Comments
I don't have that problem. This computer has an old version of Visual Studio but I used a recent cmake, cmake-3.15.5-win64-x64.msi. Try from scratch.
|
Let me explain it.
What made me test recv failed is the warning C4273. Generally, the warning isn't printed. Why I can get this warning printed, like this-----
Because I used Everything to find the file I added a message here and see the content of ${OUTPUT} have a warning C4273. In Brief,
Pls try it. PS. |
I've retested with |
Pay attention to the lineno of code in CMakeLists.txt /WX is set after
So This is what happend in my work. I use cURL source code as subproject for my MSVC solution. In the main project, I set /WX in the CMakeLists.txt of root directory, which will be passed through For the |
Ok I can reproduce that here. I have no idea if that's allowed or expected. Someone that works with libcurl's cmake build system will have to review this. |
We use `check_c_source_compiles` to check possible send/recv signatures by reproducing the forward declarations from system headers. On Windows the `winsock2.h` header adds dll linkage settings to its forward declaration. If ours does not match the compiler warns: warning C4273: 'recv': inconsistent dll linkage Add `WINSOCK_API_LINKAGE` to our test signatures when it is defined so that our linkage is consistent with that from `winsock2.h`. Fixes: curl#4764
When I built curl in my project, I found all the recv_test/send_test failed.
But I can build successfully in curl-curl-7-67-0.git.
So I message something in OtherTests.cmake and CheckCSourceCompiles.cmake to check what's the different between these two project. And I found this:
in curl-curl-7-67-0.git, recv can be tested successfully but with an warning, and in my project, treat warning as error, so all recv test failed.
To fix this waning, I check the WinSock2.h and found that function recv/send have WINSOCK_API_LINKAGE description like this:
and then I found WINSOCK_API_LINKAGE == DECLSPEC_IMPORT == __declspec (dllimport)
BUT, we don't need anything in front of the function recv/send, RIGHT?
so I change OtherTests.cmake to:
build again and no warning. SO I recommend this change.
Did anybody deal with the same problem?
The text was updated successfully, but these errors were encountered: