Re: [PATCH 1/1] Fix detection of pwritev support for OSX. - Mailing list pgsql-hackers
From | James Hilliard |
---|---|
Subject | Re: [PATCH 1/1] Fix detection of pwritev support for OSX. |
Date | |
Msg-id | CADvTj4qcwzrti9qK8E_xnoPHHn13hWqOGQC-1r3a=Y=mmGvCfQ@mail.gmail.com Whole thread Raw |
In response to | Re: [PATCH 1/1] Fix detection of pwritev support for OSX. (Tom Lane <tgl@sss.pgh.pa.us>) |
Responses |
Re: [PATCH 1/1] Fix detection of pwritev support for OSX.
|
List | pgsql-hackers |
On Tue, Jan 19, 2021 at 6:37 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: > > James Hilliard <james.hilliard1@gmail.com> writes: > > Actually, this looks path looks wrong in general, the value for > > "xcrun --sdk macosx --show-sdk-path" should take precedence over > > "xcrun --show-sdk-path" as the latter may be used for IOS potentially. > > What is "potentially"? Well I'm not sure the SDK parameter always defaults to macos although I guess it probably does as I couldn't figure out a way to change it: $ xcodebuild -showsdks iOS SDKs: iOS 14.3 -sdk iphoneos14.3 iOS Simulator SDKs: Simulator - iOS 14.3 -sdk iphonesimulator14.3 macOS SDKs: DriverKit 20.2 -sdk driverkit.macosx20.2 macOS 11.1 -sdk macosx11.1 tvOS SDKs: tvOS 14.3 -sdk appletvos14.3 tvOS Simulator SDKs: Simulator - tvOS 14.3 -sdk appletvsimulator14.3 watchOS SDKs: watchOS 7.2 -sdk watchos7.2 watchOS Simulator SDKs: Simulator - watchOS 7.2 -sdk watchsimulator7.2 > I've found no direct means to control the > SDK path at all, but so far it appears that "xcrun --show-sdk-path" > agrees with the compiler's default -isysroot path as seen in the > compiler's -v output. I suspect that this isn't coincidental, > but reflects xcrun actually being used in the compiler launch > process. If it were to flip over to using a IOS SDK, that would > mean that bare "cc" would generate nonfunctional executables, > which just about any onlooker would agree is broken. So there's some more weirdness involved here, whether or not you have the command line install seems to affect the output of the "xcrun --show-sdk-path" command, but not the "xcrun --sdk macosx --show-sdk-path" command. This is what I get without the command line tools: $ xcrun --show-sdk-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk $ xcrun --sdk macosx --show-sdk-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk this last one is just a symlink to the other path. With command line tools this is different however: $ 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 Note that the /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk is different from the normal SDK and doesn't seem to be able to generate binaries that target a 11.0 deployment target on my 10.15 system, however I am unsure if this behavior can be relied upon. So in terms of what works best, the newer normal SDK has the most flexibility as it can produce both 10.15 target binaries and 11.0 target binaries depending on the MACOSX_DEPLOYMENT_TARGET while the command line tools SDK can only produce 10.15 target binaries it would appear. Note that with my patch the binaries will always be compatible with the host system by default, even if the SDK is capable of producing binaries that are incompatible so building postgres works with and without the command line tools SDK. So I think "xcrun --sdk macosx --show-sdk-path" is probably preferable but either should work as long as we can properly detect deployment target symbol availability, regardless this SDK sysroot selection issue is effectively an entirely different issue from the feature detection not properly respecting the configured deployment target. > > I'm really not excited about trying to make the build work with > a non-native SDK as you are proposing. I think that's just going > to lead to a continuing stream of problems, because of Apple's > opinions about how cross-version compatibility should work. Well the minimum required target version is pretty much strictly based on MACOSX_DEPLOYMENT_TARGET so our feature detection still needs to use that, otherwise cross target compilation for newer or older targets will not work correctly. From my understanding the reason AC_REPLACE_FUNCS does not throw an error for deployment target incompatible functions is that it only checks if the function exists and not if it is actually useable, this is why I had to add an explicit AC_LANG_PROGRAM compile test to properly trigger a compile failure if the function is not usable for a particular deployment target version, merely checking if the function exists in the header is not sufficient. > It also seems like unnecessary complexity, because there is always > (AFAICS) a native SDK version available. We just need to find it. Best I can tell this is not true, it is some(most?) of the time but it's not something we can rely upon as systems may only contain a newer SDK, but this newer SDK is still capable of producing binaries that can run on the build host system so this shouldn't be an issue as long as we can do target feature detection properly. > > regards, tom lane
pgsql-hackers by date: