summaryrefslogtreecommitdiff
path: root/xmake/modules/core
diff options
context:
space:
mode:
authorruki <[email protected]>2026-07-20 23:49:36 +0800
committerruki <[email protected]>2026-07-20 23:49:36 +0800
commit4fa600df70530a478759aaffb50cc47af235d0d8 (patch)
tree07ee24530dfbdf22f484e98495df7d2f2f92df38 /xmake/modules/core
parent64439096a06b65556fff59f3b0b4e6a439b44129 (diff)
fix clang c++_static runtimeclang
Diffstat (limited to 'xmake/modules/core')
-rw-r--r--xmake/modules/core/tools/clang.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/xmake/modules/core/tools/clang.lua b/xmake/modules/core/tools/clang.lua
index 1250d1a46..e29950e81 100644
--- a/xmake/modules/core/tools/clang.lua
+++ b/xmake/modules/core/tools/clang.lua
@@ -286,6 +286,16 @@ function nf_runtime(self, runtime, opt)
end
if runtime:endswith("_static") and _has_static_libstdcxx(self) then
maps["stdc++_static"] = table.join(maps["stdc++_static"], "-static-libstdc++")
+ -- statically link libc++. -static-libstdc++ only pulls in libc++.a, so when libc++abi
+ -- is a separate archive we link both in a group (they reference each other), otherwise
+ -- (bundled abi) fall back to -static-libstdc++.
+ -- @see https://github.com/xmake-io/xmake/issues/7656, https://github.com/xmake-io/xmake/issues/7442
+ if llvm_dirs.libcxx_static and llvm_dirs.libcxxabi_static then
+ maps["c++_static"] = table.join(maps["c++_static"], "-nostdlib++",
+ "-Wl,--start-group", llvm_dirs.libcxx_static, llvm_dirs.libcxxabi_static, "-Wl,--end-group")
+ else
+ maps["c++_static"] = table.join(maps["c++_static"], "-static-libstdc++")
+ end
end
end
end