Tom Lane wrote:
>> It builds fine on AIX 5.3 as long as you tell it to link with
>> Static builds against libpq.a will fail.
> Hm.  We have been assuming that AIX's problem is that dynamic
> don't remember their dependencies properly, but maybe the real issue
> that it prefers static over dynamic libraries?  If so, what we ought
> be doing is adding the prefer-dynamic-libraries switch to the default
> LDFLAGS on that platform.

AIX shared libraries know their dependencies well, and you don't
have to specify them again when linking against the library.

Let me expand a little on some of the peculiarities of
shared libraries on AIX:

- A normal AIX shared library is called libXX.a
  It is an 'ar' archive that contains the shared object(s).
- In static linking mode, the shared object will be
  included in the executable. In dynamic linking mode
  (the default) only a reference to the shared object is
- AIX can also link against shared objects called (like other UNIXen).
- When it resolves a -lXX flag, the linker searches
  the -L list for libXX.a and
  It prefers libXX.a over unless invoked
  with the flag -brtl.

So the linker does not prefer static over dynamic libraries,
it just perfers libXX.a over

In our case, we have libpq.a and in the same directory,
so unless you link with -brtl you will get a static link
(because libpq.a is a static library).

To illustrate, let me include the output of 'ldd psql' for
a dynamically linked PostgreSQL:

8.2/bin/psql needs:


Should -brtl be added to src/template/aix?

>> Should -lldap or -lldap_r be added to pg_config --libs?
> You have a mistaken idea of the purpose of pg_config --libs.  
> It exists to record what LIBS was at build time, not more,
> not less.  It is certainly not intended as a guide to how
> to link libpq.

*nods* Thanks for the clarification.

Laurenz Albe

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not

Reply via email to