On 07/12/2015 05:06 PM, Tom Lane wrote:
Andrew Dunstan <and...@dunslane.net> writes:
On 07/04/2015 11:02 AM, Tom Lane wrote:
It's not apparent to me how that works at all.
BTW, the .a files being linked to above are not like Unix .a static
archives - they are import library files, which I think they are only
used at link time, not run time. The path to the DLLs isn't being hardcoded.
Ah, I see.  So then what Marco is suggesting is copying a coding pattern
that does work.

Unless there is further argument I propose to commit something very like
Marco's suggestion for hstore_plperl, hstore_plpython and ltree_plpython
No objection here.

                        

OK, I tried the attached patch.

but when trying to build with python 3 I get this (no such problems with python2, which builds and tests fine):

   make -C hstore_plpython all
   make[1]: Entering directory
   '/home/andrew/bf64/root/HEAD/pgsql/contrib/hstore_plpython'
   ccache gcc -Wall -Wmissing-prototypes -Wpointer-arith
   -Wdeclaration-after-statement -Wendif-labels
   -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
   -fwrapv -fexcess-precision=standard -g -O2 -I../../src/pl/plpython
   -I/usr/include/python3.4m -I../../contrib/hstore -I. -I.
   -I../../src/include -I/usr/include/libxml2   -c -o hstore_plpython.o
   hstore_plpython.c
   ccache gcc -Wall -Wmissing-prototypes -Wpointer-arith
   -Wdeclaration-after-statement -Wendif-labels
   -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
   -fwrapv -fexcess-precision=standard -g -O2   -shared -o
   hstore_plpython3.dll  hstore_plpython.o  -L../../src/port
   -L../../src/common -Wl,--allow-multiple-definition
   -Wl,--enable-auto-import -L/usr/lib  -L/usr/local/lib
   -Wl,--as-needed   -L../../src/backend -lpostgres -L../hstore
   -lhstore -L../../src/pl/plpython -lplpython3
   -L/usr/lib/python3.4/config-3.4m -lpython3.4m -lpgcommon -lpgport
   -lxslt -lxml2 -lssl -lcrypto -lz -lreadline -lcrypt
   hstore_plpython.o: In function `hstore_to_plpython':
   
/home/andrew/bf64/root/HEAD/pgsql/contrib/hstore_plpython/hstore_plpython.c:35:
   undefined reference to `PLyUnicode_FromStringAndSize'
   
/home/andrew/bf64/root/HEAD/pgsql/contrib/hstore_plpython/hstore_plpython.c:35:(.text+0x99):
   relocation truncated to fit: R_X86_64_PC32 against undefined symbol
   `PLyUnicode_FromStringAndSize'
   
/home/andrew/bf64/root/HEAD/pgsql/contrib/hstore_plpython/hstore_plpython.c:28:
   undefined reference to `PLyUnicode_FromStringAndSize'
   
/home/andrew/bf64/root/HEAD/pgsql/contrib/hstore_plpython/hstore_plpython.c:28:(.text+0xf1):
   relocation truncated to fit: R_X86_64_PC32 against undefined symbol
   `PLyUnicode_FromStringAndSize'
   hstore_plpython.o: In function `plpython_to_hstore':
   
/home/andrew/bf64/root/HEAD/pgsql/contrib/hstore_plpython/hstore_plpython.c:96:
   undefined reference to `PLyObject_AsString'
   
/home/andrew/bf64/root/HEAD/pgsql/contrib/hstore_plpython/hstore_plpython.c:96:(.text+0x2cc):
   relocation truncated to fit: R_X86_64_PC32 against undefined symbol
   `PLyObject_AsString'
   
/home/andrew/bf64/root/HEAD/pgsql/contrib/hstore_plpython/hstore_plpython.c:84:
   undefined reference to `PLyObject_AsString'
   
/home/andrew/bf64/root/HEAD/pgsql/contrib/hstore_plpython/hstore_plpython.c:84:(.text+0x321):
   relocation truncated to fit: R_X86_64_PC32 against undefined symbol
   `PLyObject_AsString'
   collect2: error: ld returned 1 exit status
   ../../src/Makefile.shlib:358: recipe for target
   'hstore_plpython3.dll' failed
   make[1]: *** [hstore_plpython3.dll] Error 1
   make[1]: Leaving directory
   '/home/andrew/bf64/root/HEAD/pgsql/contrib/hstore_plpython'
   Makefile:92: recipe for target 'all-hstore_plpython-recurse' failed
   make: *** [all-hstore_plpython-recurse] Error 2

I'd like to get that fixed before applying anything. Marco, any ideas?

To build with python 3, set the environment like this: PYTHON=/usr/bin/python3 - this can be done in the config file.


cheers

andrew

diff --git a/contrib/hstore_plperl/Makefile b/contrib/hstore_plperl/Makefile
index 19a8ab4..603ef52 100644
--- a/contrib/hstore_plperl/Makefile
+++ b/contrib/hstore_plperl/Makefile
@@ -30,6 +30,10 @@ override CPPFLAGS += -DPLPERL_HAVE_UID_GID -Wno-comment
 SHLIB_LINK += ../hstore/libhstore.a $(wildcard ../../src/pl/plperl/libperl*.a)
 endif
 
+ifeq ($(PORTNAME), cygwin)
+SHLIB_LINK += -L../hstore -l hstore $(perl_embed_ldflags)
+endif
+
 # As with plperl we need to make sure that the CORE directory is included
 # last, probably because it sometimes contains some header files with names
 # that clash with some of ours, or with some that we include, notably on
diff --git a/contrib/hstore_plpython/Makefile b/contrib/hstore_plpython/Makefile
index 6ee434b..dfff0fd 100644
--- a/contrib/hstore_plpython/Makefile
+++ b/contrib/hstore_plpython/Makefile
@@ -28,6 +28,12 @@ ifeq ($(PORTNAME), win32)
 SHLIB_LINK += ../hstore/libhstore.a $(wildcard ../../src/pl/plpython/libpython*.a) $(wildcard ../../src/pl/plpython/libplpython*.a)
 endif
 
+ifeq ($(PORTNAME), cygwin)
+SHLIB_LINK += -L../hstore -lhstore -L../../src/pl/plpython \
+	-lplpython$(python_majorversion) $(python_libspec)
+endif
+
+
 REGRESS_OPTS += --load-extension=hstore
 ifeq ($(python_majorversion),2)
 REGRESS_OPTS += --load-extension=plpythonu --load-extension=hstore_plpythonu
diff --git a/contrib/ltree_plpython/Makefile b/contrib/ltree_plpython/Makefile
index 64ca127..423e302 100644
--- a/contrib/ltree_plpython/Makefile
+++ b/contrib/ltree_plpython/Makefile
@@ -28,6 +28,11 @@ ifeq ($(PORTNAME), win32)
 SHLIB_LINK += $(wildcard ../../src/pl/plpython/libpython*.a)
 endif
 
+ifeq ($(PORTNAME), cygwin)
+SHLIB_LINK += -L../ltree -lltree -L../../src/pl/plpython \
+	-lplpython$(python_majorversion) $(python_libspec)
+endif
+
 REGRESS_OPTS += --load-extension=ltree
 ifeq ($(python_majorversion),2)
 REGRESS_OPTS += --load-extension=plpythonu --load-extension=ltree_plpythonu
-- 
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