Re: 64bit initdb failure on macOS 10.11 and 10.12

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: rjhb(at)bb-c(dot)de (Rainer J(dot)H(dot) Brandt)
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: 64bit initdb failure on macOS 10.11 and 10.12
Date: 2017-07-05 16:02:27
Message-ID: 21800.1499270547@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

rjhb(at)bb-c(dot)de (Rainer J.H. Brandt) writes:
> Tom Lane writes:
>> The whole thing's odd though --- certainly many people are building
>> PG successfully on macOS. There's got to be something unusual about
>> Rainer's build environment, but what?

> I thought so, too, but I'm beginning to doubt it. I'm now down to

> ./configure --prefix=/opt/bb/170705

> and the initdb failure is the same. The build machine is a few months old
> and has current OS and Xcode, and certainly no other build tools or other
> relevant stuff. I have no special environment variables set.

Hmph. I confess bafflement --- it works fine for me on curremt macOS.

After reading the clang & ld man pages for a bit I wondered if I could
reproduce the problem by adding -flto to the compiler switches. I was
right that that causes "unused" functions to get stripped out of the
postgres executable, but then you get a pile of failures when these
libraries get built:

undef: _pg_mic2ascii
undef: _check_encoding_conversion_args
undef: _pg_ascii2mic
Undefined symbols for architecture x86_64:
"_pg_mic2ascii", referenced from:
_mic_to_ascii in lto.o
"_check_encoding_conversion_args", referenced from:
_ascii_to_mic in lto.o
_mic_to_ascii in lto.o
"_pg_ascii2mic", referenced from:
_ascii_to_mic in lto.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[3]: *** [ascii_and_mic.so] Error 1

Given that macOS's linker checks the resolvability of such symbols at
dylib build time, I really don't see how you could get through the
build successfully and then have a failure at run time. It's weird.

Lacking any better ideas to offer, I can only suggest that maybe
removing/reinstalling Xcode would help. (Hm, are you sure you've
installed Xcode's command line tools? Try
xcode-select --install
to be sure.)

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message PAWAN SHARMA 2017-07-05 16:26:11 Re: [SPAM] How to install pgadmin3 or pgadmin4 on linux machine
Previous Message Stephen Frost 2017-07-05 16:01:21 Re: pg_start/stop_backup non-exclusive scripts to snapshot