From d30698d9a8c7143d749f6b137d95265d4cdbd7d7 Mon Sep 17 00:00:00 2001 From: AMD Toolchain Support <73240730+amd-toolchain-support@users.noreply.github.com> Date: Wed, 31 May 2023 05:03:00 +0530 Subject: cp2k fixes for aocc (#37758) --- var/spack/repos/builtin/packages/cp2k/package.py | 5 +++-- var/spack/repos/builtin/packages/cp2k/posix_c_source.patch | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 var/spack/repos/builtin/packages/cp2k/posix_c_source.patch diff --git a/var/spack/repos/builtin/packages/cp2k/package.py b/var/spack/repos/builtin/packages/cp2k/package.py index 84b88ddc50..ee969b64bc 100644 --- a/var/spack/repos/builtin/packages/cp2k/package.py +++ b/var/spack/repos/builtin/packages/cp2k/package.py @@ -58,7 +58,7 @@ class Cp2k(MakefilePackage, CudaPackage): "elpa", default=False, description="Enable optimised diagonalisation routines from ELPA", - when="@8.3:", + when="@6.1:", ) variant( "sirius", @@ -246,6 +246,7 @@ class Cp2k(MakefilePackage, CudaPackage): sha256="3617abb877812c4b933f601438c70f95e21c6161bea177277b1d4125fd1c0bf9", when="@8.2", ) + patch("posix_c_source.patch", when="%aocc") def url_for_version(self, version): url = "https://github.com/cp2k/cp2k/releases/download/v{0}/cp2k-{0}.tar.bz2" @@ -274,7 +275,7 @@ class Cp2k(MakefilePackage, CudaPackage): def edit(self, spec, prefix): pkgconf = which("pkg-config") - fftw = spec["fftw-api"] + fftw = spec["fftw-api:openmp" if "+openmp" in spec else "fftw-api"] fftw_header_dir = fftw.headers.directories[0] # some providers (mainly Intel) keep the fftw headers in a subdirectory, find it diff --git a/var/spack/repos/builtin/packages/cp2k/posix_c_source.patch b/var/spack/repos/builtin/packages/cp2k/posix_c_source.patch new file mode 100644 index 0000000000..87a544a77d --- /dev/null +++ b/var/spack/repos/builtin/packages/cp2k/posix_c_source.patch @@ -0,0 +1,12 @@ +--- a/src/sockets.c 2019-12-24 01:41:57.000000000 +0530 ++++ b/src/sockets.c 2023-05-15 18:35:33.941236292 +0530 +@@ -35,6 +35,7 @@ + */ + #ifndef __NO_IPI_DRIVER + ++#define _POSIX_C_SOURCE 200112L + #include + #include + #include + + -- cgit v1.2.3-70-g09d2