From e6216e9fcf76264cbb8698fab0c6674c874ec2a2 Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Sun, 10 Dec 2023 15:32:45 +0300 Subject: apple: disable lazy linker mode for Xcode 15 According to the ld man, this mode is deprecated; with clang 15.0.0, it is no longer possible to pass this option via compiler frontend (it treats -lazy_library flag as -l flag and tries to link to "azy_library"). Change-Id: I74a877c359ae3550d372486e055a9b4c3e9be997 Reviewed-by: Christian Kandeler --- doc/reference/modules/cpp-module.qdoc | 1 + share/qbs/modules/cpp/gcc.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/doc/reference/modules/cpp-module.qdoc b/doc/reference/modules/cpp-module.qdoc index 271787fbc..2b344aac2 100644 --- a/doc/reference/modules/cpp-module.qdoc +++ b/doc/reference/modules/cpp-module.qdoc @@ -80,6 +80,7 @@ May contain the values: "weak", "lazy", "reexport", and "upward"; refer to the Apple ld64 man page for full details. \c{undefined} uses normal linking. Currently only applies when linking for Apple platforms. + Note that \c "lazy" mode is deprecated and doesn't work with Xcode 15 and above. \endtable \section2 Relevant File Tags diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js index b60608682..82f6889e4 100644 --- a/share/qbs/modules/cpp/gcc.js +++ b/share/qbs/modules/cpp/gcc.js @@ -477,7 +477,10 @@ function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPat if (isDarwin && symbolLinkMode) { if (!["lazy", "reexport", "upward", "weak"].includes(symbolLinkMode)) throw new Error("unknown value '" + symbolLinkMode + "' for cpp.symbolLinkMode"); + } + var supportsLazyMode = Utilities.versionCompare(product.cpp.compilerVersion, "15.0.0") < 0; + if (isDarwin && symbolLinkMode && (symbolLinkMode !== "lazy" || supportsLazyMode)) { if (FileInfo.isAbsolutePath(lib) || lib.startsWith('@')) escapableLinkerFlags.push("-" + symbolLinkMode + "_library", lib); else if (dep.framework) -- cgit v1.2.3