Skip to contentSkip to conversation

libdbus-c++: missing DEPENDS, fix musl build, oe-stylize.py

PATCH New André Draszik 1 participant 2 messages Nov 25, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 libdbus-c++: missing DEPENDS, fix musl build, oe-stylize.py

From: André Draszik <[email protected]>

- libdbus-c++ also depends on expat
- use PACKAGE_BEFORE_PN to simplify FILES
- run through oe-stylize.py
- compiling against the musl C library showed various problems, which have been fixed with the patches attached

---
 ...op.cpp-use-portable-method-for-initializi.patch | 36 ++++++++++
 ...ate_proxy.cpp-avoid-possibly-undefined-ui.patch | 58 ++++++++++++++++
 ...efined-ssize_t-for-clang-3.8.0-on-FreeBSD.patch | 30 +++++++++
 ...04-use-POSIX-poll.h-instead-of-sys-poll.h.patch | 77 ++++++++++++++++++++++
 meta-oe/recipes-core/dbus/libdbus-c++_0.9.0.bb     | 21 +++---
 5 files changed, 214 insertions(+), 8 deletions(-)
 create mode 100644 meta-oe/recipes-core/dbus/libdbus-c++-0.9.0/0001-src-eventloop.cpp-use-portable-method-for-initializi.patch
 create mode 100644 meta-oe/recipes-core/dbus/libdbus-c++-0.9.0/0002-tools-generate_proxy.cpp-avoid-possibly-undefined-ui.patch
 create mode 100644 meta-oe/recipes-core/dbus/libdbus-c++-0.9.0/0003-Fixed-undefined-ssize_t-for-clang-3.8.0-on-FreeBSD.patch
 create mode 100644 meta-oe/recipes-core/dbus/libdbus-c++-0.9.0/0004-use-POSIX-poll.h-instead-of-sys-poll.h.patch
meta-oe/recipes-core/dbus/libdbus-c++-0.9.0/0001-src-eventloop.cpp-use-portable-method-for-initializi.patch new file +36 -0
new file mode 100644
index 0000000..eed84e4
@@ -0,0 +1,36 @@
+From 93fd4868d71aa7a26cdfd382d1e4c85112f069f9 Mon Sep 17 00:00:00 2001
+From: Peter Williams <[email protected]>
+Date: Sat, 19 Dec 2015 21:07:37 -0500
+Subject: [PATCH] src/eventloop.cpp: use portable method for initializing
+ recursive mutex
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+---
+Upstream-Status: Backport [https://github.com/andreas-volz/dbus-cplusplus/commit/cdaeaa825db191bd65aad3aaaeb3178738727f05]
+Signed-off-by: André Draszik <[email protected]>
+ src/eventloop.cpp | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/src/eventloop.cpp b/src/eventloop.cpp
+index 7fb06a3..f622812 100644
+--- a/src/eventloop.cpp
++++ b/src/eventloop.cpp
+@@ -85,8 +85,11 @@ DefaultMutex::DefaultMutex(bool recursive)
+ {
+   if (recursive)
+   {
+-    pthread_mutex_t recmutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+-    _mutex = recmutex;
++    pthread_mutexattr_t attr;
++
++    pthread_mutexattr_init(&attr);
++    pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
++    pthread_mutex_init(&_mutex, &attr);
+   }
+   else
+   {
+-- 
+2.10.2
+
meta-oe/recipes-core/dbus/libdbus-c++-0.9.0/0002-tools-generate_proxy.cpp-avoid-possibly-undefined-ui.patch new file +58 -0

58 lines not on this page · raw message

meta-oe/recipes-core/dbus/libdbus-c++-0.9.0/0003-Fixed-undefined-ssize_t-for-clang-3.8.0-on-FreeBSD.patch new file +30 -0
new file mode 100644
index 0000000..f69cefd
@@ -0,0 +1,30 @@
+From 465d98dbcdcb72375c198010a50b80b953e7d5a6 Mon Sep 17 00:00:00 2001
+From: Yuri <[email protected]>
+Date: Sat, 28 May 2016 13:20:10 -0700
+Subject: [PATCH] Fixed undefined ssize_t for clang-3.8.0 on FreeBSD.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+---
+Upstream-Status: Backport [https://github.com/andreas-volz/dbus-cplusplus/commit/463f5a4400d494b831c3b3348c0a21f0faf14f39]
+Signed-off-by: André Draszik <[email protected]>
+ include/dbus-c++/pipe.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/include/dbus-c++/pipe.h b/include/dbus-c++/pipe.h
+index 999f042..682646c 100644
+--- a/include/dbus-c++/pipe.h
++++ b/include/dbus-c++/pipe.h
+@@ -30,6 +30,8 @@
+ /* STD */
+ #include <cstdlib>
+ 
++#include <sys/types.h>
++
+ namespace DBus
+ {
+ 
+-- 
+2.10.2
+
meta-oe/recipes-core/dbus/libdbus-c++-0.9.0/0004-use-POSIX-poll.h-instead-of-sys-poll.h.patch new file +77 -0

77 lines not on this page · raw message

meta-oe/recipes-core/dbus/libdbus-c++_0.9.0.bb +13 -8
index 7edaffc..9b053fe 100644
@@ -4,21 +4,26 @@ HOMEPAGE = "http://dbus-cplusplus.sourceforge.net"
 SECTION = "base"
 LICENSE = "LGPLv2.1"
 LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24"
-DEPENDS = "dbus glib-2.0 libpcre"
+DEPENDS = "dbus expat glib-2.0 libpcre"
 
-SRC_URI = "${SOURCEFORGE_MIRROR}/project/dbus-cplusplus/dbus-c++/${PV}/${BPN}-${PV}.tar.gz \
-		   file://fix-missing-unistd.h-include.patch \
-		   file://remove-CXX_FOR_BUILD-stuff.patch"
+SRC_URI = "\
+    ${SOURCEFORGE_MIRROR}/project/dbus-cplusplus/dbus-c++/${PV}/${BP}.tar.gz \
+    file://fix-missing-unistd.h-include.patch \
+    file://remove-CXX_FOR_BUILD-stuff.patch \
+    file://0001-src-eventloop.cpp-use-portable-method-for-initializi.patch \
+    file://0002-tools-generate_proxy.cpp-avoid-possibly-undefined-ui.patch \
+    file://0003-Fixed-undefined-ssize_t-for-clang-3.8.0-on-FreeBSD.patch \
+    file://0004-use-POSIX-poll.h-instead-of-sys-poll.h.patch \
+"
 SRC_URI[md5sum] = "e752116f523fa88ef041e63d3dee4de2"
 SRC_URI[sha256sum] = "bc11ac297b3cb010be904c72789695543ee3fdf3d75cdc8225fd371385af4e61"
 
-EXTRA_OECONF = "--disable-ecore --disable-examples --disable-tests"
-
 inherit autotools pkgconfig
 
-PACKAGES += "${PN}-tools"
+EXTRA_OECONF = "--disable-ecore --disable-examples --disable-tests"
+
+PACKAGE_BEFORE_PN = "${PN}-tools"
 
-FILES_${PN} = "${libdir}"
 FILES_${PN}-tools = "${bindir}"
 
 BBCLASSEXTEND = "native"
Signature · 1 line
2.10.2
#1 lore raw

PATCH 2/2 meta_oe_security_flags: disable PIE for libdbus-c++

From: André Draszik <[email protected]>

The short version - it ain't working.

The long version:

For shared libraries made from C++ sources, configure runs some code to determine how to link shared libraries (from libtool.m4) using g++. In particular, it calls g++ ${CFLAGS} -c conftest.c
g++ ${CFLAGS} -nostdinc -shared -v conftest.o to then parse the gcc -v output.

If CFLAGS contains -pie -fpie, g++ adds Scrt1.o to the objects being linked together to form the final output.

Once Scrt1.o is pulled into a shared library, it becomes impossible to link this DSO against a final binary. I didn't investigate why, by I suspect because of -Wl,relro -Wl,now

libtool takes note of Scrt1.o (and all other libraries added by gcc, but those don't matter here) and adds it everywhere a shared library is being created, see predep_objects= and postdep_objects= in the 'LIBTOOL TAG CONFIG: CXX' section.

In other words, the the shared library created during the build can't be linked against. This includes some applications that are part of the libdbus-c++ source tree, but also any other external user.

While I am not sure if the root of the issue is in
- gcc (should it really add Scrt1.o despite -shared), or in
- libtool (should it filter out -pie -fpie during the configure step), or even in
- OE (should it really be adding -pie -fpie to everything, even shared libraries by default and unconditionally),
we can make things work by using SECURITY_NO_PIE_CFLAGS instead.

---
 meta-oe/conf/distro/include/meta_oe_security_flags.inc | 1 +
 1 file changed, 1 insertion(+)
meta-oe/conf/distro/include/meta_oe_security_flags.inc +1 -0
index 2559948..f027008 100644
@@ -1,4 +1,5 @@
 # Build errors with the pie options enabled
+SECURITY_CFLAGS_pn-libdbus-c++ = "${SECURITY_NO_PIE_CFLAGS}"
 SECURITY_CFLAGS_pn-lvm2 = "${SECURITY_NO_PIE_CFLAGS}"
 SECURITY_CFLAGS_pn-rrdtool = "${SECURITY_NO_PIE_CFLAGS}"
 
Signature · 1 line
2.10.2