Mingw task for Cirrus CI - Mailing list pgsql-hackers

From Melih Mutlu
Subject Mingw task for Cirrus CI
Date
Msg-id CAGPVpCSKS9E0An4=e7ZDnme+y=WOcQFJYJegKO8kE9=gh8NJKQ@mail.gmail.com
Whole thread Raw
Responses Re: Mingw task for Cirrus CI  (Andres Freund <andres@anarazel.de>)
Re: Mingw task for Cirrus CI  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Hi All,

I've been working on adding Windows+MinGW environment into cirrus-ci tasks (discussion about ci is here [1]).
It uses MSYS2 to set the environment. UCRT is chosen as C standard library, instead of MSVCRT.
The task configures postgres with features that are available in MSYS2 (see available packages [2]) and tap tests are enabled.
I already added the necessary docker image, you can find the related PR at [3] and a successful cirruc-ci run with these changes at [4].
Attached patch adds a task runs on Windows with MinGW for cirrus-ci 
However, I cannot run configure with --with-python, --with-perl or --with-tcl. 
There are two issues I encountered while trying to enable.  e.g. for --with-python
1-  python_ldlibrary is set to "libpython3.9.dll.a". So the related line in configure cannot retrieve "ldlibrary"
2-  src/pl/plpython/Makefile looks under "C:/Windows/system32/" for PYTHONDLLgendef cannot open that file, give an error like " failed to open()" when creating a .def file.
To overcome those, I added the correct pattern to extract ldlibrary by appending  "-e 's/\.dll.a$//'" at the end of the related line.
Then, I tried to use python dll from MSYS instead of windows/system32 by changing PYTHONDLL path to "/ucrt64/bin/libpython3.9.dll". I'm not sure if this is the correct dll.
Here is the diff of these two changes:
diff --git a/configure b/configure
index f3cb5c2b51..42ea580442 100755
--- a/configure
+++ b/configure
@@ -10536,7 +10536,7 @@ python_libdir=`${PYTHON} -c "import sysconfig; print(' '.join(filter(None,syscon
 python_ldlibrary=`${PYTHON} -c "import sysconfig; print(' '.join(filter(None,sysconfig.get_config_vars('LDLIBRARY'))))"`
 # If LDLIBRARY exists and has a shlib extension, use it verbatim.
-ldlibrary=`echo "${python_ldlibrary}" | sed -e 's/\.so$//' -e 's/\.dll$//' -e 's/\.dylib$//' -e 's/\.sl$//'`
+ldlibrary=`echo "${python_ldlibrary}" | sed -e 's/\.so$//' -e 's/\.dll$//' -e 's/\.dylib$//' -e 's/\.sl$//' -e 's/\.dll.a$//'`
 if test -e "${python_libdir}/${python_ldlibrary}" -a x"${python_ldlibrary}" != x"${ldlibrary}"
 then
        ldlibrary=`echo "${ldlibrary}" | sed "s/^lib//"`
diff --git a/src/pl/plpython/Makefile b/src/pl/plpython/Makefile
index a83ae8865c..4254ef94d7 100644
--- a/src/pl/plpython/Makefile
+++ b/src/pl/plpython/Makefile
@@ -61,7 +61,8 @@ INCS =        plpython.h \
 ifeq ($(PORTNAME), win32)
 pytverstr=$(subst .,,${python_version})
-PYTHONDLL=$(subst \,/,$(WINDIR))/system32/python${pytverstr}.dll
+#PYTHONDLL=$(subst \,/,$(WINDIR))/system32/python${pytverstr}.dll
+PYTHONDLL=/ucrt64/bin/libpython3.9.dll
 OBJS += libpython${pytverstr}.a
In the end, make check-world still fails, even though I was able to run configure and make without any obvious error.
I see bunch of errors in tests like:
+ERROR:  language "plpython3u" does not exist+HINT:  Use CREATE EXTENSION to load the language into the database.
Any thoughts on how postgres can be built with --with-python etc. on mingw?
Best,
Melih
[4] https://cirrus-ci.com/build/4999469182746624
Attachment

pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: Expose JIT counters/timing in pg_stat_statements
Next
From: Andres Freund
Date:
Subject: Re: Add parameter jit_warn_above_fraction