[Openvpn-devel,v1] Add -lpathcch for mingw32 builds using autotools

Message ID 20251031092427.19824-1-gert@greenie.muc.de
State New
Headers show
Series [Openvpn-devel,v1] Add -lpathcch for mingw32 builds using autotools | expand

Commit Message

Gert Doering Oct. 31, 2025, 9:23 a.m. UTC
From: Selva Nair <selva.nair@gmail.com>

This was missed in commit 05a8ba8

Note: the check for PATHCCH_ENSURE_TRAILING_SLASH in
configure.ac may be omitted if we build only using latest
mingw32-w64 toolchain. Ubuntu 24.04 is not new enough.

Github: closes OpenVPN/openvpn#885

Change-Id: Ifea896e722635a471cc01f930bc1e5d0f2c165be
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1334
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1334
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>

Comments

Gert Doering Oct. 31, 2025, 9:49 a.m. UTC | #1
Thanks for the quick fix.

I have tested this on Ubuntu 22.04 / x86_64-w64-mingw32, and it still
does not work (because there is no libpathcch.a).  Then I have tested on
Ubuntu 24.04.03, with the provided mingw-w64 (--host=x86_64-w64-mingw32)
and it compiles nicely again.

I have not actually tested the resulting binary, but usually this is not
where the different build systems run into problems.

I do assume that CMake building on 22.04 will now also fail - this is
something we do need to document in our release notes for rc1 and 2.7.0,
that "mingw builds now need 24.04".  But I think this is a reasonable
requirement - we did drop 20.04 at some point, for similar reasons, if
I recall correctly.

Your patch has been applied to the master branch.

(The whole "canonify patches" thing is not yet in 2.6, so when we backport
the one, we could just squash these two)

commit d5e6b72460af88c4d2820195d1a5df62358c41e1
Author: Selva Nair
Date:   Fri Oct 31 10:23:52 2025 +0100

     Add -lpathcch for mingw32 builds using autotools

     Signed-off-by: Selva Nair <selva.nair@gmail.com>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1334
     Message-Id: <20251031092427.19824-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34095.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/configure.ac b/configure.ac
index 8f3c01d..3117e13 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1383,6 +1383,17 @@ 
 	fi
 fi
 
+if test "${WIN32}" == "yes"; then
+	AC_CHECK_DECLS(
+		[PATHCCH_ENSURE_TRAILING_SLASH],
+		[AC_DEFINE([HAVE_PATHCCH_ENSURE_TRAILING_SLASH], [1], [PATHCCH_ENSURE_TRAILING_SLASH is defined])],
+		,
+		[[
+			#include <pathcch.h>
+		]]
+	)
+fi
+
 # When testing a compiler option, we add -Werror to force
 # an error when the option is unsupported. This is not
 # required for gcc, but some compilers such as clang need it.
diff --git a/src/openvpnserv/Makefile.am b/src/openvpnserv/Makefile.am
index a27fbbf..f45d770 100644
--- a/src/openvpnserv/Makefile.am
+++ b/src/openvpnserv/Makefile.am
@@ -27,7 +27,7 @@ 
 	-D_WIN32_WINNT=_WIN32_WINNT_VISTA
 openvpnserv_LDADD = \
 	-ladvapi32 -luserenv -liphlpapi -lfwpuclnt -lrpcrt4 \
-	-lshlwapi -lnetapi32 -lws2_32 -lntdll -lole32
+	-lshlwapi -lnetapi32 -lws2_32 -lntdll -lole32 -lpathcch
 noinst_DATA = \
 	MSG00409.bin eventmsg.h eventmsg.rc openvpnservmsg.dll
 BUILT_SOURCES = \