Skip to content

Commit

Permalink
Statically link libgcc and libstdc++ on Linux.
Browse files Browse the repository at this point in the history
More compatibility at the cost of bigger binaries.
  • Loading branch information
Faless committed Jun 29, 2023
1 parent ed3771c commit 1de32aa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit 1de32aa

Please sign in to comment.