summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Volkl <valentin.volkl@cern.ch>2022-03-23 19:49:36 +0100
committerGitHub <noreply@github.com>2022-03-23 13:49:36 -0500
commit34732c57b38cc60465626649a6ba6f75566d0fa2 (patch)
tree098a55fbcb0821c035809f730722d4a78e1fd97e
parentc300b9204778a4ed21f32d9d77dc11a17c4f46a0 (diff)
downloadspack-34732c57b38cc60465626649a6ba6f75566d0fa2.tar.gz
spack-34732c57b38cc60465626649a6ba6f75566d0fa2.tar.bz2
spack-34732c57b38cc60465626649a6ba6f75566d0fa2.tar.xz
spack-34732c57b38cc60465626649a6ba6f75566d0fa2.zip
py-cffi: add compiler flags to fix build with clang (#29679)
* py-cffi: add compiler flags to fix build with clang For %clang@13.0.1, this avoids the ``` clang-13: warning: optimization flag '-ffat-lto-objects' is not supported [-Wignored-optimization-argument] ``` warning being turned into an error, and fixes this link error: ``` build/temp.linux-x86_64-3.10/c/_cffi_backend.o: file not recognized: file format not recognized ``` * style
-rw-r--r--var/spack/repos/builtin/packages/py-cffi/package.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/py-cffi/package.py b/var/spack/repos/builtin/packages/py-cffi/package.py
index be768f6286..711e601635 100644
--- a/var/spack/repos/builtin/packages/py-cffi/package.py
+++ b/var/spack/repos/builtin/packages/py-cffi/package.py
@@ -28,6 +28,16 @@ class PyCffi(PythonPackage):
depends_on('py-pycparser', type=('build', 'run'))
depends_on('libffi')
+ def flag_handler(self, name, flags):
+ if self.spec.satisfies('%clang@13:'):
+ if name in ['cflags', 'cxxflags', 'cppflags']:
+ flags.append('-Wno-error=ignored-optimization-argument')
+ return (flags, None, None)
+ if name == 'ldflags':
+ flags.append('-flto')
+ return (flags, None, None)
+ return (flags, None, None)
+
def setup_build_environment(self, env):
# This sets the compiler (and flags) that distutils will use
# to create the final shared library. It will use the