xcbuild: suppress warnings for unknown keys

Newer SDKs have keys that xcbuild doesn’t recognize. These warnings
generate a lot of noise, especially when `xcrun` is used in an
interactive session, so suppress them.
This commit is contained in:
Randy Eckenrode 2024-11-03 12:11:35 -05:00
parent c8df66973b
commit 7ae8a1e519
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9
3 changed files with 28 additions and 47 deletions

View File

@ -82,6 +82,8 @@ stdenv.mkDerivation (finalAttrs: {
./patches/includes.patch
# Prevent xcrun from recursively invoking itself but still find native toolchain binaries
./patches/Use-system-toolchain-for-usr-bin.patch
# Suppress warnings due to newer SDKs with unknown keys
./patches/Suppress-unknown-key-warnings.patch
];
prePatch = ''

View File

@ -1,47 +0,0 @@
diff --git a/Libraries/xcsdk/Tools/xcrun.cpp b/Libraries/xcsdk/Tools/xcrun.cpp
index 9d6d4576d7..7400267c2b 100644
--- a/Libraries/xcsdk/Tools/xcrun.cpp
+++ b/Libraries/xcsdk/Tools/xcrun.cpp
@@ -23,6 +23,8 @@
#include <process/DefaultUser.h>
#include <pbxsetting/Type.h>
+#include <algorithm>
+
using libutil::DefaultFilesystem;
using libutil::Filesystem;
using libutil::FSUtil;
@@ -398,6 +400,8 @@
fprintf(stderr, "\n");
}
+ std::unordered_map<std::string, std::string> environment = processContext->environmentVariables();
+
/*
* Collect search paths for the tool.
* Can be in toolchains, target (if one is provided), developer root,
@@ -408,6 +412,15 @@
executablePaths.insert(executablePaths.end(), defaultExecutablePaths.begin(), defaultExecutablePaths.end());
/*
+ * Dont look for tools in `/usr/bin` because it can cause an infinite recursion when `xcrun` finds a shim
+ * that tries to invoke `xcrun` to run the tool.
+ */
+ executablePaths.erase(
+ std::remove(executablePaths.begin(), executablePaths.end(), "/usr/bin"),
+ executablePaths.end()
+ );
+
+ /*
* Find the tool to execute.
*/
ext::optional<std::string> executable = filesystem->findExecutable(*options.tool(), executablePaths);
@@ -428,8 +441,6 @@
} else {
/* Run is the default. */
- std::unordered_map<std::string, std::string> environment = processContext->environmentVariables();
-
if (target != nullptr) {
/*
* Update effective environment to include the target path.

View File

@ -0,0 +1,26 @@
diff --git a/Libraries/xcsdk/Sources/SDK/Product.cpp b/Libraries/xcsdk/Sources/SDK/Product.cpp
index f291d475c7..bc339f567c 100644
--- a/Libraries/xcsdk/Sources/SDK/Product.cpp
+++ b/Libraries/xcsdk/Sources/SDK/Product.cpp
@@ -33,7 +33,7 @@
auto PBV = unpack.cast <plist::String> ("ProductBuildVersion");
auto PC = unpack.cast <plist::String> ("ProductCopyright");
- if (!unpack.complete(true)) {
+ if (!unpack.complete(false)) {
fprintf(stderr, "%s", unpack.errorText().c_str());
}
diff --git a/Libraries/xcsdk/Sources/SDK/Target.cpp b/Libraries/xcsdk/Sources/SDK/Target.cpp
index 523c1e4cbd..2197b1d6d1 100644
--- a/Libraries/xcsdk/Sources/SDK/Target.cpp
+++ b/Libraries/xcsdk/Sources/SDK/Target.cpp
@@ -86,7 +86,7 @@
/* Ignored: seems to be a typo. */
(void)unpack.cast <plist::String> ("isBaseSDK");
- if (!unpack.complete(true)) {
+ if (!unpack.complete(false)) {
fprintf(stderr, "%s", unpack.errorText().c_str());
}