Discussion:
[MacPorts] #57588: postgresql10: Undefined symbols _clock_gettime
MacPorts
2018-11-12 20:24:00 UTC
Permalink
#57588: postgresql10: Undefined symbols _clock_gettime
------------------------+----------------------------
Reporter: ryandesign | Owner: jyrkiwahlstedt
Type: defect | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version:
Keywords: | Port: postgresql10
------------------------+----------------------------
postgresql10 fails to build on OS X 10.11 and earlier:

{{{
Undefined symbols for architecture x86_64:
"_clock_gettime", referenced from:
_ExplainOneQuery in explain.o
_ExplainOnePlan in explain.o
_elapsed_time in explain.o
_ExplainExecuteQuery in prepare.o
_lazy_vacuum_rel in vacuumlazy.o
_InstrStartNode in instrument.o
_InstrStopNode in instrument.o
...
ld: symbol(s) not found for architecture x86_64
}}}

`clock_gettime` was new in macOS 10.12.

Upstream should add compatibility code for earlier systems.

Until they do, you can include the legacysupport 1.0 portgroup, which will
add our compatibility implementation.

I did not check if other postgresql ports need this too. I would guess
that some others do too.
--
Ticket URL: <https://trac.macports.org/ticket/57588>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-12-08 15:09:55 UTC
Permalink
#57588: postgresql10, postgresql11: Undefined symbols _clock_gettime
-----------------------------------------+----------------------------
Reporter: ryandesign | Owner: jyrkiwahlstedt
Type: defect | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords: elcapitan
Port: postgresql10, postgresql11 |
-----------------------------------------+----------------------------
Changes (by ryandesign):

* keywords: => elcapitan
* port: postgresql10 => postgresql10, postgresql11


Comment:

I was wrong: this problem only affects 10.11. Postgresql appears to
already have a way of dealing with the lack of `clock_gettime`, but even
though it was introduced in 10.12, it thinks it is available on 10.11.

The reason for this is that the configure script uses the latest SDK, even
though we did not tell it to do that. The latest Xcode on 10.11 includes
the 10.12 SDK. The configure script gets the path of the latest SDK from
`xcodebuild` and adds it to `CPPFLAGS` in the form of an `-isysroot` flag,
which explains why the configure script detects that `clock_gettime` is
available. But it neglects to also add the SDK path to `LDFLAGS` in the
form of a `-syslibroot` flag, which is why it fails at link time.

Trying to add the legacysupport portgroup fails because of conflicting
definitions of `clock_gettime` between the legacy support headers and the
10.12 SDK's definition. But since postgresql already knows how to deal
with the lack of `clock_gettime`, we should not add this portgroup.

Probably the best solution is explain to postgresql that it should not
attempt to make its own decisions about which SDK to use, which I will
commit in a moment. MacPorts already adds `-isysroot` and `-syslibroot`
flags when required.
--
Ticket URL: <https://trac.macports.org/ticket/57588#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-12-08 15:10:42 UTC
Permalink
#57588: postgresql10, postgresql11: Undefined symbols _clock_gettime
-----------------------------------------+----------------------------
Reporter: ryandesign | Owner: jyrkiwahlstedt
Type: defect | Status: closed
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: fixed | Keywords: elcapitan
Port: postgresql10, postgresql11 |
-----------------------------------------+----------------------------
Changes (by ryandesign):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"ee193a0d097dd90d2423c1b93a934d7c1041620e/macports-ports"
ee193a0d097dd90d2423c1b93a934d7c1041620e/macports-ports] (master):
{{{
#!ConfigurableCommitTicketReference repository="macports-ports"
revision="ee193a0d097dd90d2423c1b93a934d7c1041620e"
postgresql*: Don't override MacPorts SDK choice

Closes: https://trac.macports.org/ticket/57588
}}}
--
Ticket URL: <https://trac.macports.org/ticket/57588#comment:2>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-12-08 15:45:49 UTC
Permalink
#57588: postgresql10, postgresql11: Undefined symbols _clock_gettime
-----------------------------------------+----------------------------
Reporter: ryandesign | Owner: jyrkiwahlstedt
Type: defect | Status: closed
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: fixed | Keywords: elcapitan
Port: postgresql10, postgresql11 |
-----------------------------------------+----------------------------

Comment (by kencu):

don't forget we have discovered syslibroot does absolutely nothing, with
clang toolchains on masOS, at least.

It's all isysroot, even for linking.
--
Ticket URL: <https://trac.macports.org/ticket/57588#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS
MacPorts
2018-12-08 16:01:53 UTC
Permalink
#57588: postgresql10, postgresql11: Undefined symbols _clock_gettime
-----------------------------------------+----------------------------
Reporter: ryandesign | Owner: jyrkiwahlstedt
Type: defect | Status: closed
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: fixed | Keywords: elcapitan
Port: postgresql10, postgresql11 |
-----------------------------------------+----------------------------

Comment (by ryandesign):

I know you're discussing that issue elsewhere. It's not relevant to this
ticket. The fact is Postgresql was trying to second-guess MacPorts' SDK
choice, and I've fixed it by preventing it from doing that.
--
Ticket URL: <https://trac.macports.org/ticket/57588#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS
Loading...