Merge pull request #23542 from marcelofg55/no_pie

Fix binaries incorrectly detected as shared libraries on some linux distros
This commit is contained in:
Rémi Verschelde 2018-11-09 16:12:16 +01:00 committed by GitHub
commit 06c42d151c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -149,6 +149,18 @@ def configure(env):
env.Append(CCFLAGS=['-pipe'])
env.Append(LINKFLAGS=['-pipe'])
# Check for gcc version > 4 before adding -no-pie
import re
import subprocess
proc = subprocess.Popen([env['CXX'], '--version'], stdout=subprocess.PIPE)
(stdout, _) = proc.communicate()
match = re.search('[0-9][0-9.]*', stdout)
if match is not None:
version = match.group().split('.')
if (version[0] > '4'):
env.Append(CCFLAGS=['-fpie'])
env.Append(LINKFLAGS=['-no-pie'])
## Dependencies
env.ParseConfig('pkg-config x11 --cflags --libs')