Error linking against sdkbox

Error linking against sdkbox
0

Hi there!
My project was compiling fine until yesterday (cocos2d-x 3.16, ndk 17). After updating ndk to latest version (20), project doesn’t compile anymore. I have to change toolchain to clang and set stl to c++_static because gcc4.9 and gnustl_static are not supported with ndk 20. Everything seems to be ok but in the linking phase I get these errors:

/Users/hugo/Documents/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/memory:4448: error: undefined reference to 'std::__1::__shared_weak_count::__release_shared()' jni/src/GPGAchievementsProxy.cpp:29: error: undefined reference to 'sdkbox::NativeBridge::AddEventListener(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::function<void (std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, _jobject*)>*)' jni/src/GPGAchievementsWrapper-android.cpp:26: error: undefined reference to 'sdkbox::Logger::GetLogger(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)' jni/src/GPGAchievementsWrapper.cpp:18: error: undefined reference to 'sdkbox::SdkboxCore::isEnabled(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const' jni/src/GPGAchievementsWrapper.cpp:24: error: undefined reference to 'sdkbox::Logger::GetLogger(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)' jni/src/GPGAchievementsWrapper.cpp:37: error: undefined reference to 'sdkbox::SdkboxCore::getConfig(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const' jni/src/GPGAchievementsWrapper.cpp:43: error: undefined reference to 'sdkbox::Logger::GetLogger(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)' jni/src/GPGAchievementsWrapper.cpp:44: error: undefined reference to 'sdkbox::Json::operator[](std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)' jni/src/GPGAchievementsWrapper.cpp:50: error: undefined reference to 'sdkbox::SdkboxCore::track(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, sdkbox::Json const&)' jni/src/GPGAuthenticationProxy.cpp:28: error: undefined reference to 'sdkbox::NativeBridge::AddEventListener(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::function<void (std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, _jobject*)>*)' jni/src/GPGAuthenticationWrapper-android.cpp:26: error: undefined reference to 'sdkbox::Logger::GetLogger(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)' jni/src/GPGAuthenticationWrapper.cpp:19: error: undefined reference to 'sdkbox::SdkboxCore::isEnabled(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const' jni/src/GPGAuthenticationWrapper.cpp:38: error: undefined reference to 'sdkbox::SdkboxCore::getConfig(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const' jni/src/GPGAuthenticationWrapper.cpp:45: error: undefined reference to 'sdkbox::Json::operator[](std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)' jni/src/GPGAuthenticationWrapper.cpp:51: error: undefined reference to 'sdkbox::SdkboxCore::track(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, sdkbox::Json const&)' jni/src/GPGLeaderboardsProxy.cpp:28: error: undefined reference to 'sdkbox::NativeBridge::AddEventListener(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::function<void (std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, _jobject*)>*)' jni/src/GPGLeaderboardsWrapper.cpp:17: error: undefined reference to 'sdkbox::SdkboxCore::isEnabled(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const' jni/src/GPGLeaderboardsWrapper.cpp:36: error: undefined reference to 'sdkbox::SdkboxCore::getConfig(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const' jni/src/GPGLeaderboardsWrapper.cpp:43: error: undefined reference to 'sdkbox::Json::operator[](std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)' jni/src/GPGLeaderboardsWrapper.cpp:49: error: undefined reference to 'sdkbox::SdkboxCore::track(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, sdkbox::Json const&)' jni/src/GPGSavedGamesProxy.cpp:26: error: undefined reference to 'sdkbox::NativeBridge::AddEventListener(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::function<void (std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, _jobject*)>*)' jni/src/GPGSavedGamesWrapper-android.cpp:24: error: undefined reference to 'sdkbox::Json::operator[](std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const' jni/src/GPGSavedGamesWrapper.cpp:17: error: undefined reference to 'sdkbox::SdkboxCore::isEnabled(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const' jni/src/GPGSavedGamesWrapper.cpp:34: error: undefined reference to 'sdkbox::SdkboxCore::getConfig(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const' jni/src/GPGSnapshotWrapper.cpp:43: error: undefined reference to 'sdkbox::Json::operator[](std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)' jni/src/GPGSnapshotWrapper.cpp:49: error: undefined reference to 'sdkbox::SdkboxCore::track(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, sdkbox::Json const&)' jni/src/SdkboxPlayPlayphoneWrapper.cpp:44: error: undefined reference to 'sdkbox::SdkboxCore::addPlugin(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)' jni/src/SdkboxPlayProxy.cpp:36: error: undefined reference to 'sdkbox::NativeBridge::RemoveEventListener(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::function<void (std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, _jobject*)>*)' jni/src/SdkboxPlayProxy.cpp:22: error: undefined reference to 'sdkbox::SdkboxCore::getMetadata(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const' jni/src/SdkboxPlayProxy.cpp:46: error: undefined reference to 'sdkbox::Json::string_value(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const' jni/src/SdkboxPlayWrapper-android.cpp:25: error: undefined reference to 'sdkbox::SdkboxCore::getMetadata(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const' /Users/hugo/Documents/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:524: error: undefined reference to 'std::__1::ios_base::clear(unsigned int)' /Users/hugo/Documents/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:524: error: undefined reference to 'std::__1::ios_base::clear(unsigned int)' /Users/hugo/Documents/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:479: error: undefined reference to 'std::__1::ios_base::getloc() const' /Users/hugo/Documents/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/__locale:174: error: undefined reference to 'std::__1::locale::use_facet(std::__1::locale::id&) const' /Users/hugo/Documents/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:479: error: undefined reference to 'std::__1::locale::~locale()' /Users/hugo/Documents/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:734: error: undefined reference to 'std::__1::ios_base::getloc() const' /Users/hugo/Documents/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/__locale:174: error: undefined reference to 'std::__1::locale::use_facet(std::__1::locale::id&) const' /Users/hugo/Documents/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:734: error: undefined reference to 'std::__1::locale::~locale()' /Users/hugo/Documents/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:524: error: undefined reference to 'std::__1::ios_base::clear(unsigned int)' /Users/hugo/Documents/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:494: error: undefined reference to 'std::__1::num_put<char, std::__1::ostreambuf_iterator<char, std::__1::char_traits > >::id' /Users/hugo/Documents/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:494: error: undefined reference to 'std::__1::ctype::id' /Users/hugo/Documents/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:734: error: undefined reference to 'std::__1::ios_base::getloc() const' /Users/hugo/Documents/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/__locale:174: error: undefined reference to 'std::__1::locale::use_facet(std::__1::locale::id&) const' /Users/hugo/Documents/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:734: error: undefined reference to 'std::__1::locale::~locale()' /Users/hugo/Documents/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ios:524: error: undefined reference to 'std::__1::ios_base::clear(unsigned int)' /Users/hugo/Documents/Android/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libcxx/include/ostream:883: error: undefined reference to 'std::__1::ctype::id' jni/src/SdkboxPlayWrapper-android.cpp:187: error: undefined reference to 'std::__1::cout' jni/src/SdkboxPlayWrapper-android.cpp:62: error: undefined reference to 'sdkbox::SdkboxCore::addPlugin(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)' jni/../../share/PluginSdkboxPlay.cpp:109: error: undefined reference to 'std::__1::cout' jni/../../share/PluginSdkboxPlay.cpp:113: error: undefined reference to 'std::__1::cout' jni/../../share/PluginSdkboxPlay.cpp:118: error: undefined reference to 'std::__1::cout' clang++: error: linker command failed with exit code 1 (use -v to see invocation) make: ***

Any ideas on how to solve this? The upgrade to ndk 20 is mandatory so downgrading is not a solution :frowning:

Thanks in advance,
fryderyk

would you like share the website about this ?

No website, my project leader have told me we need to use ndk 20 from now (I don’t know why) and I’m in charge of this task, so I’m fucked because after 3 days of work I have nothing. That’s why I’m asking in the forum, sorry for the confusion :S

There is nothing I can do to make it work?

checked cocos2d-cpp 3.17 with NDK r20.

classpath 'com.android.tools.build:gradle:3.2.0'
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
PROP_BUILD_TOOLS_VERSION=28.0.2
APP_STL := c++_static

$ sdkbox info
  _______ ______  _     _ ______   _____  _     _
  |______ |     \ |____/  |_____] |     |  \___/
  ______| |_____/ |    \_ |_____] |_____| _/   \_
 Copyright (c) 2016-2018 SDKBOX Inc. v1.0.3.0
 installed packages:
     v2.5.0.1 sdkboxads
     v2.5.0.1 admob
     v2.5.0.1 googleplayservices

BUILD SUCCESSFUL in 4m 44s
55 actionable tasks: 55 executed
Move apk to /Users/admin/test/cpp317/bin/debug/android

NDK r20, arguments ‘NDK_TOOLCHAIN_VERSION=clang’

$ sdkbox info
  _______ ______  _     _ ______   _____  _     _
  |______ |     \ |____/  |_____] |     |  \___/
  ______| |_____/ |    \_ |_____] |_____| _/   \_
 Copyright (c) 2016-2018 SDKBOX Inc. v1.0.3.0
 installed packages:
     v2.5.0.1 sdkboxads
     v2.5.0.1 gpg
     v2.5.0.1 admob
     v2.5.0.1 googleplayservices

BUILD SUCCESSFUL in 9s
55 actionable tasks: 17 executed, 38 up-to-date
VCS Checkout Cache (/Users/admin/test/cpp316/proj.android-studio/.gradle/vcsWorkingDirs) has not been cleaned up in 0 days
Move apk to /Users/admin/test/cpp316/bin/debug/android
Build succeed.