From 81f0d517e1e89bc32907013cc0ba765468acd25a Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Mon, 19 Aug 2024 17:46:13 +0200 Subject: [PATCH 1/3] spack: Update conflict gcc It seems that some C++17 functions recently introduced was not supported completely in GCC8 --- config_files/spack/comma/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_files/spack/comma/package.py b/config_files/spack/comma/package.py index 53ef8e9..44e6bf3 100644 --- a/config_files/spack/comma/package.py +++ b/config_files/spack/comma/package.py @@ -87,7 +87,7 @@ class Comma(CMakePackage): depends_on("catch2", type=("test",), when="@develop:") # Require C++17 compilers - conflicts("%gcc@:8.1.9", msg="Compiler supporting C++17 required") + conflicts("%gcc@:8.9.9", msg="Compiler supporting C++17 required") conflicts("%clang@:5.9.9", msg="Compiler supporting C++17 required") conflicts("%intel@:19.9.9", msg="Compiler supporting C++17 required") From 7cc8c8f5e6a2440f1d5082794e7078197cbb5544 Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Mon, 19 Aug 2024 17:46:50 +0200 Subject: [PATCH 2/3] spack: Minor format --- config_files/spack/comma/package.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config_files/spack/comma/package.py b/config_files/spack/comma/package.py index 44e6bf3..07d071e 100644 --- a/config_files/spack/comma/package.py +++ b/config_files/spack/comma/package.py @@ -42,12 +42,11 @@ class Comma(CMakePackage): variant("python", when="@1.2:", description="Install python bindings", default=True) variant("codaflags", when="@1.1:", description="Compile with usual CODA flags", default=False) variant("doc", when="@1.3.1:", description="Build Doxygen documentation", default=False) - # In recent version is always on variant( "pkgconfig", - when="@1.3.1:1.3.2", + when="@1.3.1:1.3.2", # In recent versions is always on description="Add pkg-config configuration file", - default=True + default=True, ) variant( "int64", From f64fb7fe4310c8bde36108f151a4b6fcb7edf612 Mon Sep 17 00:00:00 2001 From: Riccardo Milani Date: Mon, 19 Aug 2024 17:55:20 +0200 Subject: [PATCH 3/3] spack|fix: Fix support for python 3.11/3.12 It seems that 3.13 is still more or less work-in-progress in pybind11 --- config_files/spack/comma/package.py | 41 ++++++++++++++----- config_files/spack/comma/python312_v10.patch | 13 ++++++ config_files/spack/comma/python312_v11.patch | 11 +++++ config_files/spack/comma/python312_v13.patch | 12 ++++++ config_files/spack/comma/python312_v131.patch | 13 ++++++ config_files/spack/comma/python312_v132.patch | 13 ++++++ 6 files changed, 92 insertions(+), 11 deletions(-) create mode 100644 config_files/spack/comma/python312_v10.patch create mode 100644 config_files/spack/comma/python312_v11.patch create mode 100644 config_files/spack/comma/python312_v13.patch create mode 100644 config_files/spack/comma/python312_v131.patch create mode 100644 config_files/spack/comma/python312_v132.patch diff --git a/config_files/spack/comma/package.py b/config_files/spack/comma/package.py index 07d071e..c74c140 100644 --- a/config_files/spack/comma/package.py +++ b/config_files/spack/comma/package.py @@ -66,22 +66,41 @@ class Comma(CMakePackage): extends("python", when="+python") depends_on("python", type=("build", "link", "run"), when="+python") - depends_on("py-pybind11", type=("build", "link", "run"), when="@develop:+python") - depends_on( - "py-pybind11@2.10.0:", - type=("build", "link", "run"), - when="@develop:+python^python@3.11:" - ) - depends_on( - "py-pybind11@2.12.0:", - type=("build", "link", "run"), - when="@develop:+python^python@3.12:" - ) # older versions always had a Python dependency extends("python", when="@1.0:1.1") depends_on("python", type=("build", "link", "run"), when="@1.0:1.1") + depends_on("py-pybind11", type=("build", "link", "run"), when="@develop:+python") + # MAJOR SHAMEFUL HACK + # The version of pybind11 included in <=1.3.2 does not support python>=3.11. In order to make + # this work for any version of spack, if needed, we get the right version of pybind11 as + # resource and apply a patch to make cmake use this latter instead of the + # default one + PYTHONVER_TO_PYBINDVER = {"3.11": "2.10.0", "3.12": "2.12.0"} + for pythonver, pybindver in PYTHONVER_TO_PYBINDVER.items(): + depends_on( + "py-pybind11@{}:".format(pybindver), + type=("build", "link", "run"), + when="@develop:+python^python@{}".format(pythonver), + ) + for commaver, ptch in [ + ("1.0", "python312_v10.patch"), + ("1.1", "python312_v11.patch"), + ("1.2", "python312_v13.patch"), # Same as 1.3 + ("1.3.0", "python312_v13.patch"), + ("1.3.1", "python312_v131.patch"), + ("1.3.2", "python312_v132.patch"), + ]: + with when("@{}^python@{}".format(commaver, pythonver)): + patch(ptch) + resource( + name="pybind11", + git="https://github.com/pybind/pybind11.git", + tag="v{}".format(pybindver), + destination="pybind11new", # That's what we put in the patch + ) + # However, see this bug report https://github.com/spack/spack/issues/29447 depends_on("catch2", type=("test",), when="@develop:") diff --git a/config_files/spack/comma/python312_v10.patch b/config_files/spack/comma/python312_v10.patch new file mode 100644 index 0000000..ca1be43 --- /dev/null +++ b/config_files/spack/comma/python312_v10.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index cc76cf5..6015a87 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -102,7 +102,7 @@ target_link_libraries(Comma_test gcov) + #target_link_libraries(Comma_test Boost) + #set_source_files_properties( Comma_test PROPERTIES COMPILE_FLAGS "--coverage" ) + ######################## Pybind11 bindings #################################### +-add_subdirectory(pybind11) ++add_subdirectory(pybind11new/pybind11) + pybind11_add_module(CoMMA ${IMPLEMENTATION} ${INTERFACCIA} ${SOURCE_FILES}) + + diff --git a/config_files/spack/comma/python312_v11.patch b/config_files/spack/comma/python312_v11.patch new file mode 100644 index 0000000..57f353a --- /dev/null +++ b/config_files/spack/comma/python312_v11.patch @@ -0,0 +1,11 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a2e301f..f922bfe 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -103,5 +103,5 @@ target_link_libraries(Comma_test gcov) + #target_link_libraries(Comma_test Boost) + #set_source_files_properties( Comma_test PROPERTIES COMPILE_FLAGS "--coverage" ) + ######################## Pybind11 bindings #################################### +-add_subdirectory(pybind11) ++add_subdirectory(pybind11new/pybind11) + pybind11_add_module(CoMMA ${PYTHONBIND}) diff --git a/config_files/spack/comma/python312_v13.patch b/config_files/spack/comma/python312_v13.patch new file mode 100644 index 0000000..60dc0b0 --- /dev/null +++ b/config_files/spack/comma/python312_v13.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 72bc024..eebceab 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -124,6 +124,6 @@ endif() + ######################## Pybind11 bindings #################################### + if ( BUILD_PYTHON_BINDINGS ) + message("Python bindings enabled") +- add_subdirectory(pybind11) ++ add_subdirectory(pybind11new/pybind11) + pybind11_add_module(${PROJECT_NAME} ${PYTHONBIND}) + endif() diff --git a/config_files/spack/comma/python312_v131.patch b/config_files/spack/comma/python312_v131.patch new file mode 100644 index 0000000..3994c38 --- /dev/null +++ b/config_files/spack/comma/python312_v131.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3afa4de..653b4eb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -140,7 +140,7 @@ if ( BUILD_PYTHON_BINDINGS ) + message(STATUS "Python bindings enabled") + # find the Python interpreter (including pybind might lead to other find files being used) + find_package(Python COMPONENTS Interpreter Development) +- add_subdirectory(pybind11) ++ add_subdirectory(pybind11new/pybind11) + pybind11_add_module(${PROJECT_NAME} ${PYTHONBIND}) + endif() + diff --git a/config_files/spack/comma/python312_v132.patch b/config_files/spack/comma/python312_v132.patch new file mode 100644 index 0000000..86b3d42 --- /dev/null +++ b/config_files/spack/comma/python312_v132.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9cf2c7e..bcdfa0e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -168,7 +168,7 @@ if ( BUILD_PYTHON_BINDINGS ) + message(STATUS "Python bindings enabled") + # find the Python interpreter (including pybind might lead to other find files being used) + find_package(Python COMPONENTS Interpreter Development) +- add_subdirectory(pybind11) ++ add_subdirectory(pybind11new/pybind11) + pybind11_add_module(${CoMMA_PYTHON} ${PYTHONBIND}) + target_link_libraries(${CoMMA_PYTHON} PUBLIC ${CoMMA_LIB}) + endif()