perl interface bug?

Поиск
Список
Период
Сортировка
От Brook Milligan
Тема perl interface bug?
Дата
Msg-id 199810141655.KAA07356@trillium.nmsu.edu
обсуждение исходный текст
Ответы Re: [HACKERS] perl interface bug?
Список pgsql-hackers
I am having problems getting the perl interface to work (but see below
for a fix).  If I install postgresql on a bare system (i.e., one with
no previous postgresql installed), the perl interface gets installed,
but the test.pl script fails with an undefined symbol error (libpq
cannot be found).  However, if I rebuild the perl interface AFTER
postgresql (actually, I think libpq is all that is necessary here) is
installed, the test.pl script works fine.

It seems that the installation procedure should be the following:

   - build postgresql (including the perl interface)
   - install postgresql, particularly libpq
   - rebuild the perl interface
   - reinstall the perl interface

The following patches accomplish the following:

- change interfaces/Makefile to reflect the order above by doing a
  make clean in perl5 before installing the perl interface; this
  forces a rebuild after libpq has been installed.  Note that
  perl-makefile-dep is no longer required under this scheme.

- create Makefile.PL.in for perl5 so that the installed path for libpq
  (as determined by configure) can be incorporated into the ld path
  when the perl interface library is built.

- fix configure.in to create Makefile.PL from Makefile.PL.in

NOTE:  rerun autoconf

NOTE:  delete interfaces/perl5/Makefile.PL

Cheers,
Brook

===========================================================================
--- interfaces/Makefile.orig    Wed Oct  7 01:00:23 1998
+++ interfaces/Makefile    Tue Oct 13 16:29:16 1998
@@ -15,13 +15,11 @@
 include $(SRCDIR)/Makefile.global


-perl-makefile-dep :=
-ifeq ($(USE_PERL), true)
-  perl-makefile-dep := perl5/Makefile
-endif
+PERL_CLEAN := DO_NOTHING
+install: PERL_CLEAN := clean


-.DEFAULT all install clean dep depend distclean: $(perl-makefile-dep)
+.DEFAULT all install clean dep depend distclean:
     $(MAKE) -C libpq $@
     $(MAKE) -C ecpg $@
 ifeq ($(HAVE_Cplusplus), true)
@@ -33,6 +31,8 @@
     $(MAKE) -C libpgtcl $@
 endif
 ifeq ($(USE_PERL), true)
+    -$(MAKE) -C perl5 $(PERL_CLEAN)
+    $(MAKE) perl5/Makefile
     $(MAKE) -C perl5 $@
 endif
 ifeq ($(USE_ODBC), true)
===========================================================================
--- interfaces/perl5/Makefile.PL.in.orig    Mon Oct 12 16:25:23 1998
+++ interfaces/perl5/Makefile.PL.in    Mon Oct 12 16:25:00 1998
@@ -0,0 +1,68 @@
+#-------------------------------------------------------
+#
+# $Id: Makefile.PL,v 1.9 1998/09/27 19:12:21 mergl Exp $
+#
+# Copyright (c) 1997, 1998  Edmund Mergl
+#
+#-------------------------------------------------------
+
+use ExtUtils::MakeMaker;
+use Config;
+use strict;
+
+# because the perl5 interface is always contained in the source tree,
+# we can be sure about the location of the include files and libs.
+# For development and testing we still test for POSTGRES_HOME.
+#
+#print "\nConfiguring Pg\n";
+#print "Remember to actually read the README file !\n";
+#die "\nYou didn't read the README file !\n" unless ($] >= 5.002);
+#
+#if (! $ENV{POSTGRES_HOME}) {
+#    warn "\$POSTGRES_HOME not defined. Searching for PostgreSQL...\n";
+#    foreach(qw(../../../ /usr/local/pgsql /usr/pgsql /home/pgsql /opt/pgsql /usr/local/postgres /usr/postgres
/home/postgres/opt/postgres)) { 
+#        if (-d "$_/lib") {
+#            $ENV{POSTGRES_HOME} = $_;
+#            last;
+#        }
+#    }
+#}
+#
+#if (-d "$ENV{POSTGRES_HOME}/lib") {
+#    print "Found PostgreSQL in $ENV{POSTGRES_HOME}\n";
+#} else {
+#    die "Unable to determine PostgreSQL\n";
+#}
+
+my %opts;
+
+if (! $ENV{POSTGRES_HOME}) {
+
+    my $cwd = `pwd`;
+    chop $cwd;
+
+    %opts = (
+        NAME         => 'Pg',
+        VERSION_FROM => 'Pg.pm',
+        INC          => "-I$cwd/../libpq -I$cwd/../../include",
+        OBJECT       => "Pg\$(OBJ_EXT)",
+        LIBS         => ["-L@prefix@/lib -L$cwd/../libpq -lpq"],
+    );
+
+} else {
+
+    %opts = (
+        NAME         => 'Pg',
+        VERSION_FROM => 'Pg.pm',
+        INC          => "-I$ENV{POSTGRES_HOME}/include",
+        OBJECT       => "Pg\$(OBJ_EXT)",
+        LIBS         => ["-L$ENV{POSTGRES_HOME}/lib -lpq"],
+    );
+}
+
+
+WriteMakefile(%opts);
+
+exit(0);
+
+# end of Makefile.PL
===========================================================================
--- configure.in.orig    Mon Oct 12 01:00:20 1998
+++ configure.in    Mon Oct 12 16:26:35 1998
@@ -959,6 +961,7 @@
     interfaces/libpgtcl/Makefile
     interfaces/odbc/GNUmakefile
     interfaces/odbc/Makefile.global
+    interfaces/perl5/Makefile.PL
     pl/plpgsql/src/Makefile
     pl/plpgsql/src/mklang.sql
     pl/tcl/mkMakefile.tcldefs.sh

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Terry Mackintosh
Дата:
Сообщение: Re: [HACKERS] What about LIMIT in SELECT ?
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] PostgreSQL v6.4 BETA2 ...