Help needed compiling Gamelift for PS5

0

Hello! I'm porting to PS5 an existing UE4 game that uses Gamelift for multiplayer. I did not find a UE4 plugin for Gamelift with PS5 support already available, so I tried cloning the aws repository and building Gamelift from source using the PS5 SDK compiler and CMake integration. But I get a compilation error on the third party dependencies and I don't know how to fix them. Here is the output log:

cmake.exe -DCMAKE_TOOLCHAIN_FILE="D:\Utils\PS5\Prospero\Tools\CMake\PS5.cmake" -A Prospero ./.. -DBUILD_ONLY=gamelift
-- Found Git: C:/Program Files/Git/cmd/git.exe (found version "2.37.0.windows.1")
-- TARGET_ARCH not specified; inferring host OS to be platform compilation target
-- Building AWS libraries as shared objects
-- Generating windows build config
-- Building project version: 1.8.187
-- Configuring Prospero
--
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Utils/aws_sdk/out-ps5/.deps
Microsoft (R) Build Engine version 16.11.2+f32259642 pour .NET Framework
Copyright (C) Microsoft Corporation. Tous droits réservés.

  Checking Build System
  Performing configure step for 'AwsCCommon'
  -- Configuring Prospero
  --
  CMake Deprecation Warning at CMakeLists.txt:25 (cmake_policy):
    The OLD behavior for policy CMP0077 will be removed from a future version
    of CMake.

    The cmake-policies(7) manual explains that the OLD behaviors of all
    policies are deprecated and that a policy should be set to OLD only under
    specific short-term circumstances.  Projects should be ported to the NEW
    behavior and not rely on setting a policy to OLD.


  -- attempting to use sanitizer list address;undefined
  -- Packaging is only supported on Linux
  -- Configuring done
  -- Generating done
CUSTOMBUILD : CMake warning :  [D:\Utils\aws_sdk\out-ps5\.deps\AwsCCommon.vcxproj]
    Manually-specified variables were not used by the project:

      CMAKE_TOOLCHAIN_FILE


  -- Build files have been written to: D:/Utils/aws_sdk/out-ps5/.deps/build/src/AwsCCommon-build
  Building Custom Rule D:/Utils/aws_sdk/third-party/CMakeLists.txt
  Performing build step for 'AwsCCommon'
  Microsoft (R) Build Engine version 16.11.2+f32259642 pour .NET Framework
  Copyright (C) Microsoft Corporation. Tous droits réservés.

    Checking Build System
    Building Custom Rule D:/Utils/aws_sdk/out-ps5/.deps/build/src/AwsCCommon/CMakeLists.txt
    environment.c
D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsCCommon\source\posix\environment.c(26,25): error : implicit declaration of function 'getenv' is invalid in C99 [-Werror,-Wimplicit-function-declaration] [D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsCCommon-build\aws-c-common.vcxproj] [D:\Utils\aws_sdk\out-ps5\.deps\AwsCCommon.vcxproj]
        const char *value = getenv(aws_string_c_str(variable_name));
                            ^
D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsCCommon\source\posix\environment.c(26,17): error : incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Werror,-Wint-conversion] [D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsCCommon-build\aws-c-common.vcxproj] [D:\Utils\aws_sdk\out-ps5\.deps\AwsCCommon.vcxproj]
        const char *value = getenv(aws_string_c_str(variable_name));
                    ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsCCommon\source\posix\environment.c(42,9): error : implicit declaration of function 'setenv' is invalid in C99 [-Werror,-Wimplicit-function-declaration] [D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsCCommon-build\aws-c-common.vcxproj] [D:\Utils\aws_sdk\out-ps5\.deps\AwsCCommon.vcxproj]
        if (setenv(aws_string_c_str(variable_name), aws_string_c_str(value), 1) != 0) {
            ^
D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsCCommon\source\posix\environment.c(50,9): error : implicit declaration of function 'unsetenv' is invalid in C99 [-Werror,-Wimplicit-function-declaration] [D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsCCommon-build\aws-c-common.vcxproj] [D:\Utils\aws_sdk\out-ps5\.deps\AwsCCommon.vcxproj]
        if (unsetenv(aws_string_c_str(variable_name)) != 0) {
            ^
    4 errors generated.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: la build personnalisée de 'D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\5f1e4345a9d911eaa5fc8616d695c793\AwsCCommon-configure.rule;D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\5f1e4345a9d911eaa5fc8616d695c793\AwsCCommon-build.rule;D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\5f1e4345a9d911eaa5fc8616d695c793\AwsCCommon-install.rule;D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\291e455fb70b57eb98a005f919e01343\AwsCCommon-complete.rule;D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\075aa0e2c4544e3f37305cb661ccfd02\AwsCCommon.rule;D:\Utils\aws_sdk\third-party\CMakeLists.txt' s'est arrêtée. Code 1. [D:\Utils\aws_sdk\out-ps5\.deps\AwsCCommon.vcxproj]
  Performing configure step for 'AwsChecksums'
  -- Configuring Prospero
  --
  -- Configuring done
  -- Generating done
CUSTOMBUILD : CMake warning :  [D:\Utils\aws_sdk\out-ps5\.deps\AwsChecksums.vcxproj]
    Manually-specified variables were not used by the project:

      CMAKE_TOOLCHAIN_FILE


  -- Build files have been written to: D:/Utils/aws_sdk/out-ps5/.deps/build/src/AwsChecksums-build
  Building Custom Rule D:/Utils/aws_sdk/third-party/CMakeLists.txt
  Performing build step for 'AwsChecksums'
  Microsoft (R) Build Engine version 16.11.2+f32259642 pour .NET Framework
  Copyright (C) Microsoft Corporation. Tous droits réservés.

    Checking Build System
    Building Custom Rule D:/Utils/aws_sdk/out-ps5/.deps/build/src/AwsChecksums/CMakeLists.txt
    aws-checksums.vcxproj -> D:\Utils\aws_sdk\out-ps5\bin\Release\libaws-checksums.so
    Building Custom Rule D:/Utils/aws_sdk/out-ps5/.deps/build/src/AwsChecksums/CMakeLists.txt
prospero-lld : error : cannot open Release\aws-checksums_stub_weak.a: no such file or directory [D:\Utils\aws_sdk\out-ps5\.deps\build\src\AwsChecksums-build\aws-checksums-tests.vcxproj] [D:\Utils\aws_sdk\out-ps5\.deps\AwsChecksums.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: la build personnalisée de 'D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\67b316f4a8998627537e1875c6cc3c62\AwsChecksums-configure.rule;D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\67b316f4a8998627537e1875c6cc3c62\AwsChecksums-build.rule;D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\67b316f4a8998627537e1875c6cc3c62\AwsChecksums-install.rule;D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\291e455fb70b57eb98a005f919e01343\AwsChecksums-complete.rule;D:\Utils\aws_sdk\out-ps5\.deps\CMakeFiles\075aa0e2c4544e3f37305cb661ccfd02\AwsChecksums.rule;D:\Utils\aws_sdk\third-party\CMakeLists.txt' s'est arrêtée. Code 1. [D:\Utils\aws_sdk\out-ps5\.deps\AwsChecksums.vcxproj]
CMake Error at CMakeLists.txt:224 (message):
  Failed to build third-party libraries.


-- Configuring incomplete, errors occurred!

So I have two questions:

  • am I doing all this for nothing and is there a precompiled PS5 library available upon request?
  • if not, could you help me fix the compile error so I can make my own plugin with PS5 support?

Thanks!

Bnnoy
asked 2 years ago435 views
3 Answers
0
Accepted Answer

Hi,

Typically customers would only integrate the Gamelift SDK into the game server build that is targeting Linux or Windows platforms. The GameLift SDK is only needed on the Dedicated game server binaries to communicate with the GameLift to indicate the health and status of the game server session. The GameLift SDK is not needed inside the client builds targeting Playstation or Nintendo console platform.

What some customers might include in the Client builds is the AWS SDK to communicate with AWS REST APIs. But it's recommended that you have your own backend service between your game client and the AWS services to decouple the client from the persistent data store. So in your client you would just need a basic support for REST APIs and support for your chosen authentication flow.

For example if you want your game client on PS5 or Switch to enter a game via GameLift FlexMatch matchmaking, then you would implement a small serverless backend using AWS API Gateway and AWS Lambda to receive that request from your authenticated client. The serverless backend would in turn communicate with FlexMatch to start the matchmaking with IAM credentials. You can see a Serverless implementation example here: https://github.com/aws-samples/aws-gamelift-and-serverless-backend-sample (Note that this example does include some AWS SDK inside the clients as these are easy to start with examples, but the main point is the serverless backend)

Same goes for storing the player state, if you want to store players high score or some other more persistent data, you would create a backend that would handle that. The game client would never directly interface a service like Amazon DynamoDB database, because you want to decouple the client. The decoupling allows you to independently change the architecture of your persistent storage and also lets you handle the scalability better. If the client was directly interfacing with DynamoDB you would have to create robust retry mechanisms in your game clients incase you hit any of the write per second limits of DynamoDB table. With a backend you could handle these error cases much more easier and also implement a fall back logic, such as adding the data into a messaging queue or some other location.

So to summarise, your game clients don't typically have any AWS SDKs inside of it but instead have general HTTP REST API libraries and the library of your chose authentication (For example OAUTH) mechanism.

Hope this helps you

profile pictureAWS
EXPERT
Toni_S
answered 10 months ago
  • Hello! Thanks for the answer, I will definitely look into that. However I will also need a game server with GameLift Server SDK, and I'm having trouble with that too...

0

Hi Bnnoy, Have you tried building other AWS services from source. For instance: DynamoDB or EC2? Do you face the same errors when doing so? This will help narrow down the issue on our end.

Regards, Shashank

AWS
answered 2 years ago
0

Hello!

I tried compiling DynamoDB and EC2 and I get the same error, which seems logical because they all depend on AwsCommon which fails to compile. The first error encountered seems to point to something being not supported by C99 standard, so I tried setting CMAKE_C_STANDARD to 11 in several places (project CmakeLists.txt, PS5.Cmake toolchain file...) but I keep getting this error.

Let me know if I can run more tests to provide more information.

Bnnoy
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions