Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: "LWS_WITH_EXTERNAL_POLL" redefined [-Werror] #2790

Open
stijn1989 opened this issue Dec 8, 2022 · 6 comments
Open

error: "LWS_WITH_EXTERNAL_POLL" redefined [-Werror] #2790

stijn1989 opened this issue Dec 8, 2022 · 6 comments

Comments

@stijn1989
Copy link

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
@ljluestc
Copy link

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

@stijn1989
Copy link
Author

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).

@lws-team
Copy link
Member

Can you paste the compiler error?

@gcsideal
Copy link
Contributor

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

@lws-team
Copy link
Member

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.

@tom2bob
Copy link

tom2bob commented May 8, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants