From 95eabdfd5f6197c83e9e5f53ddb65dbbea3c13fd Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 22 Jul 2020 10:54:11 -0500 Subject: [PATCH] xcode/sdk-pkgs.nix: set -platform_version in addition to -miphoneos-version-min MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The App Store looks at LC_VERSION_MIN_IPHONEOS to verify you have a new enough SDK version. This is not just the minimum version, but also the sdk version used. When the linker can’t figure it out, it tries to infer it from the sdk path[1]. When no sdk version is found, it defaults to just using the -miphoneos-version-min value[2]. So, to make sure we don’t rely on inference (which doesn’t work in the current directory structure), we have to specify -platform_version. [1]: https://github.com/tpoechtrager/cctools-port/blob/43f32a4c61b5ba7fde011e816136c550b1b3146f/cctools/ld64/src/ld/Options.cpp#L5355-L5376 [2]: https://github.com/tpoechtrager/cctools-port/blob/43f32a4c61b5ba7fde011e816136c550b1b3146f/cctools/ld64/src/ld/ld.hpp#L58 --- pkgs/os-specific/darwin/xcode/sdk-pkgs.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix b/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix index e8302a82555..45e1f1eab4f 100644 --- a/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix +++ b/pkgs/os-specific/darwin/xcode/sdk-pkgs.nix @@ -12,7 +12,7 @@ let -minSdkVersion = "9.0"; +minSdkVersion = targetPlatform.minSdkVersion or "9.0"; iosPlatformArch = { parsed, ... }: { armv7a = "armv7"; @@ -37,6 +37,10 @@ rec { bintools = binutils-unwrapped; extraBuildCommands = '' echo "-arch ${iosPlatformArch targetPlatform}" >> $out/nix-support/libc-ldflags + '' + stdenv.lib.optionalString (sdk.platform == "iPhoneSimulator") '' + echo "-platform_version ios-sim ${minSdkVersion} ${sdk.version}" >> $out/nix-support/libc-ldflags + '' + stdenv.lib.optionalString (sdk.platform == "iPhoneOS") '' + echo "-platform_version ios ${minSdkVersion} ${sdk.version}" >> $out/nix-support/libc-ldflags ''; };