# SSL related linker errors Android NDK app and C++ client

**URL:** <https://forum.heroiclabs.com/t/ssl-related-linker-errors-android-ndk-app-and-c-client/1248>\
**Category:** Local Setup\
**Tags:** sdk-cpp\
**Created:** [December 22, 2020, 8:12pm UTC](https://forum.heroiclabs.com/t/ssl-related-linker-errors-android-ndk-app-and-c-client/1248 "2020-12-22T20:12:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pinky](https://avatars.discourse-cdn.com/v4/letter/p/3d9bf3/32.png) [@Pinky](https://forum.heroiclabs.com/u/Pinky)\
**Post date:** [December 22, 2020, 8:12pm UTC](https://forum.heroiclabs.com/t/ssl-related-linker-errors-android-ndk-app-and-c-client/1248/1 "2020-12-22T20:12:45Z")

</div>

I am trying to get the Nakama C++ client working with my Cocos2d-x app on Android. For iOS, Mac and Linux I have it working perfectly, but for Android I run into problems related to OpenSSL/BoringSSL.

First of all I ran into issues with the .mk file for the Nakama C++ Android client. It contains references to libraries that are not included. I have changed it to reflect the libraries that are included, but now I get linker errors as my app is also statically linked with OpenSSL (for libcurl, which I use heavily also).

- when I incude both the Nakama boring SSL libs and OpenSSL I get errors with duplicates
- when I remove the OpenSSL libs, I get errors on missing references in Curl
- when I remove the Boring libs i get missing references in libcpprest

How can I solve this? I am using Android Studio with NDK-BUILD and am an absolute n00b when it comes to the Android build environment.

By the way … I use the C++ client and not the Cocos2d C++ client as that one gave me issues with the libwebsockets lib that is included in my cocos setup (3.17). The C++ client worked out of the box on iOS. Mac and Linux (even though on iOS I also use OpenSSL).

---

<div class="post-metadata">

**Author:** ![Pinky](https://avatars.discourse-cdn.com/v4/letter/p/3d9bf3/32.png) [@Pinky](https://forum.heroiclabs.com/u/Pinky)\
**Post date:** [December 22, 2020, 11:01pm UTC](https://forum.heroiclabs.com/t/ssl-related-linker-errors-android-ndk-app-and-c-client/1248/2 "2020-12-22T23:01:23Z")

</div>

Well for prosperity: I solved it by using the dynamic library.

I changed the .mk file of the client to:

```
LOCAL_PATH := $(call my-dir)

LIB_PATH := $(LOCAL_PATH)/../shared-libs/android/$(TARGET_ARCH_ABI)

include $(CLEAR_VARS)
LOCAL_MODULE := nakama-cpp
LOCAL_MODULE_FILENAME := libnakama-cpp
LOCAL_SRC_FILES := $(LIB_PATH)/$(LOCAL_MODULE_FILENAME).so
include $(PREBUILT_SHARED_LIBRARY)

```

And added the following to my app’s makefile:

```
LOCAL_SHARED_LIBRARIES := nakama-cpp

$(call import-add-path, $(LOCAL_PATH)/../../../nakama-cpp-sdk)
$(call import-module, nakama-cpp-android)
```
