Hi,
starting from this repo I’m trying to run GameLiftClient on Android. Following this this guide too I managed to compile and package the project, but the app crashes with a segmentation fault when Aws::InitAPI() is called.
This is the log from logcat:
A/libc(12286): Fatal signal 11 (SIGSEGV), code 2, fault addr 0xdddddddd in tid 12300 (Thread-3360)
A/DEBUG(2034): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
A/DEBUG(2034): Build fingerprint: 'lge/p1_global_com/p1:6.0/MRA58K/160160109a98e:user/release-keys'
A/DEBUG(2034): Revision: '11'
A/DEBUG(2034): ABI: 'arm'
A/DEBUG(2034): pid: 12286, tid: 12300, name: Thread-3360 >>> com.YourCompany.MyProject <<<
A/DEBUG(2034): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xdddddddd
A/DEBUG(2034): r0 cf7a4ae0 r1 dddddddd r2 f7100625 r3 f711f000
A/DEBUG(2034): r4 cbad9ac4 r5 cf7a4aac r6 f391e909 r7 cc1f716c
A/DEBUG(2034): r8 cf7a4ae0 r9 cf7a4ab0 sl ca7bc550 fp cf7a5118
A/DEBUG(2034): ip f382119c sp cf7a4a50 lr f37bae5d pc f38ec246 cpsr 60070030
A/DEBUG(2034): backtrace:
A/DEBUG(2034): #00 pc 000a7246 /data/app/com.YourCompany.MyProject-1/lib/arm/libaws-cpp-sdk-core.so (Aws::InitAPI(Aws::SDKOptions const&)+629)
A/DEBUG(2034): #01 pc 02c4b390 /data/app/com.YourCompany.MyProject-1/lib/arm/libUE4.so (FAWSCoreModule::StartupModule()+224)
A/DEBUG(2034): #02 pc 0337beec /data/app/com.YourCompany.MyProject-1/lib/arm/libUE4.so (FModuleManager::LoadModuleWithFailureReason(FName, EModuleLoadResult&)+2284)
A/DEBUG(2034): #03 pc 0357c924 /data/app/com.YourCompany.MyProject-1/lib/arm/libUE4.so (FModuleDescriptor::LoadModulesForPhase(ELoadingPhase::Type, TArray<FModuleDescriptor, FDefaultAllocator> const&, TMap<FName, EModuleLoadResult, FDefaultSetAllocator, TDefaultMapHashableKeyFuncs<FName, EModuleLoadResult, false> >&)+704)
A/DEBUG(2034): #04 pc 035967dc /data/app/com.YourCompany.MyProject-1/lib/arm/libUE4.so
A/DEBUG(2034): #05 pc 03595e9c /data/app/com.YourCompany.MyProject-1/lib/arm/libUE4.so (FPluginManager::LoadModulesForEnabledPlugins(ELoadingPhase::Type)+936)
A/DEBUG(2034): #06 pc 0294c280 /data/app/com.YourCompany.MyProject-1/lib/arm/libUE4.so (FEngineLoop::LoadStartupModules()+392)
A/DEBUG(2034): #07 pc 0294401c /data/app/com.YourCompany.MyProject-1/lib/arm/libUE4.so (FEngineLoop::PreInit(char16_t const*)+21508)
A/DEBUG(2034): #08 pc 0292a0e0 /data/app/com.YourCompany.MyProject-1/lib/arm/libUE4.so (FEngineLoop::PreInit(int, char16_t**, char16_t const*)+3892)
A/DEBUG(2034): #09 pc 029286dc /data/app/com.YourCompany.MyProject-1/lib/arm/libUE4.so (AndroidMain(android_app*)+3440)
A/DEBUG(2034): #10 pc 0293b304 /data/app/com.YourCompany.MyProject-1/lib/arm/libUE4.so (android_main+208)
A/DEBUG(2034): #11 pc 02964558 /data/app/com.YourCompany.MyProject-1/lib/arm/libUE4.so
A/DEBUG(2034): #12 pc 0003f9a3 /system/lib/libc.so (__pthread_start(void*)+30)
A/DEBUG(2034): #13 pc 0001a0c5 /system/lib/libc.so (__start_thread+6)
InitAPI() is called from the class AWSCoreModule that implements IModuleInterface, so Aws::InitAPI() is called inside the StartupModule() function. options is declared in the header file.
void FAWSCoreModule::StartupModule()
{
Aws::InitAPI(options);
LOG_NORMAL("Aws::InitAPI called.");
}
void FAWSCoreModule::ShutdownModule()
{
Aws::ShutdownAPI(options);
LOG_NORMAL("Aws::ShutdownAPI called.");
}<br>
The library file libaws-cpp-sdk-core.so is loaded from AWSCore.Build.cs using PublicAdditionalLibraries.Add().
Also, I made an xml file, as suggested in the second link, that copies libaws-cpp-sdk-core.so into the apk’s lib folder, then loads aws-cpp-sdk-core from inside .
The xml file is also loaded via AdditionalPropertiesForReceipt.Add(), as the wiki does.
I feel like I’m doing this the right way, but missing something. Can somebody help me figure this out?
Thank you in advance for your help.
EDIT:
After building the aws sdk with CMAKE_BUILD_TYPE=Debug, a new line appeared in the segmentation fault in logcat.
A/DEBUG(2034): #00 pc 00138f04 /data/app/com.YourCompany.MyProject-1/lib/arm/libaws-cpp-sdk-core.so (std::__ndk1::function<std::__ndk1::shared_ptr<Aws::Utils::Crypto::SymmetricCipherFactory> ()>::operator()() const+24)
A/DEBUG(2034): #01 pc 00138944 /data/app/com.YourCompany.MyProject-1/lib/arm/libaws-cpp-sdk-core.so (Aws::InitAPI(Aws::SDKOptions const&)+1456)
Also, for sake of clarity, the following are the parameters I pass to cmake:
-DBUILD_FOR_UNREAL=1
-G “NMake Makefiles”
-DBUILD_ONLY=“core;gamelift;cognito-identity;events”
-DTARGET_ARCH=ANDROID
-DNDK_DIR=C:\Users\ximera\AppData\Local\Android\Sdk\android-ndk-r12b -DCMAKE_BUILD_TYPE=Debug
-DENABLE_UNITY_BUILD=ON
-DFORCE_SHARED_CRT=OFF
-DSIMPLE_INSTALL=OFF