Skip to contentSkip to conversation

package/libwebsockets: fix build with libev and libevent

PATCH New Fabrice Fontaine 2 participants 4 messages Oct 6, 2019 – Oct 7, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/libwebsockets: fix build with libev and libevent

libev and libevent can't be enabled at the same time since version 3.0.0 and
https://github.com/warmcat/libwebsockets/commit/ff2f5f601d5965f5860bc989d05b61246f172095

So prefer libev over libevent to have the same default behavior than upstream LWS_WITH_DISTRO_RECOMMENDED target

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

---
 package/libwebsockets/libwebsockets.mk | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
package/libwebsockets/libwebsockets.mk +10 -8
index 0b488d1f05..7a065dfb22 100644
@@ -30,16 +30,18 @@ endif
 
 ifeq ($(BR2_PACKAGE_LIBEV),y)
 LIBWEBSOCKETS_DEPENDENCIES += libev
-LIBWEBSOCKETS_CONF_OPTS += -DLWS_WITH_LIBEV=ON
-else
-LIBWEBSOCKETS_CONF_OPTS += -DLWS_WITH_LIBEV=OFF
-endif
-
-ifeq ($(BR2_PACKAGE_LIBEVENT),y)
+LIBWEBSOCKETS_CONF_OPTS += \
+	-DLWS_WITH_LIBEV=ON \
+	-DLWS_WITH_LIBEVENT=OFF
+else ifeq ($(BR2_PACKAGE_LIBEVENT),y)
 LIBWEBSOCKETS_DEPENDENCIES += libevent
-LIBWEBSOCKETS_CONF_OPTS += -DLWS_WITH_LIBEVENT=ON
+LIBWEBSOCKETS_CONF_OPTS += \
+	-DLWS_WITH_LIBEV=OFF \
+	-DLWS_WITH_LIBEVENT=ON
 else
-LIBWEBSOCKETS_CONF_OPTS += -DLWS_WITH_LIBEVENT=OFF
+LIBWEBSOCKETS_CONF_OPTS += \
+	-DLWS_WITH_LIBEV=OFF \
+	-DLWS_WITH_LIBEVENT=OFF
 endif
 
 ifeq ($(BR2_PACKAGE_LIBUV),y)
Signature · 1 line
2.23.0
#1 lore raw

PATCH 2/2 package/libwebsockets: fix build with libev

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

---
 ...ix-build-with-libev-and-without-test.patch | 52 +++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 package/libwebsockets/0001-CMakeLists.txt-fix-build-with-libev-and-without-test.patch
package/libwebsockets/0001-CMakeLists.txt-fix-build-with-libev-and-without-test.patch new file +52 -0
new file mode 100644
index 0000000000..ff85571fc9
@@ -0,0 +1,52 @@
+From 72c761789550703f004962ae164c415928e5e35c Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Sun, 6 Oct 2019 14:45:15 +0200
+Subject: [PATCH] CMakeLists.txt: fix build with libev and without testapps
+
+Move libev workaround outside the
+if ((LWS_ROLE_H1 OR LWS_ROLE_H2) AND NOT LWS_WITHOUT_TESTAPPS) block
+otherwise build fails on:
+
+/home/naourr/work/instance-1/output-1/build/libwebsockets-3.2.0/lib/event-libs/libev/libev.c: In function 'lws_ev_hrtimer_cb':
+/home/naourr/work/instance-1/output-1/build/libwebsockets-3.2.0/lib/event-libs/libev/libev.c:34:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
+   ev_timer_set(&pt->ev.hrtimer, ((float)us) / 1000000.0, 0);
+   ^~~~~~~~~~~~
+
+Fixes:
+ - http://autobuild.buildroot.org/results/b5a2188dce90f3ca9bf0cc7a043c1a946b8e288f
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+[Upstream status: https://github.com/warmcat/libwebsockets/pull/1707]
+---
+ CMakeLists.txt | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 6c26feb2..a10178c2 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1435,6 +1435,8 @@ endif()
+ if (LWS_WITH_LIBEV AND LWS_WITH_NETWORK)
+ 	list(APPEND SOURCES
+ 		lib/event-libs/libev/libev.c)
++	# libev generates a big mess of warnings with gcc, maintainer claims gcc to blame
++	set_source_files_properties( lib/event-libs/libev/libev.c PROPERTIES COMPILE_FLAGS "-Wno-error" )
+ endif()
+ 
+ if (LWS_WITH_LEJP)
+@@ -2195,12 +2197,6 @@ if ((LWS_ROLE_H1 OR LWS_ROLE_H2) AND NOT LWS_WITHOUT_TESTAPPS)
+ 		endif()
+ 	endif()
+ 
+-	if (LWS_WITH_LIBEV)
+-		# libev generates a big mess of warnings with gcc, maintainer claims gcc to blame
+-		set_source_files_properties( lib/event-libs/libev/libev.c PROPERTIES COMPILE_FLAGS "-Wno-error" )
+-	endif()
+-
+-
+ 	if (NOT LWS_WITHOUT_SERVER)
+ 		#
+ 		# test-server
+-- 
+2.23.0
+
Signature · 1 line
2.23.0
#2 lore raw

PATCH 2/2 package/libwebsockets: fix build with libev

Quoted 24 lines · On Sun, 6 Oct 2019 14:53:39 +0200 Fabrice Fontaine…

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

---
 ...ix-build-with-libev-and-without-test.patch | 52 +++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 package/libwebsockets/0001-CMakeLists.txt-fix-build-with-libev-and-without-test.patch
package/libwebsockets/0001-CMakeLists.txt-fix-build-with-libev-and-without-test.patch new file +9 -0
new file mode 100644
index 0000000000..ff85571fc9
@@ -0,0 +1,52 @@
+From 72c761789550703f004962ae164c415928e5e35c Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <[email protected]>
+Date: Sun, 6 Oct 2019 14:45:15 +0200
+Subject: [PATCH] CMakeLists.txt: fix build with libev and without testapps
+
+Move libev workaround outside the
+if ((LWS_ROLE_H1 OR LWS_ROLE_H2) AND NOT LWS_WITHOUT_TESTAPPS) block
+otherwise build fails on:
+

package/libwebsockets/0001-CMakeLists.txt-fix-build-with-libev-and-without-test.patch line 19

Quoted 10 lines
package/libwebsockets/0001-CMakeLists.txt-fix-build-with-libev-and-without-test.patch new file +10 -0
+/home/naourr/work/instance-1/output-1/build/libwebsockets-3.2.0/lib/event-libs/libev/libev.c: In function 'lws_ev_hrtimer_cb':
+/home/naourr/work/instance-1/output-1/build/libwebsockets-3.2.0/lib/event-libs/libev/libev.c:34:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
+   ev_timer_set(&pt->ev.hrtimer, ((float)us) / 1000000.0, 0);
+   ^~~~~~~~~~~~
+
+Fixes:
+ - http://autobuild.buildroot.org/results/b5a2188dce90f3ca9bf0cc7a043c1a946b8e288f
+
+Signed-off-by: Fabrice Fontaine <[email protected]>
+[Upstream status: https://github.com/warmcat/libwebsockets/pull/1707]

I changed that to the actual commit that was merged, since it has been merged now. Applied, thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 1/2 package/libwebsockets: fix build with libev and libevent

In reply to Fabrice Fontaine
Quoted 7 lines · On Sun, 6 Oct 2019 14:53:38 +0200 Fabrice Fontaine…

libev and libevent can't be enabled at the same time since version 3.0.0 and
https://github.com/warmcat/libwebsockets/commit/ff2f5f601d5965f5860bc989d05b61246f172095

So prefer libev over libevent to have the same default behavior than upstream LWS_WITH_DISTRO_RECOMMENDED target

Quoted 7 lines

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

---
 package/libwebsockets/libwebsockets.mk | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com