From bad7a8a6572ec052d171f36fe73c18e50d224416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 16 Feb 2018 18:24:46 +0100 Subject: [PATCH] X11: Link libgcc statically with use_static_cpp option We were already linking libstdc++ statically for official binaries, protecting us against most portability issues. But apparently since we started using GCC 7 for official builds, we also need to link libgcc statically for at least 32-bit builds to be portable. Fixes #16409. (cherry picked from commit b526088ae217de959cd395f5a74baf87552e0bbf) --- platform/x11/detect.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 904fd862a82..bee78fd661d 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -52,7 +52,7 @@ def get_opts(): return [ ('use_llvm', 'Use llvm compiler', 'no'), - ('use_static_cpp', 'link stdc++ statically', 'no'), + ('use_static_cpp', 'Link libgcc and libstdc++ statically for better portability', 'no'), ('use_sanitizer', 'Use llvm compiler sanitize address', 'no'), ('use_leak_sanitizer', 'Use llvm compiler sanitize memory leaks', 'no'), ('use_lto', 'Use link time optimization', 'no'), @@ -254,8 +254,9 @@ def configure(env): env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.gen.h', src_suffix='.glsl')}) #env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.gen.h',src_suffix = '.hlsl') } ) + # Link those statically for portability if (env["use_static_cpp"] == "yes"): - env.Append(LINKFLAGS=['-static-libstdc++']) + env.Append(LINKFLAGS=['-static-libgcc', '-static-libstdc++']) list_of_x86 = ['x86_64', 'x86', 'i386', 'i586'] if any(platform.machine() in s for s in list_of_x86):