I have found a problem with libpgtcl and cases where the linking brings
in the old libpq libraries in the current installed directory, rather
than the one in the current source.

Here is the link line:

gcc2 -O2 -m486 -pipe -I../../include -I../../backend   -I/u/readline  
-g -Wall -pg -I/usr/X11R6/include -I../../interfaces/libpgtcl -o pgtclsh
pgtclAppInit.o -L../../interfaces/libpgtcl -L/usr/local/pgsql/lib -lpgtcl 
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^   ^^^^^^^^^^^^^^^^^^^^
-L../../interfaces/libpq -L/usr/local/pgsql/lib -lpq -ltcl -lm -L/u/readline 
-L/usr/contrib/lib -lcompat -lln -lipc -ldl -lm -lreadline -lhistory -ltermcap 
-lcurses

The active items are highlighted.  The link is looking to the source
libpgtcl first, then the one in the install directory.  When the libpq
link comes up, it searches the install lib directory FIRST, rather than
the one in the current source tree.

The cause is that the libpgtcl is added as a group before the libpq
stuff, and over-rides it.

Any ideas on a solution?  Someone else mentioned that perl has a problem
where you can only create it AFTER you do an install.  Any reason we are
using the install lib directory in the link?


-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)


Thu, 7 May 1998 23:53:21 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Bug in linking in old libraries
Bruce Momjian <maillist@candle.pha.pa.us> writes:
> I have found a problem with libpgtcl and cases where the linking brings
> in the old libpq libraries in the current installed directory, rather
> than the one in the current source.

This strikes me as just plain brain fade in src/bin/pgtclsh/Makefile.
Instead of 

# try to find libpgtcl.a in either directory
LIBPGTCL= -L$(SRCDIR)/interfaces/libpgtcl -L$(LIBDIR) -lpgtcl
LIBPQ= -L$(LIBPQDIR) -L$(LIBDIR) -lpq

it should just have

LIBPGTCL= -L$(SRCDIR)/interfaces/libpgtcl -lpgtcl
LIBPQ= -L$(LIBPQDIR) -lpq

There's no good reason to be referencing the library install directory,
since even if it exists it may contain an incompatible down-rev library.

On some machines there is an issue of telling the executable to look for
shared libraries in LIBDIR at run time, but that is handled by different
switches that Makefile.port supplies via LDFLAGS.

A quick grep for LIBDIR shows no indication that the same mistake has
been made anywhere else.

			regards, tom lane

Fri, 08 May 1998 11:34:53 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] Bug in linking in old libraries 
> 
> Bruce Momjian <maillist@candle.pha.pa.us> writes:
> > I have found a problem with libpgtcl and cases where the linking brings
> > in the old libpq libraries in the current installed directory, rather
> > than the one in the current source.
> 
> This strikes me as just plain brain fade in src/bin/pgtclsh/Makefile.
> Instead of 
> 
> # try to find libpgtcl.a in either directory
> LIBPGTCL= -L$(SRCDIR)/interfaces/libpgtcl -L$(LIBDIR) -lpgtcl
> LIBPQ= -L$(LIBPQDIR) -L$(LIBDIR) -lpq
> 
> it should just have
> 
> LIBPGTCL= -L$(SRCDIR)/interfaces/libpgtcl -lpgtcl
> LIBPQ= -L$(LIBPQDIR) -lpq
> 
> There's no good reason to be referencing the library install directory,
> since even if it exists it may contain an incompatible down-rev library.
> 
> On some machines there is an issue of telling the executable to look for
> shared libraries in LIBDIR at run time, but that is handled by different
> switches that Makefile.port supplies via LDFLAGS.
> 
> A quick grep for LIBDIR shows no indication that the same mistake has
> been made anywhere else.

Thanks for checking.  I will make the change.

-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

Fri, 8 May 1998 13:16:53 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] Bug in linking in old libraries