From 1e9253be42e131654c80b6516c50d62dd1aad349 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 23 Jul 2024 13:40:05 +0200 Subject: [PATCH 1/3] Cherry-pick var/spack/repos/builtin/packages/hdf-eos2/package.py from spack/develop --- .../repos/builtin/packages/hdf-eos2/package.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/hdf-eos2/package.py b/var/spack/repos/builtin/packages/hdf-eos2/package.py index 04b57b45ae57f9..c9ec0c9880ff5e 100644 --- a/var/spack/repos/builtin/packages/hdf-eos2/package.py +++ b/var/spack/repos/builtin/packages/hdf-eos2/package.py @@ -120,10 +120,9 @@ def fix_configure(self): filter_file("CC=./\\$SZIP_CC", "", "configure") def flag_handler(self, name, flags): - if name == "cflags": - if self.spec.compiler.name == "apple-clang": + if self.spec.compiler.name in ["apple-clang", "oneapi"]: + if name == "cflags": flags.append("-Wno-error=implicit-function-declaration") - flags.append(f"{self.compiler.cc_pic_flag}") return flags, None, None @@ -161,4 +160,15 @@ def configure_args(self): if "zlib" in self.spec: extra_args.append("--with-zlib={0}".format(self.spec["zlib-api"].prefix)) + # https://forum.hdfgroup.org/t/help-building-hdf4-with-clang-error-implicit-declaration-of-function-test-mgr-szip-is-invalid-in-c99/7680 + # -fPIC: https://github.com/spack/spack/issues/43792 + if self.spec.satisfies("%apple-clang"): + extra_args.append( + "CFLAGS=-Wno-error=implicit-function-declaration {0}".format( + self.compiler.cc_pic_flag + ) + ) + else: + extra_args.append("CFLAGS={0}".format(self.compiler.cc_pic_flag)) + return extra_args From 54f00bb16f1178279cd57045e01bb3f8f1bb23d4 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 23 Jul 2024 13:41:18 +0200 Subject: [PATCH 2/3] Also add '-Wno-error=implicit-int' var/spack/repos/builtin/packages/hdf-eos2/package.py --- var/spack/repos/builtin/packages/hdf-eos2/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/var/spack/repos/builtin/packages/hdf-eos2/package.py b/var/spack/repos/builtin/packages/hdf-eos2/package.py index c9ec0c9880ff5e..e11e8ad69689b0 100644 --- a/var/spack/repos/builtin/packages/hdf-eos2/package.py +++ b/var/spack/repos/builtin/packages/hdf-eos2/package.py @@ -123,6 +123,7 @@ def flag_handler(self, name, flags): if self.spec.compiler.name in ["apple-clang", "oneapi"]: if name == "cflags": flags.append("-Wno-error=implicit-function-declaration") + flags.append("-Wno-error=implicit-int") return flags, None, None From 537a0a10e2b26a0feec0b8a6bc444144eb6ab4bd Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 23 Jul 2024 13:54:09 +0200 Subject: [PATCH 3/3] Clean up redundant settings in var/spack/repos/builtin/packages/hdf-eos2/package.py --- .../repos/builtin/packages/hdf-eos2/package.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/var/spack/repos/builtin/packages/hdf-eos2/package.py b/var/spack/repos/builtin/packages/hdf-eos2/package.py index e11e8ad69689b0..1b41abbf6509dc 100644 --- a/var/spack/repos/builtin/packages/hdf-eos2/package.py +++ b/var/spack/repos/builtin/packages/hdf-eos2/package.py @@ -120,8 +120,9 @@ def fix_configure(self): filter_file("CC=./\\$SZIP_CC", "", "configure") def flag_handler(self, name, flags): - if self.spec.compiler.name in ["apple-clang", "oneapi"]: - if name == "cflags": + if name == "cflags": + flags.append(self.compiler.cc_pic_flag) + if self.spec.compiler.name in ["apple-clang", "oneapi"]: flags.append("-Wno-error=implicit-function-declaration") flags.append("-Wno-error=implicit-int") @@ -161,15 +162,4 @@ def configure_args(self): if "zlib" in self.spec: extra_args.append("--with-zlib={0}".format(self.spec["zlib-api"].prefix)) - # https://forum.hdfgroup.org/t/help-building-hdf4-with-clang-error-implicit-declaration-of-function-test-mgr-szip-is-invalid-in-c99/7680 - # -fPIC: https://github.com/spack/spack/issues/43792 - if self.spec.satisfies("%apple-clang"): - extra_args.append( - "CFLAGS=-Wno-error=implicit-function-declaration {0}".format( - self.compiler.cc_pic_flag - ) - ) - else: - extra_args.append("CFLAGS={0}".format(self.compiler.cc_pic_flag)) - return extra_args