• Arnaldo Carvalho de Melo's avatar
    perf python: Remove -fstack-protector-strong if clang doesn't have it · c18ae632
    Arnaldo Carvalho de Melo authored
    Some distros put -fstack-protector-strong in the compiler flags to be
    used to build python extensions, but then, the clang version in that
    distro doesn't know about that, only gcc does.
    
    Check if that is the case and remove it from the set of options used to
    build the python binding with clang.
    
    Case at hand:
    
    oraclelinux:7
    
      $ head -2 /etc/os-release
      NAME="Oracle Linux Server"
      VERSION="7.6"
      $ grep stack-protector /usr/lib64/python2.7/_sysconfigdata.py | head -1 | cut -c-120
     'CFLAGS': '-fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --para
      $
      gcc version 4.8.5 20150623 (Red Hat 4.8.5-36.0.1) (GCC)
      clang version 3.4.2 (tags/RELEASE_34/dot2-final)
    
      clang: error: unknown argument: '-fstack-protector-strong'
      clang: error: unknown argument: '-fstack-protector-strong'
      error: command 'clang' failed with exit status 1
      cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory
      make[2]: *** [/tmp/build/perf/python/perf.so] Error 1
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Link: https://lkml.kernel.org/n/tip-brmp2415zxpbhz45etkgjoma@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    c18ae632
setup.py 2.7 KB