mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 16:25:29 +00:00
Fixed bug 2758 - Android issues with NDK r10c and API-21
Sylvain After a long time, I found out more clearly what was going wrong. The native libraries should be built with a "APP_PLATFORM" as low as possible. Ideally, APP_PLATFORM should be equals to the minSdkVersion of the AndroidManifest.xml So that the application never runs on a lower APP_PLATFORM than it has been built for. An additional good patch would be to write explicitly in "jni/Application.mk": APP_PLATFORM=android-10 (If no APP_PLATFORM is set, the "targetSdkVersion" of the AndroidManifest.xml is applied as an APP_PLATFORM to the native libraries. And currently, this is bad, because targetSdkVersion is 12, whereas minSdkLevel is 10. And in fact, there is a warning from ndk: "Android NDK: WARNING: APP_PLATFORM android-12 is larger than android:minSdkVersion 10 in ./AndroidManifest.xml".) to precise what happened in the initial reported test-case: Let say the "c" code contains a call to "srand()". with APP_PLATFORM=android-21, libSDL2.so contains a undef reference to "srand()". with APP_PLATFORM=android-10, libSDL2.so contains a undef reference to "srand48()". but srand() is missing on devices with APP_PLATFORM=android-10 (it was in fact replaced by srand48()). So, if you build for android-21 (where srand() is available), you will really have a call to "srand()" and it will fail on android-10. That was the issue. The path tried to fix this by in fact always calling srand48(). SDL patches that were applied are beneficial anyway, there are implicitly allowing they backward compatibility of using android-21 on a android-10 platform. It can be helpful in case you want to target a higher APP_PLATFORM than minSdkVersion to have potentially access to more functions. Eg you want to have access to GLES3 functions (or other) of "android-21". But, if dlopen() fails (on android-10), you do a fall-back to GLES2.
This commit is contained in:
parent
f3502c3c53
commit
83cb2b63a3
|
@ -4,3 +4,7 @@
|
||||||
# APP_STL := stlport_static
|
# APP_STL := stlport_static
|
||||||
|
|
||||||
APP_ABI := armeabi armeabi-v7a x86
|
APP_ABI := armeabi armeabi-v7a x86
|
||||||
|
|
||||||
|
# Min SDK level
|
||||||
|
APP_PLATFORM=android-10
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#define HAVE_STDINT_H 1
|
#define HAVE_STDINT_H 1
|
||||||
#define HAVE_CTYPE_H 1
|
#define HAVE_CTYPE_H 1
|
||||||
#define HAVE_MATH_H 1
|
#define HAVE_MATH_H 1
|
||||||
|
#define HAVE_SIGNAL_H 1
|
||||||
|
|
||||||
/* C library functions */
|
/* C library functions */
|
||||||
#define HAVE_MALLOC 1
|
#define HAVE_MALLOC 1
|
||||||
|
@ -75,6 +76,7 @@
|
||||||
#define HAVE_STRTOULL 1
|
#define HAVE_STRTOULL 1
|
||||||
#define HAVE_STRTOD 1
|
#define HAVE_STRTOD 1
|
||||||
#define HAVE_ATOI 1
|
#define HAVE_ATOI 1
|
||||||
|
#define HAVE_ATOF 1
|
||||||
#define HAVE_STRCMP 1
|
#define HAVE_STRCMP 1
|
||||||
#define HAVE_STRNCMP 1
|
#define HAVE_STRNCMP 1
|
||||||
#define HAVE_STRCASECMP 1
|
#define HAVE_STRCASECMP 1
|
||||||
|
@ -101,6 +103,7 @@
|
||||||
#define HAVE_SQRTF 1
|
#define HAVE_SQRTF 1
|
||||||
#define HAVE_TAN 1
|
#define HAVE_TAN 1
|
||||||
#define HAVE_TANF 1
|
#define HAVE_TANF 1
|
||||||
|
#define HAVE_SIGACTION 1
|
||||||
#define HAVE_SETJMP 1
|
#define HAVE_SETJMP 1
|
||||||
#define HAVE_NANOSLEEP 1
|
#define HAVE_NANOSLEEP 1
|
||||||
#define HAVE_SYSCONF 1
|
#define HAVE_SYSCONF 1
|
||||||
|
|
|
@ -122,10 +122,10 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
|
||||||
void
|
void
|
||||||
SDL_SYS_SetupThread(const char *name)
|
SDL_SYS_SetupThread(const char *name)
|
||||||
{
|
{
|
||||||
#if !defined(__ANDROID__) && !defined(__NACL__)
|
#if !defined(__NACL__)
|
||||||
int i;
|
int i;
|
||||||
sigset_t mask;
|
sigset_t mask;
|
||||||
#endif /* !__ANDROID__ && !__NACL__ */
|
#endif /* !__NACL__ */
|
||||||
|
|
||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
#if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)
|
#if defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)
|
||||||
|
@ -155,14 +155,14 @@ SDL_SYS_SetupThread(const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NativeClient does not yet support signals.*/
|
/* NativeClient does not yet support signals.*/
|
||||||
#if !defined(__ANDROID__) && !defined(__NACL__)
|
#if !defined(__NACL__)
|
||||||
/* Mask asynchronous signals for this thread */
|
/* Mask asynchronous signals for this thread */
|
||||||
sigemptyset(&mask);
|
sigemptyset(&mask);
|
||||||
for (i = 0; sig_list[i]; ++i) {
|
for (i = 0; sig_list[i]; ++i) {
|
||||||
sigaddset(&mask, sig_list[i]);
|
sigaddset(&mask, sig_list[i]);
|
||||||
}
|
}
|
||||||
pthread_sigmask(SIG_BLOCK, &mask, 0);
|
pthread_sigmask(SIG_BLOCK, &mask, 0);
|
||||||
#endif /* !__ANDROID__ && !__NACL__ */
|
#endif /* !__NACL__ */
|
||||||
|
|
||||||
|
|
||||||
#ifdef PTHREAD_CANCEL_ASYNCHRONOUS
|
#ifdef PTHREAD_CANCEL_ASYNCHRONOUS
|
||||||
|
|
Loading…
Reference in a new issue