BUG #6732: Build issue when using gettext on FreeBSD 9

From: chris(at)chrullrich(dot)net
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #6732: Build issue when using gettext on FreeBSD 9
Date: 2012-07-12 15:25:35
Message-ID: E1SpLGp-0004cp-1w@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 6732
Logged by: Christian Ullrich
Email address: chris(at)chrullrich(dot)net
PostgreSQL version: 9.1.4
Operating system: FreeBSD 9
Description:

PostgreSQL 9.1 does not build on FreeBSD 9 if --enable-nls and a Heimdal
Kerberos build from ports is used. The build fails due to undefined
references to functions from gettext's libintl.

The reason is a combination of an oversight in PostgreSQL and the choice of
system linker in FreeBSD 9, which is GNU ld 2.17.50.

(It is nevertheless a PostgreSQL issue, not a FreeBSD one. Bear with me for
a minute.)

The PostgreSQL configure script indiscriminately enables the --as-needed
option to the linker if the linker supports it, which GNU ld 2.17.50 in
FreeBSD 9 does. It does not, however, use it in its own library checks. The
configure script therefore fails to detect libintl as required; the check
program links correctly because libintl is pulled in as an indirect
dependency via libgssapi.

There have been two relevant changes in the behavior of GNU ld since version
2.14, which was included in FreeBSD 8:

- Version 2.15 added the --as-needed flag
- Version 2.16 added the --add-needed flag (which was renamed to
--copy-dt-needed-entries in 2.21 and had its default inverted in 2.22)

With GNU ld 2.14 on FreeBSD 8, the build used to succeed because the
dependency on libintl from libgssapi was sufficient. With the first change
in behavior, the build with GNU ld 2.17 on FreeBSD 9 fails because the
configuration check picks up libintl through libgssapi, but in the failing
location (there are several, the first one to be hit is ecpg, but initdb is
affected as well) libgssapi is dropped due to --as-needed and cannot
contribute its dependency on libintl.

With the current version, GNU ld 2.22, the build works again, because the
second change in behavior allows the configure script to detect the need for
libintl, which is then used wherever required.

Proposed workaround: Do not use --as-needed at all.

Proposed fix: Use --as-needed during configure as well, or make its use
predicated on a working linker version (GNU ld 2.22 or later).

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2012-07-12 17:25:22 Re: BUG #6732: Build issue when using gettext on FreeBSD 9
Previous Message Craig Ringer 2012-07-12 00:20:51 Re: BUG #6727: Column does not exist exception has no error code