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

unresolved external symbol Aws::Malloc #23

Open
Wylie-Modro opened this issue Oct 9, 2019 · 1 comment

Comments

@Wylie-Modro
Copy link

@Wylie-Modro Wylie-Modro commented Oct 9, 2019

Hi everyone,

I followed these wonderful tutorials to get a game session running on AWS GameLift and got clients to connect to it successfully.
I did have to rollback the GameLift Client SDK commit to the one in the video (commit 14), as I encountered something similar to this issue
I am on Windows using Unreal 4.21.

However I have hit what appears to be a missing some dependencies within the Client SDK. I was trying to use Aws::Vector which is part of AWSCore but upon build I get the following linker errors:

error LNK2019: unresolved external symbol "void * __cdecl Aws::Malloc(char const *,unsigned __int64)" (?Malloc@Aws@@YAPEAXPEBD_K@Z) referenced in function "private: bool __cdecl std::vector<class Aws::GameLift::Model::GameSessionQueueDestination,class Aws::Allocator<class Aws::GameLift::Model::GameSessionQueueDestination> >::_Buy(unsigned __int64)" (?_Buy@?$vector@VGameSessionQueueDestination@Model@GameLift@Aws@@V?$Allocator@VGameSessionQueueDestination@Model@GameLift@Aws@@@4@@std@@AEAA_N_K@Z)

error LNK2019: unresolved external symbol "void __cdecl Aws::Free(void *)" (?Free@Aws@@YAXPEAX@Z) referenced in function "public: __cdecl std::vector<class Aws::GameLift::Model::GameSessionQueueDestination,class Aws::Allocator<class Aws::GameLift::Model::GameSessionQueueDestination> >::~vector<class Aws::GameLift::Model::GameSessionQueueDestination,class Aws::Allocator<class Aws::GameLift::Model::GameSessionQueueDestination> >(void)" (??1?$vector@VGameSessionQueueDestination@Model@GameLift@Aws@@V?$Allocator@VGameSessionQueueDestination@Model@GameLift@Aws@@@4@@std@@QEAA@XZ)

These linker errors are usually encountered when the linker cannot find the correct function definition for a used function declaration. The Client SDKs that I cloned has the AWSCore header files and I also have the aws-cpp-sdk-core dll and lib files in Plugins\GameLiftClientSDK\ThirdParty\GameLiftClientSDK\Win64, like the tutorial instructed, so it should have the correct function definitions.

AWS::Vector is using AWS::Allocator, which is then using Malloc and Free.

AWSVector.h:
template< typename T > using Vector = std::vector< T, Aws::Allocator< T > >;
AWSAllocator.h:

typename Base::pointer allocate(size_type n, const void *hint = nullptr)
{
AWS_UNREFERENCED_PARAM(hint);
return reinterpret_cast<typename Base::pointer>(Malloc("AWSSTL", n * sizeof(T)));
}

AWSMemory.h:
AWS_CORE_API void* Malloc(const char* allocationTag, size_t allocationSize);

In the aws-cpp-sdk github repo I can see the AWSMemory.cpp file

I can see that it has a #include <aws/common/common.h> from the aws-c-common library, but I believe that was only added recently and since I am using an older commit of the client sdk I dont think I should have encountered this error. AWS says ." "Starting from version 1.7.0, we added several third party dependencies, including aws-c-common, aws-checksums and aws-c-event-stream

Either way, in attempt to solve this I added AWSMemory.cpp to AWSCore, then downloaded aws-c-common, built it, copied its lib and dll to ThirdParty and added all the headers to AWSCore/Public/common. Then edited AWSCore.Build.cs and AWSCoreModule.h/.cpp to add the lib and dll dependencies, but I end up hitting a wall of macro error like:

aws/common/assert.h(57): error C4668: '__clang_analyzer__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
aws/common/predicates.h(21): error C4668: 'AWS_DEEP_CHECKS' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
AWSMemory.cpp(129): error C4668: '__GNUC__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'

I have also tried to build aws-c-common from source as a new unreal module, but ended up with even more errors.

I just want to use a damn AWS::Vector.
Anyone know if I am missing something or is there a defect with the client sdk?

@chris-gong, did you ever encounter this?

@Wylie-Modro

This comment has been minimized.

Copy link
Author

@Wylie-Modro Wylie-Modro commented Oct 13, 2019

Just a note: I updated the AWS CPP SDK binaries and still get the same error.
Any ideas @ryanjon2040?

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