diff mbox series

[oe,meta-networking] dibbler: Fix build with clang/libc++

Message ID 20190201145637.42277-1-raj.khem@gmail.com
State Accepted
Commit 5ca9c88503770ed9d2aeea7a77ad8e28d7941787
Headers show
Series [oe,meta-networking] dibbler: Fix build with clang/libc++ | expand

Commit Message

Khem Raj Feb. 1, 2019, 2:56 p.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 ...Rename-pthread_mutex_t-variable-lock.patch | 74 +++++++++++++++++++
 .../dibbler/dibbler_git.bb                    |  3 +-
 2 files changed, 76 insertions(+), 1 deletion(-)
 create mode 100644 meta-networking/recipes-connectivity/dibbler/dibbler/0001-linux-port-Rename-pthread_mutex_t-variable-lock.patch

-- 
2.20.1

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
diff mbox series

Patch

diff --git a/meta-networking/recipes-connectivity/dibbler/dibbler/0001-linux-port-Rename-pthread_mutex_t-variable-lock.patch b/meta-networking/recipes-connectivity/dibbler/dibbler/0001-linux-port-Rename-pthread_mutex_t-variable-lock.patch
new file mode 100644
index 0000000000..346a56a9ad
--- /dev/null
+++ b/meta-networking/recipes-connectivity/dibbler/dibbler/0001-linux-port-Rename-pthread_mutex_t-variable-lock.patch
@@ -0,0 +1,74 @@ 
+From 630086cf1b3fba71822319a268d3711734cd6aa8 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 31 Jan 2019 12:56:13 -0800
+Subject: [PATCH] linux-port: Rename pthread_mutex_t variable 'lock'
+
+lock is also used by libc++ in std namespace and using it here causes
+clang to fail e.g.
+
+dibbler-client.cpp:47:25: error: reference to 'lock' is ambiguous
+    pthread_mutex_lock(&lock);
+                        ^
+../../../../../../../workspace/sources/dibbler/Port-linux/dibbler-client.cpp:29:26: note: candidate found by name lookup is 'lock'
+extern ::pthread_mutex_t lock;
+                         ^
+/mnt/a/yoe/build/tmp/work/aarch64-yoe-linux/dibbler/1.0.1+1.0.2RC1+gitc4b0ed52e751da7823dd9a36e91f93a6310e5525-r0/recipe-sysroot/usr/include/c++/v1/mutex:446:1: note: candidate found by name lookup is 'std::__1::lock'
+lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
+
+Upstream-Status: Submitted [https://github.com/tomaszmrugalski/dibbler/pull/37]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Port-linux/dibbler-client.cpp          | 6 +++---
+ Port-linux/lowlevel-linux-link-state.c | 6 +++---
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/Port-linux/dibbler-client.cpp b/Port-linux/dibbler-client.cpp
+index 78f34241..b5ebb9f0 100644
+--- a/Port-linux/dibbler-client.cpp
++++ b/Port-linux/dibbler-client.cpp
+@@ -26,7 +26,7 @@ using namespace std;
+ 
+ #define IF_RECONNECTED_DETECTED -1
+ 
+-extern pthread_mutex_t lock;
++extern pthread_mutex_t dibbler_lock;
+ 
+ TDHCPClient* ptr = 0;
+ 
+@@ -44,8 +44,8 @@ void signal_handler(int n) {
+ #ifdef MOD_CLNT_CONFIRM
+ void signal_handler_of_linkstate_change(int n) {
+     Log(Notice) << "Network switch off event detected. initiating CONFIRM." << LogEnd;
+-    pthread_mutex_lock(&lock);
+-    pthread_mutex_unlock(&lock);
++    pthread_mutex_lock(&dibbler_lock);
++    pthread_mutex_unlock(&dibbler_lock);
+ }
+ #endif
+ 
+diff --git a/Port-linux/lowlevel-linux-link-state.c b/Port-linux/lowlevel-linux-link-state.c
+index 76293ea1..e6b94063 100644
+--- a/Port-linux/lowlevel-linux-link-state.c
++++ b/Port-linux/lowlevel-linux-link-state.c
+@@ -34,7 +34,7 @@ volatile int * notifier = 0;
+ int isDone = 0;
+ pthread_t parent_id;
+ pthread_t ntid;
+-pthread_mutex_t lock;
++pthread_mutex_t dibbler_lock;
+ 
+ struct state {
+     int id;
+@@ -86,9 +86,9 @@ void link_state_changed(int ifindex)
+     {
+ 	if (changed_links->cnt<16)
+ 	    changed_links->ifindex[changed_links->cnt++] = ifindex;
+-	pthread_mutex_lock(&lock);
++	pthread_mutex_lock(&dibbler_lock);
+ 	*notifier = 1; /* notify that change has occured */
+-	pthread_mutex_unlock(&lock);
++	pthread_mutex_unlock(&dibbler_lock);
+ 	pthread_kill(parent_id,SIGUSR1);
+     } else
+     {
diff --git a/meta-networking/recipes-connectivity/dibbler/dibbler_git.bb b/meta-networking/recipes-connectivity/dibbler/dibbler_git.bb
index 8890e14318..90051a319a 100644
--- a/meta-networking/recipes-connectivity/dibbler/dibbler_git.bb
+++ b/meta-networking/recipes-connectivity/dibbler/dibbler_git.bb
@@ -9,7 +9,8 @@  SRCREV = "c4b0ed52e751da7823dd9a36e91f93a6310e5525"
 
 SRC_URI = "git://github.com/tomaszmrugalski/dibbler \
            file://dibbler_fix_getSize_crash.patch \
-          "
+           file://0001-linux-port-Rename-pthread_mutex_t-variable-lock.patch \
+           "
 PV = "1.0.1+1.0.2RC1+git${SRCREV}"
 
 S = "${WORKDIR}/git"