(2014/02/12 8:30), Tom Lane wrote:
> I wrote:
>> Hiroshi Inoue <in...@tpf.co.jp> writes:
>>> I tried MINGW port with the attached change and successfully built
>>> src and contrib and all pararell regression tests were OK.
> 
>> I cleaned this up a bit (the if-nesting in Makefile.shlib was making
>> my head hurt, not to mention that it left a bunch of dead code) and
>> committed it.
> 
> Hm ... according to buildfarm member narwhal, this doesn't work so well
> for plperl:
> 
> gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith 
> -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute 
> -Wformat-security -fno-strict-aliasing -fwrapv -g -Wno-comment   -shared -o 
> plperl.dll  plperl.o SPI.o Util.o -L../../../src/port -L../../../src/common 
> -Wl,--allow-multiple-definition -L/mingw/lib  -Wl,--as-needed   
> -LC:/Perl/lib/CORE -lperl58 -L../../../src/backend -lpostgres -lpgcommon 
> -lpgport -lintl -lxslt -lxml2 -lssleay32 -leay32 -lz -lm  -lws2_32 -lshfolder 
> -Wl,--export-all-symbols -Wl,--out-implib=libplperl.a
> Cannot export .idata$4: symbol not found
> Cannot export .idata$5: symbol not found
> Cannot export .idata$6: symbol not found
> Cannot export .text: symbol not found
> Cannot export perl58_NULL_THUNK_DATA: symbol not found
> Creating library file: libplperl.a
> collect2: ld returned 1 exit status
> make[3]: *** [plperl.dll] Error 1
> 
> Not very clear what's going on there; could this be a problem in
> narwhal's admittedly-ancient toolchain?

The error doesn't occur here (un)fortunately.
One thing I'm wondering about is that plperl is linking perlxx.lib
not libperlxx.a. I made a patch following plpython and it also
works here.
Is it worth trying?

regards,
Hiroshi Inoue

diff --git a/src/pl/plperl/GNUmakefile b/src/pl/plperl/GNUmakefile
index e0e31ec..065c5d3 100644
--- a/src/pl/plperl/GNUmakefile
+++ b/src/pl/plperl/GNUmakefile
@@ -16,6 +16,8 @@ endif
 ifeq ($(shared_libperl),yes)
 
 ifeq ($(PORTNAME), win32)
+generate_perl_implib = yes
+
 override CPPFLAGS += -DPLPERL_HAVE_UID_GID
 # Perl on win32 contains /* within comment all over the header file,
 # so disable this warning.
@@ -36,7 +38,21 @@ DATA = plperl.control plperl--1.0.sql plperl--unpackaged--1.0.sql \
 
 PERLCHUNKS = plc_perlboot.pl plc_trusted.pl
 
+# Perl on win32 ships with import libraries only for Microsoft Visual C++,
+# which may not be handled with mingw gcc. Therefore we choose to build a
+# new import library to link with.
+ifeq ($(generate_perl_implib), yes)
+	perlwithver = $(subst -l,,$(filter -l%, $(perl_embed_ldflags)))
+	OBJS += lib$(perlwithver).a
+lib$(perlwithver).a: $(perlwithver).def
+	dlltool --dllname $(perlwithver).dll --def $(perlwithver).def --output-lib  lib$(perlwithver).a
+$(perlwithver).def:
+	pexports $(dir $(subst ',,$(PERL)))$(perlwithver).dll > $(perlwithver).def
+
+SHLIB_LINK = 
+else
 SHLIB_LINK = $(perl_embed_ldflags)
+endif
 
 REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-extension=plperl  --load-extension=plperlu
 REGRESS = plperl plperl_lc plperl_trigger plperl_shared plperl_elog plperl_util plperl_init plperlu plperl_array
@@ -105,6 +121,9 @@ submake:
 clean distclean maintainer-clean: clean-lib
 	rm -f SPI.c Util.c $(OBJS) perlchunks.h plperl_opmask.h
 	rm -rf $(pg_regress_clean_files)
+ifeq (yes, $(generate_perl_implib))
+	rm -rf	$(perlwithver).def
+endif
 
 else # can't build
 
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to