The code that I have requires c++11 and always worked without issues because libc++ could be used (and was used by default by SFML).
The
last sfml commit however removed support for c++_shared and c++_static. (Could someone perhaps link to a discussion on why libc++ support was dropped?)
I can't use stlport because it lacks c++11 support (it e.g. does not have std::shared_ptr).
My code could compile using gnustl with minor modifications (gnustl e.g. misses std::round), but SFML seems to crash when using this STL. Below is the adb logcat output of the crash when running the sfml android example with "APP_STL := gnustl_static" and "APP_ABI := x86" set in jni/Application.mk.
07-22 11:32:13.163 2998 3011 F libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0xc730245c in tid 3011 (om.example.sfml)
07-22 11:32:13.280 950 950 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-22 11:32:13.280 950 950 F DEBUG : Build fingerprint: 'Android/sdk_google_phone_x86/generic_x86:6.0/MASTER/2524533:userdebug/test-keys'
07-22 11:32:13.280 950 950 F DEBUG : Revision: '0'
07-22 11:32:13.280 950 950 F DEBUG : ABI: 'x86'
07-22 11:32:13.280 950 950 F DEBUG : pid: 2998, tid: 3011, name: om.example.sfml >>> com.example.sfml <<<
07-22 11:32:13.280 950 950 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc730245c
07-22 11:32:13.283 950 950 F DEBUG : eax c730245c ebx b734a71c ecx c730245c edx b7357f1c
07-22 11:32:13.283 950 950 F DEBUG : esi c7302454 edi ab200000
07-22 11:32:13.283 950 950 F DEBUG : xcs 00000073 xds 0000007b xes 0000007b xfs 00000007 xss 0000007b
07-22 11:32:13.283 950 950 F DEBUG : eip b72d3ba3 ebp ab2381f0 esp a40ff210 flags 00210286
07-22 11:32:13.285 950 950 F DEBUG :
07-22 11:32:13.285 950 950 F DEBUG : backtrace:
07-22 11:32:13.285 950 950 F DEBUG : #00 pc 00081ba3 /system/lib/libc.so (pthread_mutex_lock+11)
07-22 11:32:13.285 950 950 F DEBUG : #01 pc 000a281a /system/lib/libc.so (je_arena_dalloc_large+40)
07-22 11:32:13.285 950 950 F DEBUG : #02 pc 000be74e /system/lib/libc.so (je_free+830)
07-22 11:32:13.285 950 950 F DEBUG : #03 pc 00016c4b /system/lib/libc.so (free+30)
07-22 11:32:13.285 950 950 F DEBUG : #04 pc 00009e6b /data/app/com.example.sfml-1/lib/x86/libsfml-example.so (operator delete(void*)+27)
07-22 11:32:13.285 950 950 F DEBUG : #05 pc 000081f6 /data/app/com.example.sfml-1/lib/x86/libsfml-example.so (main+1494)
07-22 11:32:13.285 950 950 F DEBUG : #06 pc 000082d8 /data/app/com.example.sfml-1/lib/x86/libsfml-example.so (sf::priv::main(sf::priv::ActivityStates*)+152)
07-22 11:32:13.285 950 950 F DEBUG : #07 pc 000089b0 /data/app/com.example.sfml-1/lib/x86/libsfml-example.so (sf::priv::ThreadFunctorWithArg<void* (*)(sf::priv::ActivityStates*), sf::priv::ActivityStates*>::run()+16)
07-22 11:32:13.285 950 950 F DEBUG : #08 pc 0000e082 /data/app/com.example.sfml-1/lib/x86/libsfml-system.so (sf::Thread::run()+18)
07-22 11:32:13.285 950 950 F DEBUG : #09 pc 0000f24b /data/app/com.example.sfml-1/lib/x86/libsfml-system.so
07-22 11:32:13.285 950 950 F DEBUG : #10 pc 00080a93 /system/lib/libc.so (__pthread_start(void*)+56)
07-22 11:32:13.285 950 950 F DEBUG : #11 pc 00021952 /system/lib/libc.so (__start_thread+25)
07-22 11:32:13.285 950 950 F DEBUG : #12 pc 000170b6 /system/lib/libc.so (__bionic_clone+70)
This was the cmake command used for this sfml version:
cmake -DANDROID_ABI=x86 -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/android.toolchain.cmake -DANDROID_STL=gnustl_static ..
The same crash seems to occur in older SFML versions as well, but at least in these version I was able to use c++_static (or c++_shared).
Is there a way to use c++11 on android with the latest sfml version?