Browse Source

fix builds made with Clang on some Linux distros

This is the same as #23542 (Fix binaries incorrectly detected as shared
libraries on some linux distros) but for Clang. It should be fine with
Clang 4 or higher.

(cherry picked from commit c0fcd55f96a237941ac838fdd38b3ebf2630b107)
Michele Valente 6 years ago
parent
commit
4f09d433d8
1 changed files with 7 additions and 1 deletions
  1. 7 1
      platform/x11/detect.py

+ 7 - 1
platform/x11/detect.py

@@ -1,7 +1,7 @@
 import os
 import platform
 import sys
-from methods import get_compiler_version, using_gcc
+from methods import get_compiler_version, using_gcc, using_clang
 
 
 def is_active():
@@ -161,6 +161,12 @@ def configure(env):
         if version != None and version[0] >= '6':
             env.Append(CCFLAGS=['-fpie'])
             env.Append(LINKFLAGS=['-no-pie'])
+    # Do the same for clang should be fine with Clang 4 and higher
+    if using_clang(env):
+        version = get_compiler_version(env)
+        if version != None and version[0] >= '4':
+            env.Append(CCFLAGS=['-fpie'])
+            env.Append(LINKFLAGS=['-no-pie'])
 
     ## Dependencies