kubernetes-client / c

Official C client library for Kubernetes
Apache License 2.0
141 stars 45 forks source link

libwebsockets make fails with error: conflicting types for ‘lws_tls_server_abort_connection #219

Closed Jeansen closed 2 months ago

Jeansen commented 4 months ago

Followed the main documentation, but when I run make after the cmake command for libwebsockets, I get the following error:

/tmp/k/libwebsockets/lib/tls/openssl/openssl-server.c:683:1: error: conflicting types for ‘lws_tls_server_abort_connection’ due to enum/integer mismatch; have ‘int(struct lws *)’ [-Werror=enum-int-mismatch]
  683 | lws_tls_server_abort_connection(struct lws *wsi)
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/k/libwebsockets/lib/tls/./private-lib-tls.h:138,
                 from /tmp/k/libwebsockets/lib/core/./private-lib-core.h:262,
                 from /tmp/k/libwebsockets/lib/tls/openssl/openssl-server.c:25:
/tmp/k/libwebsockets/lib/tls/./private-network.h:167:1: note: previous declaration of ‘lws_tls_server_abort_connection’ with type ‘enum lws_ssl_capable_status(struct lws *)’
  167 | lws_tls_server_abort_connection(struct lws *wsi);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [lib/CMakeFiles/websockets.dir/build.make:300: lib/CMakeFiles/websockets.dir/tls/openssl/openssl-server.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1260: lib/CMakeFiles/websockets.dir/all] Error 2
make: *** [Makefile:166: all] Error 2
#cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux trixie/sid"
NAME="Debian GNU/Linux"
VERSION_CODENAME=trixie
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
#uname -a
Linux omph-laptop 6.6.15-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.6.15-2 (2024-02-04) x86_64 GNU/Linux
ityuhui commented 4 months ago

The build on Ubuntu 22.04.3 LTS works.

I guess the GCC on your env Debian 6.6.15-2 (2024-02-04) can not compile libwebsockets v4.2-stable

So can you try building the latest version of libwebsockets? I think client-c will work with the latest libwebsockets (But I haven't tested it before).

Jeansen commented 4 months ago

Hey @ityuhui Thanks for the quick reply. It works on Debian bookworm and you might be correct. I'll try your hint. Also, maybe you could update the README. I also had to install packages like make cmake build-essential.

homer6 commented 4 months ago

I had this issue on Ubuntu 23.10, and the fix for me was to pull from main instead of this branch:

Docs say:

git clone https://github.com/warmcat/libwebsockets --depth 1 --branch v4.2-stable

Fix:

git clone https://github.com/warmcat/libwebsockets
ityuhui commented 4 months ago

It's great. Thank you all for the information. We can update the document to bump to the latest release version.

But I want to try sudo apt-get install libwebsockets-dev first. I think a compatible version of libwebsockets is now in the Debian and Ubuntu apt repo.