Re: [HACKERS] HEAD doesn't cope with libraries in non-default locations - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [HACKERS] HEAD doesn't cope with libraries in non-default locations
Date
Msg-id 200507040401.j6441uV06304@candle.pha.pa.us
Whole thread Raw
Responses Re: [HACKERS] HEAD doesn't cope with libraries in non-default locations  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Tom Lane wrote:
> CVS tip fails with
>   ./configure --with-openssl \
>     --with-includes=/usr/local/ssl/include --with-libs=/usr/local/ssl/lib
>
> ...
> make[3]: Entering directory `/home/postgres/pgsql/src/interfaces/libpq'
> ...
> /usr/ccs/bin/ld +h libpq.sl.4 -b +b /home/postgres/testversion/lib  fe-auth.o fe-connect.o fe-exec.o fe-misc.o
fe-print.ofe-lobj.o fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o md5.o ip.o wchar.o encnames.o
noblock.opgstrcasecmp.o thread.o getaddrinfo.o -lssl -lcrypto  `gcc -L../../../src/port -L/usr/local/ssl/lib -Wl,-z
-Wl,+b-Wl,/home/postgres/testversion/lib -print-libgcc-file-name` -L../../../src/port -L/usr/local/ssl/lib  -o
libpq.sl.4
> /usr/ccs/bin/ld: Can't find library for -lssl
> make[3]: *** [libpq.sl.4] Error 1
>
> It appears that somebody has changed things so that the -L switches
> appear after the -l switches (ie, too late).  I'm too tired to
> investigate now, but my money is on Autoconf 2.59 being the problem ...

I wonder if it was this commit.  I am attaching the patch so you can
test to see if it fixes it.  If it does, please let us know.

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

revision 1.91
date: 2005/07/02 23:28:22;  author: momjian;  state: Exp;  lines: +2 -2
> A quick look shows that when you use --with-libraries=/foo/bar the
> generated link line for libraries says
>
>  -L/foo/bar -lpq
>
> and it should probably be the other way around (as it is for the
> executables).
>
> So I suspect we need some makefile tuning.

You were correct. This patch fixes it.

Jim C. Nasby

--
  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: Makefile.shlib
===================================================================
RCS file: /cvsroot/pgsql/src/Makefile.shlib,v
retrieving revision 1.90
retrieving revision 1.91
diff -c -c -r1.90 -r1.91
*** Makefile.shlib    20 Nov 2004 21:13:04 -0000    1.90
--- Makefile.shlib    2 Jul 2005 23:28:22 -0000    1.91
***************
*** 240,246 ****
    SHLIB_LINK        += -ltermcap -lstdc++.r4 -lbind -lsocket -L/boot/develop/lib/x86
  endif

! SHLIB_LINK := $(filter -L%, $(LDFLAGS)) $(SHLIB_LINK)
  ifeq ($(enable_rpath), yes)
  SHLIB_LINK += $(rpath)
  endif
--- 240,246 ----
    SHLIB_LINK        += -ltermcap -lstdc++.r4 -lbind -lsocket -L/boot/develop/lib/x86
  endif

! SHLIB_LINK := $(SHLIB_LINK) $(filter -L%, $(LDFLAGS))
  ifeq ($(enable_rpath), yes)
  SHLIB_LINK += $(rpath)
  endif

pgsql-patches by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: contrib/pgcrypto patch for OpenSSL 0.9.8
Next
From: Bruce Momjian
Date:
Subject: Disable page writes when fsync off, add GUC