Re: Makefile breakage - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Makefile breakage
Date
Msg-id 200503250257.j2P2vsh26737@candle.pha.pa.us
Whole thread Raw
In response to Re: Makefile breakage  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Makefile breakage
List pgsql-patches
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Tom Lane wrote:
> >> You can't just arbitrarily pull in libpgport.a everywhere that libpq.so
> >> is used.  That breaks anything that requires position-independent code
> >> ... for instance ecpglib.
>
> > Strange because it worked on my BSD system and I do compile ecpg.  What
> > do you suggest?  Is this worth fixing somehow?
>
> Intel machines tend not to care whether code is officially
> position-independent or not.  Most other platforms are sticky about it.
> You don't have a choice whether to fix it.
>
> I think you should leave the $(libpq) macro alone and add a $(libpgport)
> macro ... and yes, you will have to go around and modify the client
> program Makefiles individually.

How is this?  It creates a new $(libpq_only) for library usage.
ecpglib/Makefile is the only place I saw that can use it.

--
  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/Makefile.global.in
===================================================================
RCS file: /cvsroot/pgsql/src/Makefile.global.in,v
retrieving revision 1.211
diff -c -c -r1.211 Makefile.global.in
*** src/Makefile.global.in    24 Mar 2005 23:53:48 -0000    1.211
--- src/Makefile.global.in    25 Mar 2005 02:51:45 -0000
***************
*** 306,313 ****
  libpq_builddir = $(top_builddir)/src/interfaces/libpq
  endif

! libpq = -L$(libpq_builddir) -lpq

  # If doing static linking, shared library dependency can't be
  # used so we specify pthread libs for every usage of libpq
  ifeq ($(enable_shared), no)
--- 306,327 ----
  libpq_builddir = $(top_builddir)/src/interfaces/libpq
  endif

! # Force clients to pull symbols from the non-shared library libpgport
! # rather than pulling some libpgport symbols from libpq just because
! # libpq uses those functions too.  This makes applications less
! # dependent on changes in libpq's usage of pgport.  To do this we link to
! # pgport before libpq.  This does cause duplicate -lpgport's to appear
! # on client link lines.
! ifdef PGXS
! libpq = -L$(libdir) -lpgport -L$(libpq_builddir) -lpq
! else
! libpq = -L$(top_builddir)/src/port -lpgport -L$(libpq_builddir) -lpq
! endif

+ # This is for use for libraries linking to libpq.  Because libpqport
+ # isn't created with the same link flags as libpq, it can't be used.
+ libpq_libonly = -L$(libpq_builddir) -lpq
+
  # If doing static linking, shared library dependency can't be
  # used so we specify pthread libs for every usage of libpq
  ifeq ($(enable_shared), no)
Index: src/interfaces/ecpg/compatlib/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/ecpg/compatlib/Makefile,v
retrieving revision 1.21
diff -c -c -r1.21 Makefile
*** src/interfaces/ecpg/compatlib/Makefile    14 Mar 2005 17:27:49 -0000    1.21
--- src/interfaces/ecpg/compatlib/Makefile    25 Mar 2005 02:51:48 -0000
***************
*** 20,26 ****
  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
--- 20,26 ----
  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_libonly) \
      $(filter -lintl -lssl -lcrypto -lkrb5 -lcrypt -lm, $(LIBS)) $(PTHREAD_LIBS)

  OBJS= informix.o
Index: src/interfaces/ecpg/ecpglib/Makefile
===================================================================
RCS file: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/Makefile,v
retrieving revision 1.33
diff -c -c -r1.33 Makefile
*** src/interfaces/ecpg/ecpglib/Makefile    14 Mar 2005 17:27:50 -0000    1.33
--- src/interfaces/ecpg/ecpglib/Makefile    25 Mar 2005 02:51:48 -0000
***************
*** 27,33 ****
  OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o \
      connect.o misc.o path.o exec.o

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

  ifeq ($(PORTNAME), win32)
--- 27,33 ----
  OBJS= execute.o typename.o descriptor.o data.o error.o prepare.o memory.o \
      connect.o misc.o path.o exec.o

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

  ifeq ($(PORTNAME), win32)

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Makefile breakage
Next
From: Tom Lane
Date:
Subject: Re: Makefile breakage