MinGW status.

Ryan Tandy <[email protected]> Fri, 17 Apr 2020 19:37:21 -0700
Newsgroups gmane.network.openldap.devel
Message-ID <[email protected]>
1. Why do I care about Windows?

After seeing knowledgeable people say several times that building 
OpenLDAP on Windows worked fine for them [1][2][3], but failing my first 
attempts, I decided it should damn well work for me too!

[1] https://bugs.openldap.org/show_bug.cgi?id=7878#c1
[2] https://bugs.openldap.org/show_bug.cgi?id=7878#c3
[3] https://www.openldap.org/lists/openldap-technical/201908/msg00033.html

2. Where are we now?

Master branch is in OK shape now. A basic build with OpenSSL and 
default-ish backends/overlays succeeds.

If built WITHOUT --enable-dynamic, it even passes the test suite, with 
one workaround [4]. If built WITH --enable-dynamic, there are various 
issues related to the libtool wrappers: the test processes don't exit 
when killed [5], ITS#2922 occurs, etc. Executing the binaries directly 
seems to work around most of it, but I still have an unexplained failure 
in test058.

RE24 has the code fixes now (in 2.4.50), however, its older libtool and 
autoconf still contain bugs that have been fixed now in master. It 
doesn't produce DLLs due to a libtool bug [6], but the executables can 
be built with the static libs. The test suite needs configure rebuilt 
with a newer autoconf [7], plus all the same caveats as master.

[4]
--- a/tests/scripts/defines.sh
+++ b/tests/scripts/defines.sh
@@ -18 +18 @@
-TESTWD=`pwd`
+TESTWD=`pwd -W`

[5] https://sourceforge.net/p/mingw/bugs/845/ https://sourceforge.net/p/mingw/bugs/1783/
[6] haven't found a bug or commit link, but https://lists.defectivebydesign.org/archive/html/lmi/2011-06/msg00016.html discusses the same problem
[7] http://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commit;h=17ea0df46f819a9b64c21151983a5c5b8561fefb

If I've analyzed anything above incorrectly, please let me know!

3. Where to next?

I'd like to write up some up-to-date instructions for building on 
Windows, but I'm not sure where I would post them before the FAQ site is 
replaced.

When I linked with MSYS2's cyrus-sasl package, I encountered heap 
corruption errors. I haven't looked more closely at that yet.

Since a native Windows CI host looks unlikely in the short term, I'd 
like to investigate getting cross builds [8] stable enough to add as a 
CI target. ITS#9087 is a first step in that direction. Obviously it 
wouldn't be able to run tests, but we could at least monitor compile 
failures. There are a few things to deal with, such as configure tests 
that currently run test programs (e.g. "working memcmp"), and providing 
dependency libraries (-lregex).

[8] apt install gcc-mingw-w64-x86-64

cheers,
Ryan