From 5f71fad6b6ba7ad69c8021350f62a9cd72a85656 Mon Sep 17 00:00:00 2001 From: Hein-Pieter van Braam-Stewart Date: Tue, 23 Feb 2021 14:48:51 +0100 Subject: [PATCH] Allow static linking with libatomic using clang When using use_static_cpp we want to statically link with atomic as well to make sure we don't incur any new runtime dependencies. Scons doesn't quite support this so we do this little trick. --- platform/x11/detect.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/x11/detect.py b/platform/x11/detect.py index c2a544d5df7..3f63c6538dd 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -129,7 +129,6 @@ def configure(env): env["CC"] = "clang" env["CXX"] = "clang++" env.extra_suffix = ".llvm" + env.extra_suffix - env.Append(LIBS=["atomic"]) if env["use_lld"]: if env["use_llvm"]: @@ -382,3 +381,9 @@ def configure(env): # That doesn't make any sense but it's likely a Ubuntu bug? if is64 or env["bits"] == "64": env.Append(LINKFLAGS=["-static-libgcc", "-static-libstdc++"]) + if env["use_llvm"]: + env["LINKCOM"] = env["LINKCOM"] + " -l:libatomic.a" + + else: + if env["use_llvm"]: + env.Append(LIBS=["atomic"])