libwebsockets icon indicating copy to clipboard operation
libwebsockets copied to clipboard

error: "LWS_WITH_EXTERNAL_POLL" redefined [-Werror]

Open stijn1989 opened this issue 3 years ago • 6 comments

When making with the flag -DLWS_WITH_EXTERNAL_POLL=ON, you get the error at 98% when running the make command.

error: "LWS_WITH_EXTERNAL_POLL" redefined [-Werror]

To solve this, you have to edit the lws_config.h file in the build directory and edit line 169:

#define LWS_WITH_EXTERNAL_POLL

to

#ifndef LWS_WITH_EXTERNAL_POLL
#define LWS_WITH_EXTERNAL_POLL
#endif

This is my commandline:

git clone https://github.com/warmcat/libwebsockets.git
cd libwebsockets
mkdir build && cd build
apt-get install cmake
cmake .. -DCMAKE_C_COMPILER=/usr/bin/gcc -DLWS_WITH_EXTERNAL_POLL=ON
make
make install

stijn1989 avatar Dec 08 '22 18:12 stijn1989

Could you please give more details - Unable to reproduce on ubuntu 20.04

ljluestc avatar Jun 19 '23 21:06 ljluestc

This is produced on a Raspberry PI 4 (2GB RAM) with the image Raspios lite arm64. I ran the commands under root user. I need this library for Mosquitto WS (MQTT).

stijn1989 avatar Jun 19 '23 22:06 stijn1989

Can you paste the compiler error?

lws-team avatar Jun 20 '23 06:06 lws-team

Can you paste the compiler error?

Happened on Debian as well with 4.3.3 release, LWS_WITH_EXTERNAL_POLL=ON setting. Complete output: make[2]: Entering directory 'websockets/4.3/libwebsockets-4.3.3/obj-x86_64-linux-gnu' [ 98%] Building C object test-apps/CMakeFiles/test-server-extpoll.dir/test-server.c.o cd websockets/4.3/libwebsockets-4.3.3/obj-x86_64-linux-gnu/test-apps && /usr/bin/cc -DINSTALL_DATADIR="/usr/share" -DLWS_WITH_EXTERNAL_POLL -Iwebsockets/4.3/libwebsockets-4.3.3/include -Iwebsockets/4.3/libwebsockets-4.3.3/obj-x86_64-linux-gnu -Iwebsockets/4.3/libwebsockets-4.3.3/lib -Iwebsockets/4.3/libwebsockets-4.3.3/lib/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/plat/unix/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/tls/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/core/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/misc/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/system/./async-dns -Iwebsockets/4.3/libwebsockets-4.3.3/lib/system/smd/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/system/metrics/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/core-net/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/roles/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/roles/http/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/roles/http/./compression -Iwebsockets/4.3/libwebsockets-4.3.3/lib/roles/h1/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/roles/h2/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/roles/ws/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/roles/raw-skt/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/roles/raw-file/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/roles/listen/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/event-libs/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/event-libs/poll/../poll -Iwebsockets/4.3/libwebsockets-4.3.3/lib/event-libs/libuv/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/event-libs/glib/. -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Iwebsockets/4.3/libwebsockets-4.3.3/lib/event-libs/libev/. -Iwebsockets/4.3/libwebsockets-4.3.3/lib/../include -Iwebsockets/4.3/libwebsockets-4.3.3/obj-x86_64-linux-gnu/lib/../include -Wno-deprecated-declarations -Wno-deprecated -Wall -Wextra -Wno-unused-parameter -Wconversion -Wsign-compare -Wstrict-aliasing -fvisibility=hidden -Wundef -Wuninitialized -Wtype-limits -Wignored-qualifiers -g -O2 -ffile-prefix-map=websockets/4.3/libwebsockets-4.3.3=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wdate-time -D_FORTIFY_SOURCE=2 -Werror -pthread -MD -MT test-apps/CMakeFiles/test-server-extpoll.dir/test-server.c.o -MF CMakeFiles/test-server-extpoll.dir/test-server.c.o.d -o CMakeFiles/test-server-extpoll.dir/test-server.c.o -c websockets/4.3/libwebsockets-4.3.3/test-apps/test-server.c In file included from websockets/4.3/libwebsockets-4.3.3/include/libwebsockets.h:42, from websockets/4.3/libwebsockets-4.3.3/test-apps/test-server.c:21: websockets/4.3/libwebsockets-4.3.3/obj-x86_64-linux-gnu/lws_config.h:158: error: "LWS_WITH_EXTERNAL_POLL" redefined [-Werror] 158 | #define LWS_WITH_EXTERNAL_POLL | : note: this is the location of the previous definition cc1: all warnings being treated as errors make[2]: *** [test-apps/CMakeFiles/test-server-extpoll.dir/build.make:79: test-apps/CMakeFiles/test-server-extpoll.dir/test-server.c.o] Error 1

gcsideal avatar Dec 10 '23 09:12 gcsideal

It seems to be complaining that the gcc commandline has -DLWS_WITH_EXTERNAL_POLL and lws_config.h is also setting it... to the same thing, it's not normally going to complain.

You should be able to avoid it by -DLWS_WITHOUT_TESTAPPS=1 at cmake.

lws-team avatar Dec 10 '23 09:12 lws-team

I have also encountered such a problem, and according to this solution, the problem has been resolved

tom2bob avatar May 08 '24 08:05 tom2bob