Buildsystem: Prevent building X11/server with GCC 6+

This is due to a Godot bug which is now fixed in the master branch, but would require
too much work for a short-lived branch such as 2.1. Building release binaries with GCC 6+
will trigger segfaults due to UB when dereferencing pointers with Object::cast_to.

In theory this check should also be made for Windows cross-compilation with MinGW,
but I am more concerned about Linux distros shipping broken binaries than adventurous
cross-compilers hitting a wall.
This commit is contained in:
Rémi Verschelde 2017-08-27 11:10:37 +02:00
parent cf80fbc95c
commit a6805f37d3
2 changed files with 20 additions and 0 deletions

View file

@ -40,6 +40,16 @@ def configure(env):
env["CC"] = "clang"
env["CXX"] = "clang++"
env["LD"] = "clang++"
elif (os.system("gcc --version > /dev/null 2>&1") == 0): # GCC
# Hack to prevent building this branch with GCC 6+, which trigger segfaults due to UB when dereferencing pointers in Object::cast_to
# This is fixed in the master branch, for 2.1 we just prevent using too recent GCC versions.
import subprocess
gcc_major = subprocess.check_output(['gcc', '-dumpversion'])[0].split()[0]
if (int(gcc_major) > 5):
print("Your configured compiler appears to be GCC %s, which triggers issues in release builds for this version of Godot (fixed in Godot 3.0+)." % gcc_major)
print("You can use the Clang compiler instead with the `use_llvm=yes` option, or configure another compiler such as GCC 5 using the CC, CXX and LD flags.")
print("Aborting..")
sys.exit(255)
is64 = sys.maxsize > 2**32

View file

@ -90,6 +90,16 @@ def configure(env):
env["LD"] = "clang++"
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env.extra_suffix = ".llvm"
elif (os.system("gcc --version > /dev/null 2>&1") == 0): # GCC
# Hack to prevent building this branch with GCC 6+, which trigger segfaults due to UB when dereferencing pointers in Object::cast_to
# This is fixed in the master branch, for 2.1 we just prevent using too recent GCC versions.
import subprocess
gcc_major = subprocess.check_output(['gcc', '-dumpversion'])[0].split()[0]
if (int(gcc_major) > 5):
print("Your configured compiler appears to be GCC %s, which triggers issues in release builds for this version of Godot (fixed in Godot 3.0+)." % gcc_major)
print("You can use the Clang compiler instead with the `use_llvm=yes` option, or configure another compiler such as GCC 5 using the CC, CXX and LD flags.")
print("Aborting..")
sys.exit(255)
if (env["use_sanitizer"] == "yes"):
env.Append(CCFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer'])