[vlc-commits] [Git][videolan/vlc][master] contrib: vncclient: Fix building for Windows with recent versions of Clang
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Thu Mar 12 21:56:36 UTC 2026
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
f575a4d7 by Martin Storsjö at 2026-03-12T20:29:12+01:00
contrib: vncclient: Fix building for Windows with recent versions of Clang
This fixes errors like this with recent versions of Clang:
libvncserver/src/libvncclient/tls_gnutls.c:161:32: error: incompatible pointer types passing 'gnutls_session_t *' (aka 'struct gnutls_session_int **') to parameter of type 'gnutls_session_t' (aka 'struct gnutls_session_int *'); dereference with * [-Wincompatible-pointer-types]
161 | gnutls_transport_set_errno(session, EAGAIN);
| ^~~~~~~
| *
x86_64-w64-mingw32/include/gnutls/gnutls.h:2429:50: note: passing argument to parameter 'session' here
2429 | void gnutls_transport_set_errno(gnutls_session_t session, int err);
|
With different compilers, this would only be a warning, not an error,
but the mismatch would be fatal if ever executed.
This is a backport of commit 53b76ce9c8224b9dc9b566c018a07e9e96f2ce4c
from upstream.
While patching this project, also backport commit
9c68402d000486b7dee76b104fbb0109836c94f3 from upstream, fixing
another issue with the cmake build of this project.
- - - - -
3 changed files:
- + contrib/src/vncclient/0001-libvncclient-tls_gnutls-Fix-gnutls_transport_set_err.patch
- + contrib/src/vncclient/0002-CMake-Fix-the-include-guards-in-rfbconfig.h.patch
- contrib/src/vncclient/rules.mak
Changes:
=====================================
contrib/src/vncclient/0001-libvncclient-tls_gnutls-Fix-gnutls_transport_set_err.patch
=====================================
@@ -0,0 +1,66 @@
+From 53b76ce9c8224b9dc9b566c018a07e9e96f2ce4c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
+Date: Tue, 10 Mar 2026 18:47:46 +0200
+Subject: [PATCH 1/2] libvncclient: tls_gnutls: Fix gnutls_transport_set_errno
+ on Windows
+
+gnutls_transport_set_errno takes a plain "gnutls_session_t", not
+a "gnutls_session_t *".
+
+This fixes build errors if building with a recent version of Clang
+targeting Windows:
+
+ libvncserver/src/libvncclient/tls_gnutls.c:161:32: error: incompatible pointer types passing 'gnutls_session_t *' (aka 'struct gnutls_session_int **') to parameter of type 'gnutls_session_t' (aka 'struct gnutls_session_int *'); dereference with * [-Wincompatible-pointer-types]
+ 161 | gnutls_transport_set_errno(session, EAGAIN);
+ | ^~~~~~~
+ | *
+ x86_64-w64-mingw32/include/gnutls/gnutls.h:2429:50: note: passing argument to parameter 'session' here
+ 2429 | void gnutls_transport_set_errno(gnutls_session_t session, int err);
+ | ^
+---
+ src/libvncclient/tls_gnutls.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/libvncclient/tls_gnutls.c b/src/libvncclient/tls_gnutls.c
+index fe11c529..6e46029a 100644
+--- a/src/libvncclient/tls_gnutls.c
++++ b/src/libvncclient/tls_gnutls.c
+@@ -253,7 +253,7 @@ InitializeTLS(void)
+ * libvncclient are linked to different versions of msvcrt.dll.
+ */
+ #ifdef WIN32
+-static void WSAtoTLSErrno(gnutls_session_t* session)
++static void WSAtoTLSErrno(gnutls_session_t session)
+ {
+ switch(WSAGetLastError()) {
+ #if (GNUTLS_VERSION_NUMBER >= 0x029901)
+@@ -293,7 +293,7 @@ PushTLS(gnutls_transport_ptr_t transport, const void *data, size_t len)
+ if (ret < 0)
+ {
+ #ifdef WIN32
+- WSAtoTLSErrno((gnutls_session_t*)&client->tlsSession);
++ WSAtoTLSErrno((gnutls_session_t)client->tlsSession);
+ #endif
+ if (errno == EINTR) continue;
+ return -1;
+@@ -315,7 +315,7 @@ PullTLS(gnutls_transport_ptr_t transport, void *data, size_t len)
+ if (ret < 0)
+ {
+ #ifdef WIN32
+- WSAtoTLSErrno((gnutls_session_t*)&client->tlsSession);
++ WSAtoTLSErrno((gnutls_session_t)client->tlsSession);
+ #endif
+ if (errno == EINTR) continue;
+ return -1;
+@@ -337,7 +337,7 @@ PullTimeout(gnutls_transport_ptr_t transport, unsigned int timeout)
+ if (ret < 0)
+ {
+ #ifdef WIN32
+- WSAtoTLSErrno((gnutls_session_t*)&client->tlsSession);
++ WSAtoTLSErrno((gnutls_session_t)client->tlsSession);
+ #endif
+ if (errno == EINTR) continue;
+ }
+--
+2.43.0
+
=====================================
contrib/src/vncclient/0002-CMake-Fix-the-include-guards-in-rfbconfig.h.patch
=====================================
@@ -0,0 +1,40 @@
+From 9c68402d000486b7dee76b104fbb0109836c94f3 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
+Date: Tue, 10 Mar 2026 22:16:40 +0200
+Subject: [PATCH 2/2] CMake: Fix the include guards in rfbconfig.h
+
+The include guard shouldn't be a cmakedefine - this is not a 0/1
+define that we expect cmake to configure, it should always be
+defined here.
+
+This avoids warnings like this (when building with Clang, targeting
+Windows), due to rfbconfig.h being included multiple times, when
+building with CMake:
+
+ libvncserver/build/include/rfb/rfbconfig.h:197:13: warning: redefinition of typedef 'socklen_t' is a C11 feature [-Wtypedef-redefinition]
+ 197 | typedef int socklen_t;
+ | ^
+ libvncserver/include/rfb/rfbproto.h:70:10: note: 'libvncserver/build/include/rfb/rfbconfig.h' included multiple times, additional include site here
+ 70 | #include <rfb/rfbconfig.h>
+ | ^
+ libvncserver/include/rfb/threading.h:25:10: note: 'libvncserver/build/include/rfb/rfbconfig.h' included multiple times, additional include site here
+ 25 | #include <rfb/rfbconfig.h>
+ | ^
+---
+ include/rfb/rfbconfig.h.cmakein | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/rfb/rfbconfig.h.cmakein b/include/rfb/rfbconfig.h.cmakein
+index d50c3c96..1256429a 100644
+--- a/include/rfb/rfbconfig.h.cmakein
++++ b/include/rfb/rfbconfig.h.cmakein
+@@ -1,5 +1,5 @@
+ #ifndef _RFB_RFBCONFIG_H
+-#cmakedefine _RFB_RFBCONFIG_H 1
++#define _RFB_RFBCONFIG_H
+
+ /* rfb/rfbconfig.h. Generated automatically by cmake. */
+
+--
+2.43.0
+
=====================================
contrib/src/vncclient/rules.mak
=====================================
@@ -23,6 +23,8 @@ vncclient: LibVNCServer-$(VNCCLIENT_VERSION).tar.gz .sum-vncclient
$(APPLY) $(SRC)/vncclient/vnc-gnutls-anon.patch
$(APPLY) $(SRC)/vncclient/build-add-install-components-for-client-server.patch
$(APPLY) $(SRC)/vncclient/CMake-use-Requires-for-.pc-generation-don-t-parse-li.patch
+ $(APPLY) $(SRC)/vncclient/0001-libvncclient-tls_gnutls-Fix-gnutls_transport_set_err.patch
+ $(APPLY) $(SRC)/vncclient/0002-CMake-Fix-the-include-guards-in-rfbconfig.h.patch
$(call pkg_static,"src/libvncclient/libvncclient.pc.cmakein")
$(MOVE)
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/f575a4d79e86948e2024151f83fbbf82e6c165a2
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/f575a4d79e86948e2024151f83fbbf82e6c165a2
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list