Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH/next 1/1] sdl2: fix build with --disable-threads
@ 2018-11-21 22:09 Fabrice Fontaine
  2018-11-23 21:02 ` Thomas Petazzoni
  0 siblings, 1 reply; 2+ messages in thread
From: Fabrice Fontaine @ 2018-11-21 22:09 UTC (permalink / raw)
  To: buildroot

SDL_LinuxSetThreadPriority() has been added since version 2.0.9 and
https://github.com/SDL-mirror/SDL/commit/f25a7fa870bdceb339e5105973f689606bcb9086

However, this function is used in src/dynapi/SDL_dynapi_procs.h even
when SDL_THREADS_DISABLED

However, when SDL_THREADS_DISABLED is set, SDL_LinuxSetThreadPriority is
not defined because thread/pthread/SDL_systhread.c is not built

So check SDL_THREADS_DISABLED in addition to __LINUX__

Fixes:
 - http://autobuild.buildroot.org/results/539cb9ab6c605dc6be73ebe90debab1a998f2451

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 .../0001-fix-build-with-disable-threads.patch | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 package/sdl2/0001-fix-build-with-disable-threads.patch

diff --git a/package/sdl2/0001-fix-build-with-disable-threads.patch b/package/sdl2/0001-fix-build-with-disable-threads.patch
new file mode 100644
index 0000000000..81f7d7446f
--- /dev/null
+++ b/package/sdl2/0001-fix-build-with-disable-threads.patch
@@ -0,0 +1,63 @@
+From 26646028f79d7f3d857df9b46cd6d0285796c699 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Wed, 21 Nov 2018 22:31:09 +0100
+Subject: [PATCH] fix build with --disable-threads
+
+SDL_LinuxSetThreadPriority() has been added since version 2.0.9 and
+https://github.com/SDL-mirror/SDL/commit/f25a7fa870bdceb339e5105973f689606bcb9086
+
+However, this function is used in src/dynapi/SDL_dynapi_procs.h even
+when SDL_THREADS_DISABLED
+
+However, when SDL_THREADS_DISABLED is set, SDL_LinuxSetThreadPriority is
+not defined because thread/pthread/SDL_systhread.c is not built
+
+So check SDL_THREADS_DISABLED in addition to __LINUX__
+
+Fixes:
+ - http://autobuild.buildroot.org/results/539cb9ab6c605dc6be73ebe90debab1a998f2451
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ include/SDL_system.h          | 4 ++--
+ src/dynapi/SDL_dynapi_procs.h | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/include/SDL_system.h b/include/SDL_system.h
+index 4dc372d6b..0513d7fa5 100644
+--- a/include/SDL_system.h
++++ b/include/SDL_system.h
+@@ -77,7 +77,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *a
+ 
+ 
+ /* Platform specific functions for Linux */
+-#ifdef __LINUX__
++#if defined(__LINUX__) && !defined(SDL_THREADS_DISABLED)
+ 
+ /**
+    \brief Sets the UNIX nice value for a thread, using setpriority() if possible, and RealtimeKit if available.
+@@ -86,7 +86,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *a
+  */
+ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority);
+  
+-#endif /* __LINUX__ */
++#endif /* defined(__LINUX__) && !defined(SDL_THREADS_DISABLED) */
+ 	
+ /* Platform specific functions for iOS */
+ #if defined(__IPHONEOS__) && __IPHONEOS__
+diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
+index c95cf708b..ee9bf60a6 100644
+--- a/src/dynapi/SDL_dynapi_procs.h
++++ b/src/dynapi/SDL_dynapi_procs.h
+@@ -708,7 +708,7 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_IsAndroidTV,(void),(),return)
+ SDL_DYNAPI_PROC(double,SDL_log10,(double a),(a),return)
+ SDL_DYNAPI_PROC(float,SDL_log10f,(float a),(a),return)
+ SDL_DYNAPI_PROC(char*,SDL_GameControllerMappingForDeviceIndex,(int a),(a),return)
+-#ifdef __LINUX__
++#if defined(__LINUX__) && !defined(SDL_THREADS_DISABLED)
+ SDL_DYNAPI_PROC(int,SDL_LinuxSetThreadPriority,(Sint64 a, int b),(a,b),return)
+ #endif
+ SDL_DYNAPI_PROC(SDL_bool,SDL_HasAVX512F,(void),(),return)
+-- 
+2.17.1
+
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Buildroot] [PATCH/next 1/1] sdl2: fix build with --disable-threads
  2018-11-21 22:09 [Buildroot] [PATCH/next 1/1] sdl2: fix build with --disable-threads Fabrice Fontaine
@ 2018-11-23 21:02 ` Thomas Petazzoni
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2018-11-23 21:02 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 21 Nov 2018 23:09:23 +0100, Fabrice Fontaine wrote:
> SDL_LinuxSetThreadPriority() has been added since version 2.0.9 and
> https://github.com/SDL-mirror/SDL/commit/f25a7fa870bdceb339e5105973f689606bcb9086
> 
> However, this function is used in src/dynapi/SDL_dynapi_procs.h even
> when SDL_THREADS_DISABLED
> 
> However, when SDL_THREADS_DISABLED is set, SDL_LinuxSetThreadPriority is
> not defined because thread/pthread/SDL_systhread.c is not built
> 
> So check SDL_THREADS_DISABLED in addition to __LINUX__
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/539cb9ab6c605dc6be73ebe90debab1a998f2451
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  .../0001-fix-build-with-disable-threads.patch | 63 +++++++++++++++++++
>  1 file changed, 63 insertions(+)
>  create mode 100644 package/sdl2/0001-fix-build-with-disable-threads.patch

I like how the inverted SDL_THREADS_DISABLED macro makes the code
readable. !SDL_THREADS_DISABLED means thread support is enabled...

But anyway, that's not your fault, that's how the existing SDL2 code
is. So applied to next, thanks! Please make sure you submit this
upstream.

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-11-23 21:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-21 22:09 [Buildroot] [PATCH/next 1/1] sdl2: fix build with --disable-threads Fabrice Fontaine
2018-11-23 21:02 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox