From patchwork Fri Nov 24 06:30:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrice Fontaine X-Patchwork-Id: 840967 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="F6JZjV/u"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yjn9561blz9sNr for ; Fri, 24 Nov 2017 17:58:48 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 9555287A14; Fri, 24 Nov 2017 06:58:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id q7lqtYk8jtYa; Fri, 24 Nov 2017 06:58:43 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 8881C878F7; Fri, 24 Nov 2017 06:58:43 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 2A4061BFA57 for ; Fri, 24 Nov 2017 06:30:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 2072525D66 for ; Fri, 24 Nov 2017 06:30:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XoYpxYX57M2s for ; Fri, 24 Nov 2017 06:30:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by silver.osuosl.org (Postfix) with ESMTPS id DDE9F25D5D for ; Fri, 24 Nov 2017 06:30:25 +0000 (UTC) Received: by mail-wr0-f196.google.com with SMTP id z14so19372024wrb.8 for ; Thu, 23 Nov 2017 22:30:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=As6jiWFuQW+IepOGVt4Ucpepq4h8QgVBLKGiYoG8t3E=; b=F6JZjV/uRgVHdxHXfhU6h1GPvoM3DsfkZ++BF6Kpe9JLHUqP5mHM0i7p347eAXTqzm DgtqfPc5rGYRf7cvnw7uQ/TfMlKAoraQXXx/KhpVVFbJxgZ3G0fhmXbh5TVaC7ypS5qt KUPChLmYefdmrIdYe4UsfZ9jwLLkMYCZMsN1UZqDnjr0VfHHmkOwxQlxbTnBqEA9CYZV xLxwbvgAausxwqieuYpa14OdQhTXsn0Gxkxw3Boxm7HCc3hwYyYqFEb2Xm+/bMuQnmpA BF6M3pAvFH/zCriLbORhQjcN+HbCx+FhUDfEFiy4dR0k6Gj4GAKLzNk69oNeRg19tU4G v8TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=As6jiWFuQW+IepOGVt4Ucpepq4h8QgVBLKGiYoG8t3E=; b=Kx46z4miFUGMjlfQwFjI9L9qhcBypQnIhVYdE7/0Yrrk1Q2Wf46drw3KBgKgPtGyiv D+g3eE3oMoFeyULY3Amx+0SJppnZxRKYNny/jahHUZ2K5B2Q/8Fh3Wg23RePO1hFj649 Zqa6rqUdRzd6M9tNTDO8mbuxg4pPErIgwMP3k5mWdfvYnTgRYu7vOI5oqeYKp2vEavLT NPhFEHHi2BVBnoLQpm/nGgCFauXAfYeinplMUD5M7faB/PTc2bkE7K0koWo/aKgi7Ecr KBvUB/dAr1mraJHv6gg0U0kcyz8LsAFJRewHUtjj9bAwe8XgH3SPfmUZTH3sNOIitWqa ZlSA== X-Gm-Message-State: AJaThX6qPas5+/1zFOla4SyFpe0QijviSUddYLyrHur6H+bLeAQXDu77 tsVUXHCJBoUu0Nn/nK/E9nCxZw== X-Google-Smtp-Source: AGs4zMYMU6yjW8+rv4fONdN0XQby4eH34Ovaq4AF/4GHQQwyeGEpTqCBZF0L+biMSJz+fi9JA0SvEg== X-Received: by 10.223.198.3 with SMTP id n3mr14270946wrg.73.1511505023947; Thu, 23 Nov 2017 22:30:23 -0800 (PST) Received: from fabrice-VirtualBox.home (ARennes-656-1-253-9.w86-214.abo.wanadoo.fr. [86.214.213.9]) by smtp.gmail.com with ESMTPSA id u46sm15923796wrc.26.2017.11.23.22.30.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Nov 2017 22:30:23 -0800 (PST) From: Fabrice Fontaine To: buildroot@buildroot.org Date: Fri, 24 Nov 2017 07:30:14 +0100 Message-Id: <20171124063014.21029-1-fontaine.fabrice@gmail.com> X-Mailer: git-send-email 2.14.1 Subject: [Buildroot] [PATCH/next 1/1] motion: fix build on musl X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fabrice Fontaine MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 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 Signed-off-by: Fabrice Fontaine --- .../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 diff --git a/package/motion/0001-Fix-pthread_setname_np-detection.patch b/package/motion/0001-Fix-pthread_setname_np-detection.patch new file mode 100644 index 000000000..dc14232c2 --- /dev/null +++ b/package/motion/0001-Fix-pthread_setname_np-detection.patch @@ -0,0 +1,50 @@ +From 505be2201377fa347a34b6cb4164c856b55e7484 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +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 +--- + 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_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 + diff --git a/package/motion/0002-Check-for-pthread_getname_np.patch b/package/motion/0002-Check-for-pthread_getname_np.patch new file mode 100644 index 000000000..c6b5d6aa7 --- /dev/null +++ b/package/motion/0002-Check-for-pthread_getname_np.patch @@ -0,0 +1,66 @@ +From 4067b793689f740e86b2f070c63cc72860347ab5 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +Date: Thu, 23 Nov 2017 22:53:03 +0100 +Subject: [PATCH] Check for pthread_getname_np + +On some toolchains (like musl), pthread_setname_np is available but not +pthread_getname_np so add this check in configure.ac + +Signed-off-by: Fabrice Fontaine +--- + configure.ac | 11 +++++++++++ + logger.c | 2 +- + motion.c | 2 +- + 3 files changed, 13 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 21efd2a..06b2990 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -140,6 +140,17 @@ if test x$THREADS = xyes; then + [AC_DEFINE([HAVE_PTHREAD_SETNAME_NP], [1], [Define if you have pthread_setname_np function.]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])] ) ++ ++############################################################################## ++### Check for pthread_getname_np (nonstandard GNU extension) ++############################################################################## ++ AC_MSG_CHECKING([for pthread_getname_np]) ++ AC_LINK_IFELSE( ++ [AC_LANG_PROGRAM([#include ], [pthread_getname_np(pthread_self(), NULL, 0)])], ++ [AC_DEFINE([HAVE_PTHREAD_GETNAME_NP], [1], [Define if you have pthread_getname_np function.]) ++ AC_MSG_RESULT([yes])], ++ [AC_MSG_RESULT([no])] ) ++ + LIBS="$HOLD_LIBS" + fi + +diff --git a/logger.c b/logger.c +index 01ea5a5..fd80d77 100644 +--- a/logger.c ++++ b/logger.c +@@ -207,7 +207,7 @@ void motion_log(int level, unsigned int type, int errno_flag, const char *fmt, . + errno_save = errno; + + char threadname[32] = "unknown"; +-#if ((!defined(BSD) && HAVE_PTHREAD_SETNAME_NP) || defined(__APPLE__)) ++#if ((!defined(BSD) && HAVE_PTHREAD_GETNAME_NP) || defined(__APPLE__)) + pthread_getname_np(pthread_self(), threadname, sizeof(threadname)); + #endif + +diff --git a/motion.c b/motion.c +index 8570896..985d4b2 100644 +--- a/motion.c ++++ b/motion.c +@@ -3772,7 +3772,7 @@ void util_threadname_set(const char *abbr, int threadnbr, const char *threadname + + void util_threadname_get(char *threadname){ + +-#if ((!defined(BSD) && HAVE_PTHREAD_SETNAME_NP) || defined(__APPLE__)) ++#if ((!defined(BSD) && HAVE_PTHREAD_GETNAME_NP) || defined(__APPLE__)) + char currname[16]; + pthread_getname_np(pthread_self(), currname, sizeof(currname)); + snprintf(threadname, sizeof(currname), "%s",currname); +-- +2.14.1 +