From 1de32aa9ea1f3f4e1fd3f5f9b283ac4dc2befae1 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Thu, 29 Jun 2023 13:34:20 +0200 Subject: Statically link libgcc and libstdc++ on Linux. More compatibility at the cost of bigger binaries. --- SConstruct | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/SConstruct b/SConstruct index dfd237f..8118948 100644 --- a/SConstruct +++ b/SConstruct @@ -118,6 +118,18 @@ if env["platform"] == "macos" and os.environ.get("OSXCROSS_ROOT", ""): if env["macos_deployment_target"] != "default": env["ENV"]["MACOSX_DEPLOYMENT_TARGET"] = env["macos_deployment_target"] +# Patch linux flags to statically link libgcc and libstdc++ +if env["platform"] == "linux": + env.Append( + LINKFLAGS=[ + "-Wl,--no-undefined", + "-static-libgcc", + "-static-libstdc++", + ] + ) + # And add some linux dependencies. + env.Append(LIBS=["pthread", "dl"]) + opts.Update(env) target = env["target"] -- cgit v1.2.3