Thread: Revert addition of -lpgport, which breaks the build on platforms that

Revert addition of -lpgport, which breaks the build on platforms that

From
tgl@svr1.postgresql.org (Tom Lane)
Date:
Log Message:
-----------
Revert addition of -lpgport, which breaks the build on platforms that
are sticky about non-PIC code in shared libraries.  Windows will have
to find another solution (probably similar to the way libpq does it).

Modified Files:
--------------
    pgsql-server/src/interfaces/ecpg/ecpglib:
        Makefile (r1.18 -> r1.19)

(http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/interfaces/ecpg/ecpglib/Makefile.diff?r1=1.18&r2=1.19)

Re: Revert addition of -lpgport, which breaks the build

From
Neil Conway
Date:
Tom Lane wrote:
> Revert addition of -lpgport, which breaks the build on platforms that
> are sticky about non-PIC code in shared libraries.  Windows will have
> to find another solution (probably similar to the way libpq does it).

I need to apply the attached patch to get ecpg to link successfully on
my machine (OSX 10.3). Is this a known issue?

-Neil
Index: src/interfaces/ecpg/ecpglib/Makefile
===================================================================
RCS file: /Users/neilc/local/cvs/pgsql-server/src/interfaces/ecpg/ecpglib/Makefile,v
retrieving revision 1.19
diff -c -r1.19 Makefile
*** src/interfaces/ecpg/ecpglib/Makefile    21 May 2004 00:14:38 -0000    1.19
--- src/interfaces/ecpg/ecpglib/Makefile    21 May 2004 00:47:23 -0000
***************
*** 23,29 ****
  OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o \
      connect.o misc.o

! SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) \
      $(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)

  all: all-lib
--- 23,29 ----
  OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o \
      connect.o misc.o

! SHLIB_LINK = -L../pgtypeslib -lpgtypes -lpgport $(libpq) \
      $(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)

  all: all-lib
Index: src/interfaces/ecpg/compatlib/Makefile
===================================================================
RCS file: /Users/neilc/local/cvs/pgsql-server/src/interfaces/ecpg/compatlib/Makefile,v
retrieving revision 1.17
diff -c -r1.17 Makefile
*** src/interfaces/ecpg/compatlib/Makefile    30 Apr 2004 04:14:05 -0000    1.17
--- src/interfaces/ecpg/compatlib/Makefile    21 May 2004 00:48:08 -0000
***************
*** 19,25 ****
  override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include -I$(libpq_srcdir) \
      -I$(top_srcdir)/src/include/utils $(CPPFLAGS)
  override CFLAGS += $(PTHREAD_CFLAGS)
! SHLIB_LINK = -L../ecpglib -lecpg -L../pgtypeslib -lpgtypes $(libpq) \
      $(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)

  OBJS= informix.o
--- 19,25 ----
  override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include -I$(libpq_srcdir) \
      -I$(top_srcdir)/src/include/utils $(CPPFLAGS)
  override CFLAGS += $(PTHREAD_CFLAGS)
! SHLIB_LINK = -L../ecpglib -lecpg -L../pgtypeslib -lpgtypes -lpgport $(libpq) \
      $(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)

  OBJS= informix.o

Re: Revert addition of -lpgport, which breaks the build

From
Bruce Momjian
Date:
I modified to code so only Win32 will do it.

---------------------------------------------------------------------------

Neil Conway wrote:
> Tom Lane wrote:
> > Revert addition of -lpgport, which breaks the build on platforms that
> > are sticky about non-PIC code in shared libraries.  Windows will have
> > to find another solution (probably similar to the way libpq does it).
>
> I need to apply the attached patch to get ecpg to link successfully on
> my machine (OSX 10.3). Is this a known issue?
>
> -Neil

> Index: src/interfaces/ecpg/ecpglib/Makefile
> ===================================================================
> RCS file: /Users/neilc/local/cvs/pgsql-server/src/interfaces/ecpg/ecpglib/Makefile,v
> retrieving revision 1.19
> diff -c -r1.19 Makefile
> *** src/interfaces/ecpg/ecpglib/Makefile    21 May 2004 00:14:38 -0000    1.19
> --- src/interfaces/ecpg/ecpglib/Makefile    21 May 2004 00:47:23 -0000
> ***************
> *** 23,29 ****
>   OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o \
>       connect.o misc.o
>
> ! SHLIB_LINK = -L../pgtypeslib -lpgtypes $(libpq) \
>       $(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)
>
>   all: all-lib
> --- 23,29 ----
>   OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o \
>       connect.o misc.o
>
> ! SHLIB_LINK = -L../pgtypeslib -lpgtypes -lpgport $(libpq) \
>       $(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)
>
>   all: all-lib
> Index: src/interfaces/ecpg/compatlib/Makefile
> ===================================================================
> RCS file: /Users/neilc/local/cvs/pgsql-server/src/interfaces/ecpg/compatlib/Makefile,v
> retrieving revision 1.17
> diff -c -r1.17 Makefile
> *** src/interfaces/ecpg/compatlib/Makefile    30 Apr 2004 04:14:05 -0000    1.17
> --- src/interfaces/ecpg/compatlib/Makefile    21 May 2004 00:48:08 -0000
> ***************
> *** 19,25 ****
>   override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include -I$(libpq_srcdir) \
>       -I$(top_srcdir)/src/include/utils $(CPPFLAGS)
>   override CFLAGS += $(PTHREAD_CFLAGS)
> ! SHLIB_LINK = -L../ecpglib -lecpg -L../pgtypeslib -lpgtypes $(libpq) \
>       $(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)
>
>   OBJS= informix.o
> --- 19,25 ----
>   override CPPFLAGS := -I$(top_srcdir)/src/interfaces/ecpg/include -I$(libpq_srcdir) \
>       -I$(top_srcdir)/src/include/utils $(CPPFLAGS)
>   override CFLAGS += $(PTHREAD_CFLAGS)
> ! SHLIB_LINK = -L../ecpglib -lecpg -L../pgtypeslib -lpgtypes -lpgport $(libpq) \
>       $(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)
>
>   OBJS= informix.o

>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Revert addition of -lpgport, which breaks the build

From
Bruce Momjian
Date:
Tom Lane wrote:
> Log Message:
> -----------
> Revert addition of -lpgport, which breaks the build on platforms that
> are sticky about non-PIC code in shared libraries.  Windows will have
> to find another solution (probably similar to the way libpq does it).
>

OK, done only for Win32.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Revert addition of -lpgport, which breaks the build

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> I modified to code so only Win32 will do it.

I think Neil's point is that it fails on OSX as well.  Really we have to
do this the way libpq does, namely pull out the specific files it needs
and recompile those with the correct shared-library-compatible CFLAGS.

            regards, tom lane

Re: Revert addition of -lpgport, which breaks the build

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > I modified to code so only Win32 will do it.
>
> I think Neil's point is that it fails on OSX as well.  Really we have to
> do this the way libpq does, namely pull out the specific files it needs
> and recompile those with the correct shared-library-compatible CFLAGS.

Oh, that one?  Yea, I see your point. I thought you meant this from
libpq:

    ifeq ($(PORTNAME), win32)
    OBJS+=win32.o
    endif

Now I realize we are making a library and has to use the same flags.

I will make the separate build change when I return on Sunday.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: Revert addition of -lpgport, which breaks the build

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Tom Lane wrote:
>> I think Neil's point is that it fails on OSX as well.  Really we have to
>> do this the way libpq does, namely pull out the specific files it needs
>> and recompile those with the correct shared-library-compatible CFLAGS.

> I will make the separate build change when I return on Sunday.

I applied the necessary changes to get OS X to build again.  Does Win32
need any more port modules besides path.c in ecpglib?

            regards, tom lane

Re: Revert addition of -lpgport, which breaks the build

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Tom Lane wrote:
> >> I think Neil's point is that it fails on OSX as well.  Really we have to
> >> do this the way libpq does, namely pull out the specific files it needs
> >> and recompile those with the correct shared-library-compatible CFLAGS.
>
> > I will make the separate build change when I return on Sunday.
>
> I applied the necessary changes to get OS X to build again.  Does Win32
> need any more port modules besides path.c in ecpglib?

I see that you didn't use $filter() like we do in libpq/Makefile.  I now
remember we have two types of files in libpgport, those that are used
only if the platform needs it, and those that are always in the library,
so they don't need filter.

I have applied the following patch to remove a few unneeded uses of
$filter().

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/bin/initdb/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/initdb/Makefile,v
retrieving revision 1.40
diff -c -c -r1.40 Makefile
*** src/bin/initdb/Makefile    19 May 2004 17:15:20 -0000    1.40
--- src/bin/initdb/Makefile    24 May 2004 00:44:41 -0000
***************
*** 15,22 ****

  override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) $(CPPFLAGS)

! OBJS=    initdb.o \
!     $(filter exec.o, $(LIBOBJS))

  all: submake-libpq submake-libpgport initdb

--- 15,21 ----

  override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) $(CPPFLAGS)

! OBJS=    initdb.o exec.o

  all: submake-libpq submake-libpgport initdb

Index: src/bin/pg_dump/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_dump/Makefile,v
retrieving revision 1.50
diff -c -c -r1.50 Makefile
*** src/bin/pg_dump/Makefile    22 May 2004 02:14:28 -0000    1.50
--- src/bin/pg_dump/Makefile    24 May 2004 00:44:41 -0000
***************
*** 18,24 ****
  OBJS=    pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o \
      pg_backup_files.o pg_backup_null.o pg_backup_tar.o \
      dumputils.o
! PG_DUMPALL_OBJS = $(filter exec.o, $(LIBOBJS))

  EXTRA_OBJS = $(top_builddir)/src/backend/parser/keywords.o

--- 18,24 ----
  OBJS=    pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o \
      pg_backup_files.o pg_backup_null.o pg_backup_tar.o \
      dumputils.o
! PG_DUMPALL_OBJS = exec.o

  EXTRA_OBJS = $(top_builddir)/src/backend/parser/keywords.o

Index: src/bin/pg_resetxlog/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_resetxlog/Makefile,v
retrieving revision 1.8
diff -c -c -r1.8 Makefile
*** src/bin/pg_resetxlog/Makefile    30 Apr 2004 20:01:39 -0000    1.8
--- src/bin/pg_resetxlog/Makefile    24 May 2004 00:44:41 -0000
***************
*** 14,21 ****

  override CPPFLAGS += -DFRONTEND

! OBJS= pg_resetxlog.o pg_crc.o \
!       $(filter dirmod.o, $(LIBOBJS))

  all: submake-libpgport pg_resetxlog

--- 14,20 ----

  override CPPFLAGS += -DFRONTEND

! OBJS= pg_resetxlog.o pg_crc.o dirmod.o

  all: submake-libpgport pg_resetxlog

Index: src/bin/psql/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/Makefile,v
retrieving revision 1.46
diff -c -c -r1.46 Makefile
*** src/bin/psql/Makefile    19 May 2004 17:15:21 -0000    1.46
--- src/bin/psql/Makefile    24 May 2004 00:44:41 -0000
***************
*** 19,26 ****

  OBJS=    command.o common.o help.o input.o stringutils.o mainloop.o copy.o \
      startup.o prompt.o variables.o large_obj.o print.o describe.o \
!     psqlscan.o tab-complete.o mbprint.o \
!     $(filter exec.o, $(LIBOBJS))

  FLEXFLAGS = -Cfe

--- 19,25 ----

  OBJS=    command.o common.o help.o input.o stringutils.o mainloop.o copy.o \
      startup.o prompt.o variables.o large_obj.o print.o describe.o \
!     psqlscan.o tab-complete.o mbprint.o exec.o

  FLEXFLAGS = -Cfe

Index: src/interfaces/ecpg/pgtypeslib/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/interfaces/ecpg/pgtypeslib/Makefile,v
retrieving revision 1.19
diff -c -c -r1.19 Makefile
*** src/interfaces/ecpg/pgtypeslib/Makefile    7 May 2004 13:42:48 -0000    1.19
--- src/interfaces/ecpg/pgtypeslib/Makefile    24 May 2004 00:44:41 -0000
***************
*** 23,29 ****
  SHLIB_LINK += -lm

  OBJS= numeric.o datetime.o common.o dt_common.o timestamp.o interval.o \
!       $(filter rint.o, $(LIBOBJS)) $(filter pgstrcasecmp.o, $(LIBOBJS))

  all: all-lib

--- 23,30 ----
  SHLIB_LINK += -lm

  OBJS= numeric.o datetime.o common.o dt_common.o timestamp.o interval.o \
!     pgstrcasecmp.o \
!     $(filter rint.o, $(LIBOBJS))

  all: all-lib

Index: src/interfaces/ecpg/preproc/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/interfaces/ecpg/preproc/Makefile,v
retrieving revision 1.106
diff -c -c -r1.106 Makefile
*** src/interfaces/ecpg/preproc/Makefile    19 May 2004 17:15:21 -0000    1.106
--- src/interfaces/ecpg/preproc/Makefile    24 May 2004 00:44:41 -0000
***************
*** 20,26 ****

  OBJS=    preproc.o type.o ecpg.o ecpg_keywords.o output.o\
      keywords.o c_keywords.o ../ecpglib/typename.o descriptor.o variable.o \
!     $(filter exec.o, $(LIBOBJS))

  all: submake-libpgport ecpg

--- 20,26 ----

  OBJS=    preproc.o type.o ecpg.o ecpg_keywords.o output.o\
      keywords.o c_keywords.o ../ecpglib/typename.o descriptor.o variable.o \
!     exec.o

  all: submake-libpgport ecpg

Index: src/interfaces/libpq/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/interfaces/libpq/Makefile,v
retrieving revision 1.108
diff -c -c -r1.108 Makefile
*** src/interfaces/libpq/Makefile    21 May 2004 20:56:49 -0000    1.108
--- src/interfaces/libpq/Makefile    24 May 2004 00:44:42 -0000
***************
*** 23,30 ****

  OBJS=    fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \
      fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o \
!     dllist.o md5.o ip.o wchar.o encnames.o \
!     $(filter crypt.o getaddrinfo.o inet_aton.o noblock.o pgstrcasecmp.o snprintf.o strerror.o open.o thread.o,
$(LIBOBJS))
  ifeq ($(PORTNAME), win32)
  OBJS+=win32.o
  endif
--- 23,30 ----

  OBJS=    fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \
      fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o \
!     dllist.o md5.o ip.o wchar.o encnames.o noblock.o pgstrcasecmp.o thread.o \
!     $(filter crypt.o getaddrinfo.o inet_aton.o open.o snprintf.o strerror.o, $(LIBOBJS))
  ifeq ($(PORTNAME), win32)
  OBJS+=win32.o
  endif