package/qpid-proton: fix build without threads
authorFabrice Fontaine <fontaine.fabrice@gmail.com>
Fri, 2 Apr 2021 16:33:41 +0000 (18:33 +0200)
committerYann E. MORIN <yann.morin.1998@free.fr>
Fri, 2 Apr 2021 21:50:16 +0000 (23:50 +0200)
Build of qpid-proton is broken since bump to version 0.33.0 in commit
d4c0fde91da0d79204a21ed8de1bd410efa1c4d6 because epoll proactor
unconditonally uses pthread

Fixes:
 - http://autobuild.buildroot.org/results/ec34da16a11f0600ecfbbbc4039e8210aea0498c

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[yann.morin.1998@free.fr: C++ precision in comment]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
package/qpid-proton/0002-PROTON-2355-Fix-build-with-DPROACTOR-none.patch [new file with mode: 0644]
package/qpid-proton/qpid-proton.mk

diff --git a/package/qpid-proton/0002-PROTON-2355-Fix-build-with-DPROACTOR-none.patch b/package/qpid-proton/0002-PROTON-2355-Fix-build-with-DPROACTOR-none.patch
new file mode 100644 (file)
index 0000000..c99a65f
--- /dev/null
@@ -0,0 +1,61 @@
+From 2e3b81296020340692139f1a0d05c3bc7383b40e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jiri=20Dan=C4=9Bk?= <jdanek@redhat.com>
+Date: Thu, 1 Apr 2021 19:24:33 +0200
+Subject: [PATCH] PROTON-2355: Fix build with -DPROACTOR=none (#302)
+
+epoll proactor unconditionally uses pthread.h which will result in the
+following build failure:
+
+[  3%] Building C object c/CMakeFiles/qpid-proton-proactor-objects.dir/src/proactor/epoll.c.o
+In file included from /nvme/rc-buildroot-test/scripts/instance-0/output-1/build/qpid-proton-0.33.0/c/src/proactor/epoll.c:60:
+/nvme/rc-buildroot-test/scripts/instance-0/output-1/build/qpid-proton-0.33.0/c/src/proactor/epoll-internal.h:37:10: fatal error: pthread.h: No such file or directory
+   37 | #include <pthread.h>
+      |          ^~~~~~~~~~~
+
+To fix this failure, the user could use -DPROACTOR=none but it also
+fails on:
+
+CMake Error at c/CMakeLists.txt:481 (add_library):
+  Error evaluating generator expression:
+
+    $<TARGET_OBJECTS:qpid-proton-proactor-objects>
+
+  Objects of target "qpid-proton-proactor-objects" referenced but no such
+  target exists.
+
+Co-authored-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+[Retrieved from:
+https://github.com/apache/qpid-proton/commit/2e3b81296020340692139f1a0d05c3bc7383b40e]
+---
+ c/CMakeLists.txt | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt
+index 2146a5c96..e1119d11d 100644
+--- a/c/CMakeLists.txt
++++ b/c/CMakeLists.txt
+@@ -464,7 +464,11 @@ set(qpid-proton-noncore-src
+   ${qpid-proton-include-extra}
+ )
+-add_library (qpid-proton SHARED $<TARGET_OBJECTS:qpid-proton-core-objects> $<TARGET_OBJECTS:qpid-proton-platform-io-objects> $<TARGET_OBJECTS:qpid-proton-proactor-objects> ${qpid-proton-noncore-src})
++add_library (qpid-proton SHARED
++  $<TARGET_OBJECTS:qpid-proton-core-objects>
++  $<TARGET_OBJECTS:qpid-proton-platform-io-objects>
++  $<$<TARGET_EXISTS:qpid-proton-proactor-objects>:$<TARGET_OBJECTS:qpid-proton-proactor-objects>>
++  ${qpid-proton-noncore-src})
+ target_link_libraries (qpid-proton LINK_PRIVATE ${SSL_LIB} ${SASL_LIB} ${TIME_LIB} ${PLATFORM_LIBS} ${PROACTOR_LIBS})
+ set_target_properties (qpid-proton
+   PROPERTIES
+@@ -480,7 +484,10 @@ if (BUILD_STATIC_LIBS)
+     C_EXTENSIONS ON)
+   add_library(qpid-proton-static STATIC $<TARGET_OBJECTS:qpid-proton-platform-io-static> ${qpid-proton-noncore-src})
+   target_compile_definitions(qpid-proton-static PUBLIC PROTON_DECLARE_STATIC)
+-  target_link_libraries (qpid-proton-static qpid-proton-core-static qpid-proton-proactor-static ${SSL_LIB} ${SASL_LIB} ${TIME_LIB} ${PLATFORM_LIBS} ${PROACTOR_LIBS})
++  target_link_libraries (qpid-proton-static
++    qpid-proton-core-static
++    $<$<TARGET_EXISTS:qpid-proton-proactor-static>:qpid-proton-proactor-static>
++    ${SSL_LIB} ${SASL_LIB} ${TIME_LIB} ${PLATFORM_LIBS} ${PROACTOR_LIBS})
+ endif(BUILD_STATIC_LIBS)
+ # Install executables and libraries
index b73ab8d6dac89be937a722c9bc1d698aa33f7a28..c1bcbd0d1ad6e796ac46543e575049134f093b58 100644 (file)
@@ -31,6 +31,14 @@ QPID_PROTON_CONF_OPTS = \
        -DENABLE_WARNING_ERROR=OFF \
        -DPYTHON_EXECUTABLE=$(HOST_DIR)/bin/python2
 
+# epoll proactor unconditionally uses pthread and cpp (C++) bindings
+# unconditionally use proactor
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),)
+QPID_PROTON_CONF_OPTS += \
+       -DBUILD_CPP=OFF \
+       -DPROACTOR=none
+endif
+
 ifeq ($(BR2_PACKAGE_JSONCPP),y)
 QPID_PROTON_DEPENDENCIES += jsoncpp
 QPID_PROTON_CONF_OPTS += -DENABLE_JSONCPP=ON