Re: [PATCH 1/1] Fix detection of pwritev support for OSX.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: James Hilliard <james(dot)hilliard1(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Sergey Shinderuk <s(dot)shinderuk(at)postgrespro(dot)ru>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: [PATCH 1/1] Fix detection of pwritev support for OSX.
Date: 2021-01-19 17:17:16
Message-ID: 483800.1611076636@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

James Hilliard <james(dot)hilliard1(at)gmail(dot)com> writes:
> On Tue, Jan 19, 2021 at 8:57 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> It worked for me and for Sergey, so we need to figure out what's different
>> about your setup. What do you get from "xcrun --show-sdk-path" and
>> "xcrun --sdk macosx --show-sdk-path"? What have you got under
>> /Library/Developer/CommandLineTools/SDKs ?

> $ xcrun --show-sdk-path
> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
> $ xcrun --sdk macosx --show-sdk-path
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk
> $ ls -laht /Library/Developer/CommandLineTools/SDKs
> total 0
> drwxr-xr-x 5 root wheel 160B Jan 14 2020 .
> drwxr-xr-x 8 root wheel 256B Jan 14 2020 MacOSX10.15.sdk
> drwxr-xr-x 7 root wheel 224B Jan 14 2020 MacOSX10.14.sdk
> lrwxr-xr-x 1 root wheel 15B Jan 14 2020 MacOSX.sdk -> MacOSX10.15.sdk

Ah, got it. So "xcrun --show-sdk-path" tells us the right thing (that
is, it *does* give us a symlink to a 10.15 SDK) but by refusing to
believe we've got the right thing, we end up picking MacOSX11.1.sdk.
Drat. I suppose we could drop the heuristic about wanting a version
number in the SDK path, but I really don't want to do that. Now I'm
thinking about trying to dereference the symlink after the first step.

BTW, it's curious that you get a reference to the MacOSX.sdk symlink
where both Sergey and I got references to the actual directory.
Do you happen to recall the order in which you installed/upgraded
Xcode and its command line tools?

>> I don't think I believe that argument. As a counterexample, supposing
>> that somebody were intentionally cross-compiling on an older OSX platform
>> but using a newer SDK, shouldn't they get an executable suited to the
>> SDK's target version?

> Yep, that's exactly what this should fix:
> MACOSX_DEPLOYMENT_TARGET=11.0 ./configure
> checking for pwritev... yes
> Which fails at runtime on 10.15:

Well yeah, exactly. It should fail at run-time, because you
cross-compiled an executable that's not built for the machine
you're on. What we need is to prevent configure from setting up
a cross-compile situation by default.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Rofail 2021-01-19 17:25:00 Re: Add primary keys to system catalogs
Previous Message Greg Sabino Mullane 2021-01-19 16:58:27 Re: psql \df choose functions by their arguments