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.
This commit is contained in:
Hein-Pieter van Braam-Stewart 2021-02-23 14:51:44 +01:00
parent e254715e79
commit 0dc368f9f9
1 changed files with 6 additions and 1 deletions

View File

@ -127,7 +127,6 @@ def configure(env):
env["CC"] = "clang" env["CC"] = "clang"
env["CXX"] = "clang++" env["CXX"] = "clang++"
env.extra_suffix = ".llvm" + env.extra_suffix env.extra_suffix = ".llvm" + env.extra_suffix
env.Append(LIBS=["atomic"])
if env["use_lld"]: if env["use_lld"]:
if env["use_llvm"]: if env["use_llvm"]:
@ -394,3 +393,9 @@ def configure(env):
# That doesn't make any sense but it's likely a Ubuntu bug? # That doesn't make any sense but it's likely a Ubuntu bug?
if is64 or env["bits"] == "64": if is64 or env["bits"] == "64":
env.Append(LINKFLAGS=["-static-libgcc", "-static-libstdc++"]) 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"])