RE: AIX: Symbols are missing in libpq.a - Mailing list pgsql-hackers

From REIX, Tony
Subject RE: AIX: Symbols are missing in libpq.a
Date
Msg-id PR3PR02MB6396765BECC74E226B77A8CE86CB9@PR3PR02MB6396.eurprd02.prod.outlook.com
Whole thread Raw
In response to Re: AIX: Symbols are missing in libpq.a  (Noah Misch <noah@leadboat.com>)
Responses Re: AIX: Symbols are missing in libpq.a  (Noah Misch <noah@leadboat.com>)
List pgsql-hackers
Hi Noah,

Yes, trying to use the create lib$(NAME).exp from $(SHLIB_EXPORTS) when it exists was my first idea, too.
However, I do not master (or I forgot) this kind of "if...." in a Makefile and I was unable to find a solution by reading Makefile manuals or by searching for a similar example. So, I did it in an easier (to me!) and quicker way: merge with a new command line in the Makefile rule.
Now that we have a clear understanding of what is happenning, I may have a deeper look at a clean Makefile solution. However, if you know how to manage this, I would really appreciate some example. I'm asking my colleague too if he can help me here.

Thx

Tony


De : Noah Misch <noah@leadboat.com>
Envoyé : lundi 30 août 2021 16:52
À : REIX, Tony <tony.reix@atos.net>
Cc : pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Objet : Re: AIX: Symbols are missing in libpq.a
 
Caution! External email. Do not open attachments or click links, unless this email comes from a known sender and you know the content is safe.

On Mon, Aug 30, 2021 at 02:33:32PM +0000, REIX, Tony wrote:
> It appears that the Makefile in src/interfaces/libpq has been modified between v12 and v13, removing encnames.o (and wchar.o) from the object files being used for creating the static libpq.a file which is used for creating the libpq.so and libpq.a AIX shared-library files.
> And, since pg_encoding_to_char() is defined in encnames.o , it has disappeared from the libpq.exp file .
>
> # diff postgresql-12.8/32bit/src/interfaces/libpq/Makefile postgresql-13.1/32bit/src/interfaces/libpq/Makefile | grep encnames
> < OBJS += encnames.o wchar.o
> < encnames.c wchar.c: % : $(backend_src)/utils/mb/%
> <       rm -f encnames.c wchar.c
>
> Remember how the final libpq.a is built on AIX:
>
>  rm -f libpq.a
>  /usr/bin/ar crs libpq.a fe-auth-scram.o ...
>  touch libpq.a
>  ../../../src/backend/port/aix/mkldexport.sh libpq.a libpq.so.5 >libpq.exp
>  /opt/freeware/bin/gcc  -maix64    -O3 .....  -o libpq.so.5 libpq.a -Wl,-bE:libpq.exp .......
>  rm -f libpq.a
>  /usr/bin/ar crs libpq.a libpq.so.5
>
>  12.8 : /usr/bin/ar crs libpq.a fe-auth.o fe-auth-scram.o fe-connect.o fe-exec.o fe-lobj.o fe-misc.o fe-print.o fe-protocol2.o fe-protocol3.o
>                                 pqexpbuffer.o fe-secure.o legacy-pqsignal.o libpq-events.o encnames.o wchar.o fe-secure-openssl.o fe-secure-common.o
>
>  13.1 : /usr/bin/ar crs libpq.a fe-auth.o fe-auth-scram.o fe-connect.o fe-exec.o fe-lobj.o fe-misc.o fe-print.o fe-protocol2.o fe-protocol3.o
>                                 pqexpbuffer.o fe-secure.o legacy-pqsignal.o libpq-events.o                    fe-secure-common.o fe-secure-openssl.o
>
>
> Maybe you can discover why these changes were made in v13 for src/interfaces/libpq/Makefile .
> And  mkldexport.sh  , unchanged between v12 and v13, works perfectly.

Thanks; that makes sense.  Those files moved to libpgcommon_shlib.a.  The
$(MKLDEXPORT) call sees symbols in the .o files, but it doesn't see symbols
pulled in via libpg*.a.  Let's fix this by having Makefile.shlib skip
$(MKLDEXPORT) when a $(SHLIB_EXPORTS) file is available and have it instead
create lib$(NAME).exp from $(SHLIB_EXPORTS).  That's more correct than
merging, and it's simpler.  Would you like to try that?

pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: Added schema level support for publication.
Next
From: Tomas Vondra
Date:
Subject: Re: Use extended statistics to estimate (Var op Var) clauses