[PATCH] Fix PostgreSQL 12.1 server build and install problems under MSYS2

Started by Guram Dukaabout 6 years ago5 messages
#1Guram Duka
guram.duka@gmail.com
1 attachment(s)

Hi hackers.

I made a patch fixing build and install problems under MSYS2, including
llvmjit.

I have tested this in my environment and it works, of course need more
extensive testing.
Attached is a patch that fixes it. Tag REL_12_1.

--
Best regards.
Guram Duka.

Attachments:

postgresql-12.1-msys2-v1.patchapplication/octet-stream; name=postgresql-12.1-msys2-v1.patchDownload
--- a/configure.in	2019-08-06 00:14:59.000000000 +0300
+++ b/configure.in	2019-11-11 10:02:25.963408700 +0300
@@ -1183,7 +1183,7 @@ else
 fi
 
 if test "$with_gssapi" = yes ; then
-  if test "$PORTNAME" != "win32"; then
+  if test "$PORTNAME" != "win32" || which gss 2>&1 >/dev/null; then
     AC_SEARCH_LIBS(gss_init_sec_context, [gssapi_krb5 gss 'gssapi -lkrb5 -lcrypto'], [],
                    [AC_MSG_ERROR([could not find function 'gss_init_sec_context' required for GSSAPI])])
   else
@@ -1355,7 +1355,8 @@ fi
 
 if test "$with_gssapi" = yes ; then
   AC_CHECK_HEADERS(gssapi/gssapi.h, [],
-	[AC_CHECK_HEADERS(gssapi.h, [], [AC_MSG_ERROR([gssapi.h header file is required for GSSAPI])])])
+	[AC_CHECK_HEADERS(gssapi.h, [],
+		[AC_CHECK_HEADERS(gss/api.h, [], [AC_MSG_ERROR([gssapi.h header file is required for GSSAPI])])])])
 fi
 
 if test "$with_openssl" = yes ; then
--- a/src/include/libpq/libpq-be.h	2019-08-06 00:14:59.000000000 +0300
+++ b/src/include/libpq/libpq-be.h	2019-11-06 08:39:24.171190800 +0300
@@ -28,7 +28,9 @@
 #endif
 
 #ifdef ENABLE_GSS
-#if defined(HAVE_GSSAPI_H)
+#if defined(HAVE_GSS_API_H)
+#include <gss/api.h>
+#elif defined(HAVE_GSSAPI_H)
 #include <gssapi.h>
 #else
 #include <gssapi/gssapi.h>
--- a/src/include/pg_config.h.in	2019-08-06 00:14:59.000000000 +0300
+++ b/src/include/pg_config.h.in	2019-11-06 09:43:52.905854600 +0300
@@ -291,6 +291,9 @@
 /* Define to 1 if you have the <gssapi.h> header file. */
 #undef HAVE_GSSAPI_H
 
+/* Define to 1 if you have the <gss/api.h> header file. */
+#undef HAVE_GSS_API_H
+
 /* Define to 1 if you have the <history.h> header file. */
 #undef HAVE_HISTORY_H
 
--- a/src/interfaces/libpq/libpq-int.h	2019-11-06 10:19:05.434167800 +0300
+++ a/src/interfaces/libpq/libpq-int.h	2019-11-06 10:19:14.805284100 +0300
@@ -44,7 +44,9 @@
 #include "pqexpbuffer.h"
 
 #ifdef ENABLE_GSS
-#if defined(HAVE_GSSAPI_H)
+#if defined(HAVE_GSS_API_H)
+#include <gss/api.h>
+#elif defined(HAVE_GSSAPI_H)
 #include <gssapi.h>
 #else
 #include <gssapi/gssapi.h>
--- a/src/Makefile.shlib	2019-08-06 00:14:59.000000000 +0300
+++ b/src/Makefile.shlib	2019-11-06 11:49:07.937781400 +0300
@@ -389,7 +389,7 @@ else
 DLL_DEFFILE = lib$(NAME)dll.def
 
 $(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS)
-	$(CC) $(CFLAGS)  -shared -static-libgcc -o $@  $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=$(stlib)
+	$(CC) $(CFLAGS)  -shared -static-libgcc -o $@  $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--output-def,$(DLL_DEFFILE),--out-implib=$(stlib)
 endif
 
 endif # PORTNAME == cygwin
--- a/src/include/c.h	2019-08-06 00:14:59.000000000 +0300
+++ b/src/include/c.h	2019-11-07 16:06:08.452318100 +0300
@@ -786,7 +786,7 @@ extern void ExceptionalCondition(const c
  * helpful error message, but it beats not getting an error at all.
  */
 #ifndef __cplusplus
-#ifdef HAVE__STATIC_ASSERT
+#if defined(HAVE__STATIC_ASSERT) && !defined(__clang__)
 #define StaticAssertStmt(condition, errmessage) \
 	do { _Static_assert(condition, errmessage); } while(0)
 #define StaticAssertExpr(condition, errmessage) \
@@ -1195,7 +1195,7 @@ extern unsigned long long strtoull(const
  * setjmp. Incidentally, nothing provides setjmp's functionality in
  * that case.  We now support the case only on Windows.
  */
-#ifdef WIN32
+#if defined(WIN32) && !defined(__cplusplus)
 #define sigjmp_buf jmp_buf
 #define sigsetjmp(x,y) setjmp(x)
 #define siglongjmp longjmp
--- a/src/include/port/win32_port.h	2019-08-06 00:14:59.000000000 +0300
+++ b/src/include/port/win32_port.h	2019-11-07 16:53:13.547209400 +0300
@@ -263,8 +263,10 @@ typedef int pid_t;
  */
 #ifndef UNSAFE_STAT_OK
 extern int	pgwin32_safestat(const char *path, struct stat *buf);
+#if defined(WIN32) && !defined(__cplusplus) && !defined(BUILDING_DLL)
 #define stat(a,b) pgwin32_safestat(a,b)
 #endif
+#endif
 
 /* These macros are not provided by older MinGW, nor by MSVC */
 #ifndef S_IRUSR
@@ -440,7 +442,9 @@ extern int	pgkill(int pid, int sig);
 /* In backend/port/win32/socket.c */
 #ifndef FRONTEND
 #define socket(af, type, protocol) pgwin32_socket(af, type, protocol)
+#if defined(WIN32) && !defined(__cplusplus)
 #define bind(s, addr, addrlen) pgwin32_bind(s, addr, addrlen)
+#endif
 #define listen(s, backlog) pgwin32_listen(s, backlog)
 #define accept(s, addr, addrlen) pgwin32_accept(s, addr, addrlen)
 #define connect(s, name, namelen) pgwin32_connect(s, name, namelen)
@@ -483,6 +487,10 @@ extern BOOL AddUserToTokenDacl(HANDLE hT
 #define putenv(x) pgwin32_putenv(x)
 #define unsetenv(x) pgwin32_unsetenv(x)
 
+#ifdef __MINGW32__
+extern int setenv(const char *var, const char *val, int ovr);
+#endif
+
 /* Things that exist in MinGW headers, but need to be added to MSVC */
 #ifdef _MSC_VER
 
--- a/src/port/win32env.c	2019-11-12 01:03:10.000000000 +0300
+++ b/src/port/win32env.c	2019-12-03 11:50:30.620360900 +0300
@@ -123,3 +123,23 @@ pgwin32_unsetenv(const char *name)
 	pgwin32_putenv(envbuf);
 	free(envbuf);
 }
+
+#ifdef __MINGW32__
+int
+setenv(const char *var, const char *val, int ovr)
+{
+	if (!ovr) {
+		char c[2];
+
+		if (GetEnvironmentVariableA(var, c, 2) != 0 && GetLastError() != ERROR_ENVVAR_NOT_FOUND)
+			return 0;
+	}
+
+	if (SetEnvironmentVariableA(var, val))
+		return 0;
+
+	_dosmaperr(GetLastError());
+
+	return 1;
+}
+#endif
--- a/src/include/utils/elog.h	2019-08-06 00:14:59.000000000 +0300
+++ b/src/include/utils/elog.h	2019-11-07 16:21:45.966009500 +0300
@@ -315,8 +315,9 @@ extern PGDLLIMPORT ErrorContextCallback
 	(pg_re_throw(), pg_unreachable())
 #endif
 
+#if !defined(WIN32) || !defined(__cplusplus)
 extern PGDLLIMPORT sigjmp_buf *PG_exception_stack;
-
+#endif
 
 /* Stuff that error handlers might want to use */
 
--- a/src/Makefile.shlib	2019-11-08 09:53:47.092372100 +0300
+++ b/src/Makefile.shlib	2019-11-08 10:17:30.411522400 +0300
@@ -384,12 +384,12 @@ $(stlib): $(shlib)
 # Else we just use --export-all-symbols.
 ifeq (,$(SHLIB_EXPORTS))
 $(shlib): $(OBJS) | $(SHLIB_PREREQS)
-	$(CC) $(CFLAGS)  -shared -static-libgcc -o $@  $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=$(stlib)
+	$(COMPILER)  -shared -static-libgcc -o $@  $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=$(stlib)
 else
 DLL_DEFFILE = lib$(NAME)dll.def
 
 $(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS)
-	$(CC) $(CFLAGS)  -shared -static-libgcc -o $@  $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--output-def,$(DLL_DEFFILE),--out-implib=$(stlib)
+	$(COMPILER)  -shared -static-libgcc -o $@  $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--output-def,$(DLL_DEFFILE),--out-implib=$(stlib)
 endif
 
 endif # PORTNAME == cygwin
--- a/src/backend/jit/llvm/Makefile	2019-08-06 00:14:59.000000000 +0300
+++ b/src/backend/jit/llvm/Makefile	2019-11-07 16:48:42.580263400 +0300
@@ -31,7 +31,7 @@ SHLIB_LINK += $(LLVM_LIBS)
 # Because this module includes C++ files, we need to use a C++
 # compiler for linking. Makefile.shlib uses $(COMPILER) to build
 # loadable modules.
-override COMPILER = $(CXX) $(CFLAGS)
+override COMPILER = $(CXX) $(CXXFLAGS) -static-libstdc++ 
 
 OBJS=$(WIN32RES)
 
--- a/src/backend/utils/init/globals.c	2019-08-06 00:14:59.000000000 +0300
+++ b/src/backend/utils/init/globals.c	2019-11-08 11:11:49.364880400 +0300
@@ -68,8 +68,8 @@ int			data_directory_mode = PG_DIR_MODE_
 
 char		OutputFileName[MAXPGPATH];	/* debugging output file */
 
-char		my_exec_path[MAXPGPATH];	/* full path to my executable */
-char		pkglib_path[MAXPGPATH]; /* full path to lib directory */
+PGDLLIMPORT char		my_exec_path[MAXPGPATH];	/* full path to my executable */
+PGDLLIMPORT char		pkglib_path[MAXPGPATH]; /* full path to lib directory */
 
 #ifdef EXEC_BACKEND
 char		postgres_exec_path[MAXPGPATH];	/* full path to backend */
--- a/src/include/miscadmin.h	2019-08-06 00:14:59.000000000 +0300
+++ b/src/include/miscadmin.h	2019-11-08 11:10:46.294686700 +0300
@@ -170,7 +170,7 @@ extern int	MyPMChildSlot;
 
 extern char OutputFileName[];
 extern PGDLLIMPORT char my_exec_path[];
-extern char pkglib_path[];
+extern PGDLLIMPORT char pkglib_path[];
 
 #ifdef EXEC_BACKEND
 extern char postgres_exec_path[];
--- a/src/include/jit/jit.h	2019-08-06 00:14:59.000000000 +0300
+++ b/src/include/jit/jit.h	2019-11-08 11:41:40.034349100 +0300
@@ -81,10 +81,10 @@ struct JitProviderCallbacks
 /* GUCs */
 extern bool jit_enabled;
 extern char *jit_provider;
-extern bool jit_debugging_support;
-extern bool jit_dump_bitcode;
+extern PGDLLIMPORT bool jit_debugging_support;
+extern PGDLLIMPORT bool jit_dump_bitcode;
 extern bool jit_expressions;
-extern bool jit_profiling_support;
+extern PGDLLIMPORT bool jit_profiling_support;
 extern bool jit_tuple_deforming;
 extern double jit_above_cost;
 extern double jit_inline_above_cost;
--- a/src/backend/jit/jit.c	2019-08-06 00:14:59.000000000 +0300
+++ b/src/backend/jit/jit.c	2019-11-08 11:51:53.493700200 +0300
@@ -34,10 +34,10 @@
 /* GUCs */
 bool		jit_enabled = true;
 char	   *jit_provider = NULL;
-bool		jit_debugging_support = false;
-bool		jit_dump_bitcode = false;
+PGDLLIMPORT bool		jit_debugging_support = false;
+PGDLLIMPORT bool		jit_dump_bitcode = false;
 bool		jit_expressions = true;
-bool		jit_profiling_support = false;
+PGDLLIMPORT bool		jit_profiling_support = false;
 bool		jit_tuple_deforming = true;
 double		jit_above_cost = 100000;
 double		jit_inline_above_cost = 500000;
--- a/src/backend/jit/llvm/llvmjit.c	2019-08-06 00:14:59.000000000 +0300
+++ b/src/backend/jit/llvm/llvmjit.c	2019-11-08 12:21:48.556440900 +0300
@@ -11,6 +11,7 @@
  *-------------------------------------------------------------------------
  */
 
+#define FORCE_PGDLLIMPORT 1
 #include "postgres.h"
 
 #include "jit/llvmjit.h"
@@ -23,7 +24,6 @@
 #include "portability/instr_time.h"
 #include "storage/ipc.h"
 
-
 #include <llvm-c/Analysis.h>
 #include <llvm-c/BitReader.h>
 #include <llvm-c/BitWriter.h>
@@ -861,7 +861,7 @@ llvm_split_symbol_name(const char *name,
 		 * Symbol names cannot contain a ., therefore we can split based on
 		 * first and last occurrence of one.
 		 */
-		*funcname = rindex(name, '.');
+		*funcname = strrchr(name, '.');
 		(*funcname)++;			/* jump over . */
 
 		*modname = pnstrdup(name + strlen("pgextern."),
--- a/src/backend/jit/llvm/llvmjit_inline.cpp	2019-08-06 00:14:59.000000000 +0300
+++ b/src/backend/jit/llvm/llvmjit_inline.cpp	2019-11-08 12:21:32.678703500 +0300
@@ -21,6 +21,8 @@
 
 extern "C"
 {
+#define FORCE_PGDLLIMPORT 1
+#include "pg_config_os.h"
 #include "postgres.h"
 }
 
@@ -29,7 +31,9 @@ extern "C"
 extern "C"
 {
 #include <fcntl.h>
+#ifndef WIN32
 #include <sys/mman.h>
+#endif
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
--- a/src/include/port/win32.h	2019-08-06 00:14:59.000000000 +0300
+++ b/src/include/port/win32.h	2019-11-08 12:23:29.827483400 +0300
@@ -45,7 +45,7 @@
  * defines for dynamic linking on Win32 platform
  */
 
-#ifdef BUILDING_DLL
+#if defined(BUILDING_DLL) && !defined(FORCE_PGDLLIMPORT)
 #define PGDLLIMPORT __declspec (dllexport)
 #else
 #define PGDLLIMPORT __declspec (dllimport)
--- a/src/makefiles/pgxs.mk	2019-08-06 00:14:59.000000000 +0300
+++ b/src/makefiles/pgxs.mk	2019-11-08 15:20:32.058904500 +0300
@@ -211,7 +211,7 @@ endef
 all: $(PROGRAM) $(DATA_built) $(HEADER_allbuilt) $(SCRIPTS_built) $(addsuffix $(DLSUFFIX), $(MODULES)) $(addsuffix .control, $(EXTENSION))
 
 ifeq ($(with_llvm), yes)
-all: $(addsuffix .bc, $(MODULES)) $(patsubst %.o,%.bc, $(OBJS))
+all: $(addsuffix .bc, $(MODULES)) $(patsubst win32ver.bc,win32ver.o, $(patsubst %.o,%.bc, $(OBJS)))
 endif
 
 ifdef MODULE_big
@@ -259,7 +259,7 @@ ifneq (,$(strip $(HEADER_dirs)))
 endif # HEADERS
 ifdef MODULE_big
 ifeq ($(with_llvm), yes)
-	$(call install_llvm_module,$(MODULE_big),$(OBJS))
+	$(call install_llvm_module,$(MODULE_big),$(filter-out win32ver.o, $(OBJS)))
 endif # with_llvm
 
 install: install-lib
--- a/config/llvm.m4	2019-08-06 00:14:59.000000000 +0300
+++ b/config/llvm.m4	2019-11-11 09:47:45.546676500 +0300
@@ -89,7 +89,7 @@ AC_DEFUN([PGAC_LLVM_SUPPORT],
     esac
   done
 
-  LLVM_BINPATH=`$LLVM_CONFIG --bindir`
+  LLVM_BINPATH=`$LLVM_CONFIG --bindir | sed -E -e "s/\x5C\x5C/\//g"`
 
 dnl LLVM_CONFIG, CLANG are already output via AC_ARG_VAR
   AC_SUBST(LLVM_LIBS)
--- a/src/pl/plperl/GNUmakefile 2019-10-29 14:46:46.000000000 +0300
+++ b/src/pl/plperl/GNUmakefile	2019-11-06 13:02:18.910992500 +0300
@@ -48,7 +48,7 @@ lib$(perlwithver).a: $(perlwithver).def
 	dlltool --dllname $(perlwithver).dll --def $(perlwithver).def --output-lib lib$(perlwithver).a
 
 $(perlwithver).def: $(PERLDLL)
-	pexports $^ > $@
+	gendef - $^ > $@ || pexports $^ > $@
 
 endif # win32
 
--- a/src/pl/plperl/plperl.c	2019-08-06 00:14:59.000000000 +0300
+++ b/src/pl/plperl/plperl.c	2019-11-06 14:34:35.252510900 +0300
@@ -4163,7 +4163,9 @@ setlocale_perl(int category, char *local
 			else
 #endif
 				newctype = RETVAL;
+#if PERL_REVISION <= 5 && PERL_VERSION < 28
 			new_ctype(newctype);
+#endif
 		}
 #endif							/* USE_LOCALE_CTYPE */
 #ifdef USE_LOCALE_COLLATE
@@ -4181,7 +4183,9 @@ setlocale_perl(int category, char *local
 			else
 #endif
 				newcoll = RETVAL;
+#if PERL_REVISION <= 5 && PERL_VERSION < 28
 			new_collate(newcoll);
+#endif
 		}
 #endif							/* USE_LOCALE_COLLATE */
 
@@ -4200,7 +4204,9 @@ setlocale_perl(int category, char *local
 			else
 #endif
 				newnum = RETVAL;
+#if PERL_REVISION <= 5 && PERL_VERSION < 28
 			new_numeric(newnum);
+#endif
 		}
 #endif							/* USE_LOCALE_NUMERIC */
 	}
--- a/src/pl/plpython/Makefile	2019-08-06 00:14:59.000000000 +0300
+++ b/src/pl/plpython/Makefile	2019-11-06 19:00:59.513600600 +0300
@@ -4,13 +4,6 @@ subdir = src/pl/plpython
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
-
-# On Windows we have to remove -lpython from the link since we are
-# building our own
-ifeq ($(PORTNAME), win32)
-override python_libspec =
-endif
-
 override CPPFLAGS := -I. -I$(srcdir) $(python_includespec) $(CPPFLAGS)
 
 rpathdir = $(python_libdir)
@@ -61,15 +54,20 @@ INCS = 	plpython.h \
 ifeq ($(PORTNAME), win32)
 
 pytverstr=$(subst .,,${python_version})
-PYTHONDLL=$(subst \,/,$(WINDIR))/system32/python${pytverstr}.dll
+PYTHONDLL=$(shell echo $(python_libspec).dll | sed -E -e "s/-L//" -e "s/\s+-l/\//")
+ifneq ("$(wildcard $(PYTHONDLL))","")
+    @echo $(PYTHONDLL) FILE_EXISTS
+else
+	PYTHONDLL=$(shell echo $(python_libspec).dll | sed -E -e "s/-L//" -e "s/\s+-l/\/lib/")
+endif
 
 OBJS += libpython${pytverstr}.a
 
 libpython${pytverstr}.a: python${pytverstr}.def
-	dlltool --dllname python${pytverstr}.dll --def python${pytverstr}.def --output-lib libpython${pytverstr}.a
+	dlltool --dllname $(shell basename $(PYTHONDLL)) --def python${pytverstr}.def --output-lib libpython${pytverstr}.a
 
 python${pytverstr}.def:
-	pexports $(PYTHONDLL) > $@
+	gendef - $(PYTHONDLL) > $@ || pexports $(PYTHONDLL) > $@
 
 endif # win32
 
--- a/config/python.m4	2019-08-06 00:14:59.000000000 +0300
+++ b/config/python.m4	2019-11-11 09:51:33.294301200 +0300
@@ -64,6 +64,7 @@ else:
     print(a + ' ' + b)"`
 if test "$PORTNAME" = win32 ; then
     python_includespec=`echo $python_includespec | sed 's,[[\]],/,g'`
+	python_bindir=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('BINDIR'))))"`
 fi
 AC_MSG_RESULT([$python_includespec])
 
@@ -121,7 +122,7 @@ else
 	fi
 	# Search for a likely-looking file.
 	found_shlib=0
-	for d in "${python_libdir}" "${python_configdir}" /usr/lib64 /usr/lib
+	for d in "${python_libdir}" "${python_configdir}" "${python_bindir}" /usr/lib64 /usr/lib
 	do
 		# We don't know the platform DLSUFFIX here, so check 'em all.
 		for e in .so .dll .dylib .sl; do
--- a/src/include/libpq/be-gssapi-common.h	2019-11-12 01:03:10.000000000 +0300
+++ b/src/include/libpq/be-gssapi-common.h	2019-12-03 10:30:18.300474400 +0300
@@ -14,7 +14,9 @@
 #ifndef BE_GSSAPI_COMMON_H
 #define BE_GSSAPI_COMMON_H
 
-#if defined(HAVE_GSSAPI_H)
+#if defined(HAVE_GSS_API_H)
+#include <gss/api.h>
+#elif defined(HAVE_GSSAPI_H)
 #include <gssapi.h>
 #else
 #include <gssapi/gssapi.h>
--- a/src/interfaces/libpq/fe-gssapi-common.c	2019-11-12 01:03:10.000000000 +0300
+++ b/src/interfaces/libpq/fe-gssapi-common.c	2019-12-03 12:32:20.530360700 +0300
@@ -128,3 +128,11 @@ pg_GSS_load_servicename(PGconn *conn)
 	}
 	return STATUS_OK;
 }
+
+#ifdef __MINGW32__
+static gss_OID_desc GSS_C_NT_HOSTBASED_SERVICE_DESC = {
+	10, (void *) "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04"
+};
+
+gss_OID GSS_C_NT_HOSTBASED_SERVICE = &GSS_C_NT_HOSTBASED_SERVICE_DESC;
+#endif
--- a/src/backend/executor/execTuples.c	2019-11-12 01:03:10.000000000 +0300
+++ b/src/backend/executor/execTuples.c	2019-12-03 12:53:32.218358400 +0300
@@ -80,10 +80,10 @@ static inline void tts_buffer_heap_store
 static void tts_heap_store_tuple(TupleTableSlot *slot, HeapTuple tuple, bool shouldFree);
 
 
-const TupleTableSlotOps TTSOpsVirtual;
-const TupleTableSlotOps TTSOpsHeapTuple;
-const TupleTableSlotOps TTSOpsMinimalTuple;
-const TupleTableSlotOps TTSOpsBufferHeapTuple;
+PGDLLIMPORT const TupleTableSlotOps TTSOpsVirtual;
+PGDLLIMPORT const TupleTableSlotOps TTSOpsHeapTuple;
+PGDLLIMPORT const TupleTableSlotOps TTSOpsMinimalTuple;
+PGDLLIMPORT const TupleTableSlotOps TTSOpsBufferHeapTuple;
 
 
 /*
@@ -992,7 +992,7 @@ slot_deform_heap_tuple(TupleTableSlot *s
 }
 
 
-const TupleTableSlotOps TTSOpsVirtual = {
+PGDLLIMPORT const TupleTableSlotOps TTSOpsVirtual = {
 	.base_slot_size = sizeof(VirtualTupleTableSlot),
 	.init = tts_virtual_init,
 	.release = tts_virtual_release,
@@ -1012,7 +1012,7 @@ const TupleTableSlotOps TTSOpsVirtual =
 	.copy_minimal_tuple = tts_virtual_copy_minimal_tuple
 };
 
-const TupleTableSlotOps TTSOpsHeapTuple = {
+PGDLLIMPORT const TupleTableSlotOps TTSOpsHeapTuple = {
 	.base_slot_size = sizeof(HeapTupleTableSlot),
 	.init = tts_heap_init,
 	.release = tts_heap_release,
@@ -1029,7 +1029,7 @@ const TupleTableSlotOps TTSOpsHeapTuple
 	.copy_minimal_tuple = tts_heap_copy_minimal_tuple
 };
 
-const TupleTableSlotOps TTSOpsMinimalTuple = {
+PGDLLIMPORT const TupleTableSlotOps TTSOpsMinimalTuple = {
 	.base_slot_size = sizeof(MinimalTupleTableSlot),
 	.init = tts_minimal_init,
 	.release = tts_minimal_release,
@@ -1046,7 +1046,7 @@ const TupleTableSlotOps TTSOpsMinimalTup
 	.copy_minimal_tuple = tts_minimal_copy_minimal_tuple
 };
 
-const TupleTableSlotOps TTSOpsBufferHeapTuple = {
+PGDLLIMPORT const TupleTableSlotOps TTSOpsBufferHeapTuple = {
 	.base_slot_size = sizeof(BufferHeapTupleTableSlot),
 	.init = tts_buffer_heap_init,
 	.release = tts_buffer_heap_release,
--- a/src/backend/jit/llvm/llvmjit_deform.c	2019-11-12 01:03:10.000000000 +0300
+++ b/src/backend/jit/llvm/llvmjit_deform.c	2019-12-03 15:31:10.926893300 +0300
@@ -16,6 +16,7 @@
  *-------------------------------------------------------------------------
  */
 
+#define FORCE_PGDLLIMPORT 1
 #include "postgres.h"
 
 #include <llvm-c/Core.h>
#2Michael Paquier
michael@paquier.xyz
In reply to: Guram Duka (#1)
Re: [PATCH] Fix PostgreSQL 12.1 server build and install problems under MSYS2

On Wed, Dec 04, 2019 at 10:46:39AM +0300, Guram Duka wrote:

I made a patch fixing build and install problems under MSYS2, including
llvmjit.

I have tested this in my environment and it works, of course need more
extensive testing.
Attached is a patch that fixes it. Tag REL_12_1.

Do you have the same problems if you compile the code from the latest
branch of the master branch?

Could you register this patch to the upcoming commit fest? Here is a
link to it:
https://commitfest.postgresql.org/26/

Thanks,
--
Michael

#3Guram Duka
guram.duka@gmail.com
In reply to: Michael Paquier (#2)
Re: [PATCH] Fix PostgreSQL 12.1 server build and install problems under MSYS2

Master branch got error in configure stage and then compiling like 12.1
branch.

checking how to link an embedded Python application... configure: error:

could not find shared library for Python
You might have to rebuild your Python installation. Refer to the
documentation for details. Use --without-python to disable building
PL/Python.

I registered the patch.

ср, 4 дек. 2019 г. в 11:05, Michael Paquier <michael@paquier.xyz>:

On Wed, Dec 04, 2019 at 10:46:39AM +0300, Guram Duka wrote:

I made a patch fixing build and install problems under MSYS2, including
llvmjit.

I have tested this in my environment and it works, of course need more
extensive testing.
Attached is a patch that fixes it. Tag REL_12_1.

Do you have the same problems if you compile the code from the latest
branch of the master branch?

Could you register this patch to the upcoming commit fest? Here is a
link to it:
https://commitfest.postgresql.org/26/

Thanks,
--
Michael

--
Best regards.
Guram Duka.

#4Peter Eisentraut
peter.eisentraut@2ndquadrant.com
In reply to: Guram Duka (#3)
Re: [PATCH] Fix PostgreSQL 12.1 server build and install problems under MSYS2

On 2019-12-04 11:32, Guram Duka wrote:

Master branch got error in configure stage and then compiling like 12.1
branch.

checking how to link an embedded Python application... configure:
error: could not find shared library for Python
You might have to rebuild your Python installation.  Refer to the
documentation for details.  Use --without-python to disable building
PL/Python.

I registered the patch.

As explained to you in the previous patch, you need to explain each
change in detail and show the problems you are facing. Other people
have used this platform before and it works for them, so you need to
explain what's different for you, especially considering the extent of
the changes you are proposing.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

#5Peter Eisentraut
peter.eisentraut@2ndquadrant.com
In reply to: Peter Eisentraut (#4)
Re: [PATCH] Fix PostgreSQL 12.1 server build and install problems under MSYS2

On 2019-12-31 11:56, Peter Eisentraut wrote:

On 2019-12-04 11:32, Guram Duka wrote:

Master branch got error in configure stage and then compiling like 12.1
branch.

checking how to link an embedded Python application... configure:
error: could not find shared library for Python
You might have to rebuild your Python installation.  Refer to the
documentation for details.  Use --without-python to disable building
PL/Python.

I registered the patch.

As explained to you in the previous patch, you need to explain each
change in detail and show the problems you are facing. Other people
have used this platform before and it works for them, so you need to
explain what's different for you, especially considering the extent of
the changes you are proposing.

I'm setting this patch as rejected in the commit fest.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services