motion: fix build on musl
PATCH 1/1 motion: fix build on musl
Some toolchains (musl) have pthread_setname_np but not pthread_getname_np. The first patch fixes check on pthread_setname_np and the second one add a check for pthread_getname_np
Fixes:
-
http://autobuild.buildroot.net/results/65534775c5977e2424c5f5c63c46f9d0f39d7e1b
--- .../0001-Fix-pthread_setname_np-detection.patch | 50 ++++++++++++++++ .../motion/0002-Check-for-pthread_getname_np.patch | 66 ++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 package/motion/0001-Fix-pthread_setname_np-detection.patch create mode 100644 package/motion/0002-Check-for-pthread_getname_np.patch
package/motion/0001-Fix-pthread_setname_np-detection.patch new file +50 -0
@@ -0,0 +1,50 @@ +From 505be2201377fa347a34b6cb4164c856b55e7484 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine <[email protected]> +Date: Thu, 23 Nov 2017 22:47:39 +0100 +Subject: [PATCH] Fix pthread_setname_np detection + +Commit 6617c6f2c8aad041d3428bea11206fd2e61763b1 replaced +AC_LINK_IFELSE with AC_COMPILE_IFELSE. This has broken the +pthread_setname_np detection as compilation will always succeed even if +pthread_setname_np is not available (if the function is not found, a +simple warning will be displayed in config.log). + +The correct fix is to put back AC_LINK_IFELSE with -pthread in LIBS +otherwise compilation will fail on toolchain without pthread_setname_np. + +Signed-off-by: Fabrice Fontaine <[email protected]> +--- + configure.ac | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 1792b65..21efd2a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -128,17 +128,20 @@ fi + if test x$THREADS = xyes; then + TEMP_LIBS="$TEMP_LIBS -pthread" + TEMP_CFLAGS="${TEMP_CFLAGS} -D_THREAD_SAFE" +-fi + + ############################################################################## + ### Check for pthread_setname_np (nonstandard GNU extension) + ############################################################################## +-AC_MSG_CHECKING([for pthread_setname_np]) +-AC_COMPILE_IFELSE( ++ AC_MSG_CHECKING([for pthread_setname_np]) ++ HOLD_LIBS="$LIBS" ++ LIBS="$TEMP_LIBS" ++ AC_LINK_IFELSE( + [AC_LANG_PROGRAM([#include <pthread.h>], [pthread_setname_np(pthread_self(), "name")])], + [AC_DEFINE([HAVE_PTHREAD_SETNAME_NP], [1], [Define if you have pthread_setname_np function.]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])] ) ++ LIBS="$HOLD_LIBS" ++fi + + ############################################################################## + ### Check for JPG +-- +2.14.1 +
package/motion/0002-Check-for-pthread_getname_np.patch new file +66 -0
66 lines not on this page · raw message
Signature · 1 line
2.14.1
Thomas Petazzoni
AppliedPATCH 1/1 motion: fix build on musl
Hello,
Quoted 8 lines · Fabrice Fontaine
Some toolchains (musl) have
pthread_setname_npbut notpthread_getname_np. The first patch fixes check onpthread_setname_npand the second one add a check forpthread_getname_npFixes:
-
http://autobuild.buildroot.net/results/65534775c5977e2424c5f5c63c46f9d0f39d7e1b
Quoted 7 lines
Signed-off-by Fabrice Fontaine <[email protected]>--- .../0001-Fix-pthread_setname_np-detection.patch | 50 ++++++++++++++++ .../motion/0002-Check-for-pthread_getname_np.patch | 66 ++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 package/motion/0001-Fix-pthread_setname_np-detection.patch create mode 100644 package/motion/0002-Check-for-pthread_getname_np.patch
Applied to next, thanks. Don't forget to send the patches upstream if not already done. Thanks a lot for taking care of this build issue!
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com