Thread: BUG #2608: dblink compile fails on AIX 5.3

BUG #2608: dblink compile fails on AIX 5.3

From
"Michael Hoffmann"
Date:
The following bug has been logged online:

Bug reference:      2608
Logged by:          Michael Hoffmann
Email address:      hoffmann@fh-trier.de
PostgreSQL version: 8.1.2
Operating system:   AIX 5.3
Description:        dblink compile fails on AIX 5.3
Details:

>/usr/local/pgsql/src/postgresql-8.1.2/contrib/dblink>gmake
../../src/backend/port/aix/mkldexport.sh libdblink.a > libdblink.exp
xlC -O2 -qmaxmem=16384 -qsrcmsg -qlonglong   -Wl,-bnoentry -Wl,-H512
-Wl,-bM:SRE -o libdblink.so libdblink.a -Wl,-bE:libdblink.exp
-L../../src/interfaces/libpq -L../../src/port -lpq
-Wl,-bI:../../src/backend/postgres.imp
ld: 0711-317 ERROR: Undefined symbol: .bindtextdomain
ld: 0711-317 ERROR: Undefined symbol: .dgettext
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
information.
gmake: *** [libdblink.so] Error 8

Re: BUG #2608: dblink compile fails on AIX 5.3

From
Chris Browne
Date:
hoffmann@fh-trier.de ("Michael Hoffmann") writes:
> The following bug has been logged online:
>
> Bug reference:      2608
> Logged by:          Michael Hoffmann
> Email address:      hoffmann@fh-trier.de
> PostgreSQL version: 8.1.2
> Operating system:   AIX 5.3
> Description:        dblink compile fails on AIX 5.3
> Details:
>
>>/usr/local/pgsql/src/postgresql-8.1.2/contrib/dblink>gmake
> ../../src/backend/port/aix/mkldexport.sh libdblink.a > libdblink.exp
> xlC -O2 -qmaxmem=16384 -qsrcmsg -qlonglong   -Wl,-bnoentry -Wl,-H512
> -Wl,-bM:SRE -o libdblink.so libdblink.a -Wl,-bE:libdblink.exp
> -L../../src/interfaces/libpq -L../../src/port -lpq
> -Wl,-bI:../../src/backend/postgres.imp
> ld: 0711-317 ERROR: Undefined symbol: .bindtextdomain
> ld: 0711-317 ERROR: Undefined symbol: .dgettext
> ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
> information.
> gmake: *** [libdblink.so] Error 8

This looks like another instance of missing libraries, akin to a
problem I'm having with compiling (AIX 5.3 with GCC 4.1.1) with
OpenSSL support.

Those objects are part of gettext, which gets linked in if you request
NLS support.

What has proven helpful to me with the OpenSSL issue is to modify
contrib/dblink/Makefile

SHLIB_LINK = $(libpq)

-- becomes -->>

SHLIB_LINK = $(libpq) $(LIBS)

You might find that helpful.

You might also try to recompile some non-contrib component, let's say
the postmaster, or psql.  See what libraries are included; adding them
to the SHLIB_LINK line may do the trick.

Tom Lane has indicated that simply adding in $(LIBS) isn't quite
right; it may draw in too many libraries.  I don't see any other
binding that is more suitable, alas.
--
output = ("cbbrowne" "@" "linuxdatabases.info")
http://www3.sympatico.ca/cbbrowne/languages.html
"No, I'm not interested in developing a powerful brain.  All I'm after
is just  a mediocre  brain, something like  the president  of American
Telephone and Telegraph Company."  -- Alan Turing on the possibilities
of a thinking machine, 1943.

Re: BUG #2608: dblink compile fails on AIX 5.3

From
Christopher Browne
Date:
In the last exciting episode, hoffmann@fh-trier.de ("Michael Hoffmann") wrote:
> The following bug has been logged online:
>
> Bug reference:      2608
> Logged by:          Michael Hoffmann
> Email address:      hoffmann@fh-trier.de
> PostgreSQL version: 8.1.2
> Operating system:   AIX 5.3
> Description:        dblink compile fails on AIX 5.3
> Details:
>
>>/usr/local/pgsql/src/postgresql-8.1.2/contrib/dblink>gmake
> ../../src/backend/port/aix/mkldexport.sh libdblink.a > libdblink.exp
> xlC -O2 -qmaxmem=16384 -qsrcmsg -qlonglong   -Wl,-bnoentry -Wl,-H512
> -Wl,-bM:SRE -o libdblink.so libdblink.a -Wl,-bE:libdblink.exp
> -L../../src/interfaces/libpq -L../../src/port -lpq
> -Wl,-bI:../../src/backend/postgres.imp
> ld: 0711-317 ERROR: Undefined symbol: .bindtextdomain
> ld: 0711-317 ERROR: Undefined symbol: .dgettext
> ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
> information.
> gmake: *** [libdblink.so] Error 8

I mentioned earlier that changing SHLIB_LINK might be helpful.

The patch that turns out to be needful for crypto is the following:

Index: Makefile
===================================================================
RCS file: /projects/cvsroot/pgsql/contrib/dblink/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- Makefile    27 Feb 2006 12:54:38 -0000    1.11
+++ Makefile    10 Sep 2006 21:01:45 -0000
@@ -20,3 +20,5 @@
 include $(top_builddir)/src/Makefile.global
 include $(top_srcdir)/contrib/contrib-global.mk
 endif
+
+SHLIB_LINK += $(filter -lssl -lcrypto -lssleay32 -leay32, $(LIBS))

In effect, we need to take LIBS, which contains all the libraries
pulled in as "defaults" for builds of objects in the main tree, filter
that against the 4 crypto libraries, and add them to the set of libs
we need to link with (e.g. - SHLIB_LINK).

I'm not sure what libraries gettext draws in; supposing it adds, to a
build of psql, -lgettext, then you might also add the line:

SHLIB_LINK += $(filter -lgettext, $(LIBS))
--
wm(X,Y):-write(X),write('@'),write(Y). wm('cbbrowne','gmail.com').
http://cbbrowne.com/info/nonrdbms.html
"In computing, invariants are ephemeral."  -- Alan Perlis

Re: BUG #2608: dblink compile fails on AIX 5.3

From
Tom Lane
Date:
Christopher Browne <cbbrowne@acm.org> writes:
> +SHLIB_LINK += $(filter -lssl -lcrypto -lssleay32 -leay32, $(LIBS))

Done, but it's really pretty ugly.  I am thinking it'd make more sense
for Makefile.global to define a macro for the libraries libpq depends
on ...

            regards, tom lane

Re: BUG #2608: dblink compile fails on AIX 5.3

From
Tom Lane
Date:
I wrote:
> Done, but it's really pretty ugly.  I am thinking it'd make more sense
> for Makefile.global to define a macro for the libraries libpq depends
> on ...

I went ahead and did this as per discussion here:
http://archives.postgresql.org/pgsql-bugs/2006-08/msg00200.php

Please see if I managed to break AIX ;-).  It'd be a good idea to
compile with every configure option you can find turned on.

            regards, tom lane

Re: BUG #2608: dblink compile fails on AIX 5.3

From
Christopher Browne
Date:
Quoth tgl@sss.pgh.pa.us (Tom Lane):
> I wrote:
>> Done, but it's really pretty ugly.  I am thinking it'd make more sense
>> for Makefile.global to define a macro for the libraries libpq depends
>> on ...
>
> I went ahead and did this as per discussion here:
> http://archives.postgresql.org/pgsql-bugs/2006-08/msg00200.php
>
> Please see if I managed to break AIX ;-).  It'd be a good idea to
> compile with every configure option you can find turned on.

A run on buildfarm member "grebe" just completed successfully, now
with openssl support, so I gotta say "thumbs up!"

I don't have gettext libraries installed, so that won't get tested
right away.  SSL is an addition I'd quite like.  The list of "nice to
try" would be gettext, ldap, Kerberos; I don't think I can promise all
those during this particular cycle, but I'd certainly be keen on
adding them, ultimately.

I also just verified that readline is playing well, too.  Sweet!
(The difficulties of AIX + readline were the initiator of a fair bit
of change to linking of libs and such, so it's particularly pleasing
that this is working fine :-))
--
"cbbrowne","@","gmail.com"
http://linuxdatabases.info/info/emacs.html
Rules  of the  Evil Overlord  #146.  "If my  surveillance reports  any
un-manned  or  seemingly  innocent  ships  found where  they  are  not
supposed to be, they will  be immediately vaporized instead of brought
in for salvage." <http://www.eviloverlord.com/>