Thread: Re: [COMMITTERS] pgsql: Remove -Wl,-undefined,dynamic_lookup in macOS build.

Re: [COMMITTERS] pgsql: Remove -Wl,-undefined,dynamic_lookup in macOS build.

From
Robert Haas
Date:
On Wed, Oct 5, 2016 at 11:04 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Remove -Wl,-undefined,dynamic_lookup in macOS build.
>
> We don't need this anymore, and it prevents build-time error checking
> that's usually good to have, so remove it.  Undoes one change of commit
> cac765820.
>
> Unfortunately, it's much harder to get a similar effect on other common
> platforms, because we don't want the linker to throw errors for symbols
> that will be resolved in the core backend.  Only macOS and AIX expect the
> core backend executable to be available while linking loadable modules,
> so only these platforms can usefully throw errors for unresolved symbols
> at link time.
>
> Discussion: <2652.1475512158@sss.pgh.pa.us>

This broke the build for me.  OS X Yosemite, 10.10.5.

$ ./configure --enable-nls --with-libraries=/opt/local/lib
--with-includes=/opt/local/include
$ make
...
gcc -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
-fwrapv -Wno-unused-command-line-argument -O2  -bundle
-multiply_defined suppress -o libpqwalreceiver.so libpqwalreceiver.o
-L../../../../src/port -L../../../../src/common -L/opt/local/lib
-Wl,-dead_strip_dylibs   -L../../../../src/interfaces/libpq -lpq
-bundle_loader ../../../../src/backend/postgres
Undefined symbols for architecture x86_64: "_libintl_gettext", referenced from:     _libpqrcv_get_conninfo in
libpqwalreceiver.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libpqwalreceiver.so] Error 1
make[1]: *** [all-backend/replication/libpqwalreceiver-recurse] Error 2
make: *** [all-src-recurse] Error 2

Without --enable-nls, or if I back up one commit, it works.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Robert Haas <robertmhaas@gmail.com> writes:
> On Wed, Oct 5, 2016 at 11:04 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Remove -Wl,-undefined,dynamic_lookup in macOS build.

> This broke the build for me.  OS X Yosemite, 10.10.5.

Hm, probably means we need an explicit reference to -lintl when
linking libpqwalreceiver.so.
        regards, tom lane



I wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> This broke the build for me.  OS X Yosemite, 10.10.5.

> Hm, probably means we need an explicit reference to -lintl when
> linking libpqwalreceiver.so.

BTW, OS X hasn't got libintl AFAICT:

# ./configure --enable-nls
...
checking for library containing bind_textdomain_codeset... no
configure: error: a gettext implementation is required for NLS

What are you using to get past that?
        regards, tom lane



Re: [COMMITTERS] pgsql: Remove -Wl,-undefined,dynamic_lookup in macOS build.

From
Robert Haas
Date:
On Fri, Oct 7, 2016 at 7:14 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I wrote:
>> Robert Haas <robertmhaas@gmail.com> writes:
>>> This broke the build for me.  OS X Yosemite, 10.10.5.
>
>> Hm, probably means we need an explicit reference to -lintl when
>> linking libpqwalreceiver.so.
>
> BTW, OS X hasn't got libintl AFAICT:
>
> # ./configure --enable-nls
> ...
> checking for library containing bind_textdomain_codeset... no
> configure: error: a gettext implementation is required for NLS
>
> What are you using to get past that?

MacPorts.

[rhaas pgsql]$ port contents gettext | grep libintl /opt/local/include/libintl.h /opt/local/lib/libintl.8.dylib
/opt/local/lib/libintl.a/opt/local/lib/libintl.dylib /opt/local/share/gettext/intl/libintl.rc
/opt/local/share/gettext/libintl.jar
[rhaas pgsql]$

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Robert Haas <robertmhaas@gmail.com> writes:
> On Fri, Oct 7, 2016 at 7:14 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> BTW, OS X hasn't got libintl AFAICT:
>> What are you using to get past that?

> MacPorts.

OK, I'll take a look.
        regards, tom lane



Re: [COMMITTERS] pgsql: Remove -Wl,-undefined,dynamic_lookup in macOS build.

From
Robert Haas
Date:
On Fri, Oct 7, 2016 at 7:58 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Fri, Oct 7, 2016 at 7:14 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> BTW, OS X hasn't got libintl AFAICT:
>>> What are you using to get past that?
>
>> MacPorts.
>
> OK, I'll take a look.

Thanks.  Everything seems OK again now.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company