AcceptEx and GetAcceptExSockaddrs gives error on Windows
ffreality opened this issue · comments
I am working to implement workflow to Unreal Engine 5 to create HTTP server on Windows platform.
I cloned current windows branch with
git clone https://github.com/sogou/workflow -b windows
My CMake configurations are like this.
cmake .. -G "Visual Studio 17 2022" -A x64
-DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo"
-DOPENSSL_APPLINK_SOURCE:FILEPATH="D:/Epic/Projects/FROZEN/SDKs/FF_Plugins/Plugins/FF_OpenSSL/Source/FF_OpenSSL/ThirdParty/openssl/Win64/applink.c"
-DOPENSSL_INCLUDE_DIR:PATH="D:/Epic/SDKs/UE_5.4/Engine/Source/ThirdParty/OpenSSL/1.1.1t/include/Win64/VS2015"
-DLIB_DIR:PATH="D:/Git/Repos/C++/HTTP/workflow/_lib"
-DSSL_EAY_DEBUG:FILEPATH="SSL_EAY_DEBUG-NOTFOUND"
-DWORKFLOW_BUILD_STATIC_RUNTIME:BOOL="0"
-DLIB_EAY_RELEASE:FILEPATH="D:/Epic/SDKs/UE_5.4/Engine/Source/ThirdParty/OpenSSL/1.1.1t/lib/Win64/VS2015/Release/libcrypto.lib"
-DSSL_EAY_RELEASE:FILEPATH="D:/Epic/SDKs/UE_5.4/Engine/Source/ThirdParty/OpenSSL/1.1.1t/lib/Win64/VS2015/Release/libssl.lib"
-DCMAKE_CONFIGURATION_TYPES:STRING="Debug;Release;MinSizeRel;RelWithDebInfo"
cmake --build . --config RelWithDebInfo --target INSTALL
I haven't got any build problem but UE5 gives this error when I want to start engine.
1>workflow.lib(WinPoller.obj) : error LNK2019: unresolved external symbol AcceptEx referenced in function "int __cdecl __accept_io(class IOCPData *,int)" (?__accept_io@@YAHPEAVIOCPData@@H@Z)
1>workflow.lib(WinPoller.obj) : error LNK2019: unresolved external symbol GetAcceptExSockaddrs referenced in function "void __cdecl __accept_on_success(struct poller_result *)" (?__accept_on_success@@YAXPEAUpoller_result@@@Z)
I only have this code
THIRD_PARTY_INCLUDES_START
#ifdef _WIN64
#define UI UI_ST
#include "Windows/AllowWindowsPlatformTypes.h"
#include "workflow/WFHttpServer.h"
#include "Windows/HideWindowsPlatformTypes.h"
#undef UI
#endif
THIRD_PARTY_INCLUDES_END
void FHTTP_Thread_WF::Callback_HTTP_Start()
{
WFHttpServer TempServer([](WFHttpTask* task)
{
task->get_resp()->append_output_body("<html>Eray Test</html>");
}
);
TempServer.start(8888);
this->Server = &TempServer;
}
void FHTTP_Thread_WF::Callback_HTTP_Stop()
{
this->Server->stop();
}
I am working to implement workflow to Unreal Engine 5 to create HTTP server on Windows platform.
I cloned current windows branch with
git clone https://github.com/sogou/workflow -b windows
My CMake configurations are like this.
cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" -DOPENSSL_APPLINK_SOURCE:FILEPATH="D:/Epic/Projects/FROZEN/SDKs/FF_Plugins/Plugins/FF_OpenSSL/Source/FF_OpenSSL/ThirdParty/openssl/Win64/applink.c" -DOPENSSL_INCLUDE_DIR:PATH="D:/Epic/SDKs/UE_5.4/Engine/Source/ThirdParty/OpenSSL/1.1.1t/include/Win64/VS2015" -DLIB_DIR:PATH="D:/Git/Repos/C++/HTTP/workflow/_lib" -DSSL_EAY_DEBUG:FILEPATH="SSL_EAY_DEBUG-NOTFOUND" -DWORKFLOW_BUILD_STATIC_RUNTIME:BOOL="0" -DLIB_EAY_RELEASE:FILEPATH="D:/Epic/SDKs/UE_5.4/Engine/Source/ThirdParty/OpenSSL/1.1.1t/lib/Win64/VS2015/Release/libcrypto.lib" -DSSL_EAY_RELEASE:FILEPATH="D:/Epic/SDKs/UE_5.4/Engine/Source/ThirdParty/OpenSSL/1.1.1t/lib/Win64/VS2015/Release/libssl.lib" -DCMAKE_CONFIGURATION_TYPES:STRING="Debug;Release;MinSizeRel;RelWithDebInfo" cmake --build . --config RelWithDebInfo --target INSTALL
I haven't got any build problem but UE5 gives this error when I want to start engine.
1>workflow.lib(WinPoller.obj) : error LNK2019: unresolved external symbol AcceptEx referenced in function "int __cdecl __accept_io(class IOCPData *,int)" (?__accept_io@@YAHPEAVIOCPData@@H@Z) 1>workflow.lib(WinPoller.obj) : error LNK2019: unresolved external symbol GetAcceptExSockaddrs referenced in function "void __cdecl __accept_on_success(struct poller_result *)" (?__accept_on_success@@YAXPEAUpoller_result@@@Z)
I only have this code
THIRD_PARTY_INCLUDES_START #ifdef _WIN64 #define UI UI_ST #include "Windows/AllowWindowsPlatformTypes.h" #include "workflow/WFHttpServer.h" #include "Windows/HideWindowsPlatformTypes.h" #undef UI #endif THIRD_PARTY_INCLUDES_END void FHTTP_Thread_WF::Callback_HTTP_Start() { WFHttpServer TempServer([](WFHttpTask* task) { task->get_resp()->append_output_body("<html>Eray Test</html>"); } ); TempServer.start(8888); this->Server = &TempServer; } void FHTTP_Thread_WF::Callback_HTTP_Stop() { this->Server->stop(); }
This is a link error. Maybe you can try to link ws2_32 and wsock32. See the CMakeLists.txt https://github.com/sogou/workflow/blob/windows/test/CMakeLists.txt
THIRD_PARTY_INCLUDES_START
#ifdef _WIN64
#define UI UI_ST
#define WIN32_LEAN_AND_MEAN
#include "Windows/AllowWindowsPlatformTypes.h"
#include <winsock2.h>
#include <ws2tcpip.h>
#include <mswsock.h>
#include <stdio.h>
#include "workflow/WFHttpServer.h"
#include "Windows/HideWindowsPlatformTypes.h"
#pragma comment (lib, "Ws2_32.lib")
#pragma comment (lib, "Mswsock.lib")
#pragma comment (lib, "AdvApi32.lib")
#undef UI
#endif
THIRD_PARTY_INCLUDES_END
I did this and it worked. Generally we don't need to manually integrate windows related libraries with pragma comment because Unreal already does it under the hood. But I think this is an exception.
Currently I have another error when I want to send a request but it is another issues' topic. So, I can close it.