Error: undefined reference to 'std::ios_base::Init::Init() Photon+Cocos2dx 3.17.2

I tried to integrate Photon with Cocos2dx 3.17.2 C++. It was well working with Cocos2dx 3.16 but I wanted to upgrade the engine. But I am getting these ndk build errors:
Please help! How do I solve it. Photon sdk version is v4-1-6-0.

FAILED: : && /weapons/Android/android-ndk-r19c/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=armv7-none-linux-androideabi16 --gcc-toolchain=/weapons/Android/android-ndk-r19c/toolchains/llvm/prebuilt/darwin-x86_64 --sysroot=/weapons/Android/android-ndk-r19c/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mfpu=vfpv3-d16 -fno-addrsig -march=armv7-a -mthumb -mfpu=neon -Wa,–noexecstack -Wformat -Werror=format-security -stdlib=libc++ -frtti -fexceptions -fsigned-char -O0 -fno-limit-debug-info -Wl,–exclude-libs,libgcc.a -Wl,–exclude-libs,libatomic.a -static-libstdc++ -Wl,–build-id -Wl,–warn-shared-textrel -Wl,–fatal-warnings -Wl,–exclude-libs,libunwind.a -Wl,–no-undefined -Qunused-arguments -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libphoton_loadbalancing.so -o …/…/…/…/build/intermediates/cmake/debug/obj/armeabi-v7a/libphoton_loadbalancing.so Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/AuthenticationValues.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/MutablePlayer.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/Player.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/RoomOptions.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/Client.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/LobbyStatsRequest.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/MutableRoom.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/RaiseEventOptions.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/WebFlags.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/FriendInfo.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/LobbyStatsResponse.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/Peer.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/Room.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/internal/AuthenticationValuesSecretSetter.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/internal/PlayerFactory.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/internal/PlayerPropertiesCacher.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/internal/RoomPropertiesCacher.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/internal/MutablePlayerFactory.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/internal/PlayerMovementInformant.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/internal/PlayerPropertiesUpdateInformant.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/internal/Utils.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/internal/MutableRoomFactory.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/internal/PlayerMutableRoomPointerSetter.cpp.o Photon-AndroidNDK-Sdk_v4-1-6-0/CMakeFiles/photon_loadbalancing.dir/LoadBalancing-cpp/src/internal/RoomFactory.cpp.o …/…/…/…/…/…/Photon-AndroidNDK-Sdk_v4-1-6-0/Photon-cpp/lib/photon-cpp-prebuilt/libphoton-cpp-static_debug_android_armeabi-v7a_libc++.a …/…/…/…/…/…/Photon-AndroidNDK-Sdk_v4-1-6-0/Common-cpp/lib/common-cpp-prebuilt/libcommon-cpp-static_debug_android_armeabi-v7a_libc++.a -latomic -lm && :
D:/android-ndk/build//…/sources/cxx-stl/gnu-libstdc++/4.9/include/iostream:74: error: undefined reference to ‘std::ios_base::Init::Init()’
jni/…/src/EventData.cpp:94: error: undefined reference to ‘std::ios_base::Init::~Init()’
D:/android-ndk/build//…/sources/cxx-stl/gnu-libstdc++/4.9/include/iostream:74: error: undefined reference to ‘std::ios_base::Init::Init()’
jni/…/src/OperationRequest.cpp:114: error: undefined reference to ‘std::ios_base::Init::~Init()’
D:/android-ndk/build//…/sources/cxx-stl/gnu-libstdc++/4.9/include/iostream:74: error: undefined reference to ‘std::ios_base::Init::Init()’
jni/…/src/OperationResponse.cpp:123: error: undefined reference to ‘std::ios_base::Init::~Init()’
D:/android-ndk/build//…/sources/cxx-stl/gnu-libstdc++/4.9/include/iostream:74: error: undefined reference to ‘std::ios_base::Init::Init()’
jni/…/src/PhotonPeer.cpp:852: error: undefined reference to ‘std::ios_base::Init::~Init()’
D:/android-ndk/build//…/sources/cxx-stl/gnu-libstdc++/4.9/include/mutex:139: error: undefined reference to ‘std::__throw_system_error(int)’

Explain more about how you are compiling please. These errors mean c++ libraries are missing or you are trying to link against an incompatible version.

Explain your tool chain more for us.

I’m simply using the default settings I got while I created project in Cocos2dx 3.17.2.
Here are the details:

versions:
Cocos2dx C++: 3.17.2
Photon SDK: v4-1-6-0
ndk:19c
gradle: 3.1.0
cmake: 3.6.4111459

gradle.properties
PROP_COMPILE_SDK_VERSION=28
PROP_MIN_SDK_VERSION=15
PROP_TARGET_SDK_VERSION=28
PROP_APP_ABI=armeabi-v7a
PROP_BUILD_TYPE=cmake

app/build.gradle
cmake {
targets ‘MyGame’
arguments “-DCMAKE_FIND_ROOT_PATH=”, “-DANDROID_STL=c++_static”, “-DANDROID_TOOLCHAIN=clang”, “-DANDROID_ARM_NEON=TRUE”
cppFlags “-frtti -fexceptions -fsigned-char”
}

Application.mk
APP_STL := c++_static

APP_CPPFLAGS := -frtti \
-DCC_ENABLE_CHIPMUNK_INTEGRATION=1 \
-std=c++11 \
-fsigned-char \
-Wno-extern-c-compat
APP_LDFLAGS := -latomic

APP_ABI := armeabi-v7a
APP_SHORT_COMMANDS := true

ifeq ($(NDK_DEBUG),1)
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1
APP_OPTIM := debug
else
APP_CPPFLAGS += -DNDEBUG
APP_OPTIM := release
endif
APP_PLATFORM := android-15

The *.mk files are not used when you are building using CMake. Whatever settings you want to add or libraries you want to link to need to be defined in your CMakeLists.txt.

In addition to that, you never actually posted anything related to the Photon SDK. How are you including it in your build?

I put Application.mk here just to let other see. Wasn’t sure if it affects or not.
I have added Photon SDK in CMakeLists.txt.
I followed this tutorial

The bit that you’re not posting is most likely to be the cause of the issue, and perhaps it’s best to be asking these questions on Photon’s own forums. A quick google search led to this, which funnily enough describes the exact issue you’re having, along with a possible solution.

Yes I checked that Photon’s forum link too.
I have asked question there too.