Why can't I use pgxs to build a plpgsql plugin?
Hi,
I recently wrote a plpgsql plugin. I wanted to enable the use of pgxs,
to make it easier to compile the plugin, but I eventually found that I
can't do that because the plpgsql.h file is not available in the include
directory.
I'm wondering if we shouldn't put the header files of plpgsql source
code in the include directory. It would help compiling the PL/pgsql
debugger, and profiler (and of course my own plugin).
There could be a good reason which would explain why we can't (or don't
want to) do this, but I don't see it right now.
Thanks.
Regards.
--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com
On 08.04.2012 11:59, Guillaume Lelarge wrote:
Hi,
I recently wrote a plpgsql plugin. I wanted to enable the use of pgxs,
to make it easier to compile the plugin, but I eventually found that I
can't do that because the plpgsql.h file is not available in the include
directory.I'm wondering if we shouldn't put the header files of plpgsql source
code in the include directory. It would help compiling the PL/pgsql
debugger, and profiler (and of course my own plugin).
Yep, I just bumped into this myself, while trying to make pldebugger
module compilable with pgxs.
There could be a good reason which would explain why we can't (or don't
want to) do this, but I don't see it right now.
Me neither, except a general desire to keep internals hidden. I propose
the attached.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
Attachments:
install-plpgsql-header-file-1.patchtext/x-diff; name=install-plpgsql-header-file-1.patchDownload
diff --git a/src/pl/plpgsql/src/Makefile b/src/pl/plpgsql/src/Makefile
index 751a98d..f21d28e 100644
--- a/src/pl/plpgsql/src/Makefile
+++ b/src/pl/plpgsql/src/Makefile
@@ -27,19 +27,26 @@ all: all-lib
include $(top_srcdir)/src/Makefile.shlib
-install: all install-lib install-data
+install: all install-lib install-data install-headers
installdirs: installdirs-lib
$(MKDIR_P) '$(DESTDIR)$(datadir)/extension'
-uninstall: uninstall-lib uninstall-data
+uninstall: uninstall-lib uninstall-data uninstall-headers
install-data: installdirs
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA)) '$(DESTDIR)$(datadir)/extension/'
+# The plpgsql.h header file is needed by instrumentation plugins
+install-headers: installdirs
+ $(INSTALL_DATA) '$(srcdir)/plpgsql.h' '$(DESTDIR)$(includedir_server)'
+
uninstall-data:
rm -f $(addprefix '$(DESTDIR)$(datadir)/extension'/, $(notdir $(DATA)))
+uninstall-headers:
+ rm -f '$(DESTDIR)$(includedir_server)/plpgsql.h'
+
.PHONY: install-data uninstall-data
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
On 08.04.2012 11:59, Guillaume Lelarge wrote:
There could be a good reason which would explain why we can't (or don't
want to) do this, but I don't see it right now.
Me neither, except a general desire to keep internals hidden. I propose
the attached.
Shouldn't the new targets be marked .PHONY?
regards, tom lane
On 12.04.2012 16:59, Tom Lane wrote:
Heikki Linnakangas<heikki.linnakangas@enterprisedb.com> writes:
On 08.04.2012 11:59, Guillaume Lelarge wrote:
There could be a good reason which would explain why we can't (or don't
want to) do this, but I don't see it right now.Me neither, except a general desire to keep internals hidden. I propose
the attached.Shouldn't the new targets be marked .PHONY?
Umm ... <me reads up on what .PHONY means> ... yes, yes they should.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
On Thu, 2012-04-12 at 12:28 +0300, Heikki Linnakangas wrote:
On 08.04.2012 11:59, Guillaume Lelarge wrote:
Hi,
I recently wrote a plpgsql plugin. I wanted to enable the use of pgxs,
to make it easier to compile the plugin, but I eventually found that I
can't do that because the plpgsql.h file is not available in the include
directory.I'm wondering if we shouldn't put the header files of plpgsql source
code in the include directory. It would help compiling the PL/pgsql
debugger, and profiler (and of course my own plugin).Yep, I just bumped into this myself, while trying to make pldebugger
module compilable with pgxs.There could be a good reason which would explain why we can't (or don't
want to) do this, but I don't see it right now.Me neither, except a general desire to keep internals hidden. I propose
the attached.
Sounds good to me. I would love to see this happening in 9.2.
Thanks, Heikki.
--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com
On 13.04.2012 19:17, Guillaume Lelarge wrote:
On Thu, 2012-04-12 at 12:28 +0300, Heikki Linnakangas wrote:
On 08.04.2012 11:59, Guillaume Lelarge wrote:
There could be a good reason which would explain why we can't (or don't
want to) do this, but I don't see it right now.Me neither, except a general desire to keep internals hidden. I propose
the attached.Sounds good to me. I would love to see this happening in 9.2.
Ok, committed. I fixed the .PHONY line as Tom pointed out, and changed
MSVC install.pm to also copy the header file.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
On Mon, 2012-04-16 at 13:09 +0300, Heikki Linnakangas wrote:
On 13.04.2012 19:17, Guillaume Lelarge wrote:
On Thu, 2012-04-12 at 12:28 +0300, Heikki Linnakangas wrote:
On 08.04.2012 11:59, Guillaume Lelarge wrote:
There could be a good reason which would explain why we can't (or don't
want to) do this, but I don't see it right now.Me neither, except a general desire to keep internals hidden. I propose
the attached.Sounds good to me. I would love to see this happening in 9.2.
Ok, committed. I fixed the .PHONY line as Tom pointed out, and changed
MSVC install.pm to also copy the header file.
Thanks.
--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com
2012/4/16 Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>:
On 13.04.2012 19:17, Guillaume Lelarge wrote:
On Thu, 2012-04-12 at 12:28 +0300, Heikki Linnakangas wrote:
On 08.04.2012 11:59, Guillaume Lelarge wrote:
There could be a good reason which would explain why we can't (or don't
want to) do this, but I don't see it right now.Me neither, except a general desire to keep internals hidden. I propose
the attached.Sounds good to me. I would love to see this happening in 9.2.
Ok, committed. I fixed the .PHONY line as Tom pointed out, and changed MSVC
install.pm to also copy the header file.
Hello,
it doesn't work for modules from contrib directory
pavel ~/src/postgresql/contrib/check_plpgsql $ make
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
-fwrapv -fexcess-precision=standard -g -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o check_plpgsql.o
check_plpgsql.c
check_plpgsql.c:16:21: fatal error: plpgsql.h: No such file or directory
compilation terminated.
Regards
Pavel
Show quoted text
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 17.04.2012 07:56, Pavel Stehule wrote:
2012/4/16 Heikki Linnakangas<heikki.linnakangas@enterprisedb.com>:
Ok, committed. I fixed the .PHONY line as Tom pointed out, and changed MSVC
install.pm to also copy the header file.Hello,
it doesn't work for modules from contrib directory
pavel ~/src/postgresql/contrib/check_plpgsql $ make
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
-fwrapv -fexcess-precision=standard -g -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o check_plpgsql.o
check_plpgsql.c
check_plpgsql.c:16:21: fatal error: plpgsql.h: No such file or directory
compilation terminated.
Hmm, the makefile rule I added copies the plpgsql.h file to
include/server directory when you do "make install". That makes the file
available when you build with USE_PGXS=1, without access to the source
tree, but doesn't change the situation when you build inside contrib.
If you plop the module directly to contrib, I guess you'll have to do
CFLAGS += -I$(top_srcdir)/src/pl/plpgsql/src
That's what pldebugger has always done.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
2012/4/17 Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>:
On 17.04.2012 07:56, Pavel Stehule wrote:
2012/4/16 Heikki Linnakangas<heikki.linnakangas@enterprisedb.com>:
Ok, committed. I fixed the .PHONY line as Tom pointed out, and changed
MSVC
install.pm to also copy the header file.Hello,
it doesn't work for modules from contrib directory
pavel ~/src/postgresql/contrib/check_plpgsql $ make
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
-fwrapv -fexcess-precision=standard -g -fpic -I. -I.
-I../../src/include -D_GNU_SOURCE -c -o check_plpgsql.o
check_plpgsql.c
check_plpgsql.c:16:21: fatal error: plpgsql.h: No such file or directory
compilation terminated.Hmm, the makefile rule I added copies the plpgsql.h file to include/server
directory when you do "make install". That makes the file available when you
build with USE_PGXS=1, without access to the source tree, but doesn't change
the situation when you build inside contrib.If you plop the module directly to contrib, I guess you'll have to do
CFLAGS += -I$(top_srcdir)/src/pl/plpgsql/src
That's what pldebugger has always done.
ook, thank you
Pavel
Show quoted text
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com