Signed-off-by: Khem Raj <[email protected]>
---
 ...de-ldap_pvt_thread.h-before-redefini.patch | 54 +++++++++++++++++++
 .../openldap/openldap_2.5.9.bb                |  1 +
 2 files changed, 55 insertions(+)
 create mode 100644 
meta-oe/recipes-support/openldap/openldap/0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch

diff --git 
a/meta-oe/recipes-support/openldap/openldap/0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch
 
b/meta-oe/recipes-support/openldap/openldap/0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch
new file mode 100644
index 0000000000..bcd1525b67
--- /dev/null
+++ 
b/meta-oe/recipes-support/openldap/openldap/0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch
@@ -0,0 +1,54 @@
+From 79381ab335898c9184e22dd25b544adefa9bf6c5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Mon, 7 Feb 2022 16:26:57 -0800
+Subject: [PATCH] librewrite: include ldap_pvt_thread.h before redefining
+ calloc
+
+This helps compiling with musl, where sched.h is included by
+ldap_pvt_thread.h which provides prototype for calloc() and conflicts
+
+/usr/include/sched.h:84:7: error: conflicting types for 'ber_memcalloc'
+| void *calloc(size_t, size_t);
+|       ^1
+|  warning and 1 error generated.
+| ./rewrite-int.h:44:21: note: expanded from macro 'calloc'
+| #define calloc(x,y)     ber_memcalloc(x,y)
+|                         ^
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ libraries/librewrite/rewrite-int.h | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/libraries/librewrite/rewrite-int.h 
b/libraries/librewrite/rewrite-int.h
+index 4481dd3..5ec226d 100644
+--- a/libraries/librewrite/rewrite-int.h
++++ b/libraries/librewrite/rewrite-int.h
+@@ -40,6 +40,11 @@
+ 
+ #include <rewrite.h>
+ 
++#ifndef NO_THREADS
++#define USE_REWRITE_LDAP_PVT_THREADS
++#include <ldap_pvt_thread.h>
++#endif
++
+ #define malloc(x)     ber_memalloc(x)
+ #define calloc(x,y)   ber_memcalloc(x,y)
+ #define realloc(x,y)  ber_memrealloc(x,y)
+@@ -47,11 +52,6 @@
+ #undef strdup
+ #define       strdup(x)       ber_strdup(x)
+ 
+-#ifndef NO_THREADS
+-#define USE_REWRITE_LDAP_PVT_THREADS
+-#include <ldap_pvt_thread.h>
+-#endif
+-
+ /*
+  * For details, see RATIONALE.
+  */
+-- 
+2.35.1
+
diff --git a/meta-oe/recipes-support/openldap/openldap_2.5.9.bb 
b/meta-oe/recipes-support/openldap/openldap_2.5.9.bb
index f3b8c6c987..b80bde8490 100644
--- a/meta-oe/recipes-support/openldap/openldap_2.5.9.bb
+++ b/meta-oe/recipes-support/openldap/openldap_2.5.9.bb
@@ -23,6 +23,7 @@ SRC_URI = 
"http://www.openldap.org/software/download/OpenLDAP/openldap-release/$
     file://0001-ldif-filter-fix-parallel-build-failure.patch \
     file://0001-build-top.mk-unset-STRIP_OPTS.patch \
     file://0001-libraries-Makefile.in-ignore-the-mkdir-errors.patch \
+    file://0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch \
 "
 
 SRC_URI[md5sum] = "237fc2d881c27f8dd5d9f396e2865c11"
-- 
2.35.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#95258): 
https://lists.openembedded.org/g/openembedded-devel/message/95258
Mute This Topic: https://lists.openembedded.org/mt/88986670/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to