Skip to content

Commit

Permalink
Fix release builds with Clang and SCons
Browse files Browse the repository at this point in the history
The detection for when Clang is used was incorrect, resulting in GCC-only
parameter being passed to Clang.

In addition, at least on my system LTO+Clang caused linking errors even
with that fixed. As an emergency fix, I completely disabled LTO for Clang.
  • Loading branch information
jyrkive committed Feb 10, 2018
1 parent 782f68c commit a1e821f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion SConstruct
Expand Up @@ -525,7 +525,7 @@ for env in [test_env, client_env, env]:
rel_comp_flags = rel_comp_flags + env["arch"]

# PGO and LTO setup
if "gcc" in env["TOOLS"]:
if "gcc" in env["CXX"]:
if env["pgo_data"] == "generate":
rel_comp_flags = rel_comp_flags + " -fprofile-generate=pgo_data/"
rel_link_flags = "-fprofile-generate=pgo_data/"
Expand All @@ -537,6 +537,9 @@ for env in [test_env, client_env, env]:
if env["enable_lto"] == True:
rel_comp_flags = rel_comp_flags + " -flto=" + str(env["jobs"])
rel_link_flags = rel_comp_flags + " -fuse-ld=gold"
''' Disabled because LTO+Clang causes builds to fail on some systems
and LTO is enabled by default - without this, building with Clang would be impossible
for some users.
elif "clang" in env["CXX"]:
if env["pgo_data"] == "generate":
rel_comp_flags = rel_comp_flags + " -fprofile-instr-generate=pgo_data/wesnoth-%p.profraw"
Expand All @@ -549,6 +552,7 @@ for env in [test_env, client_env, env]:
if env["enable_lto"] == True:
rel_comp_flags = rel_comp_flags + " -flto=thin"
rel_link_flags = rel_comp_flags + " -fuse-ld=lld"
'''

# #
# End setting options for release build
Expand Down

0 comments on commit a1e821f

Please sign in to comment.