From 1a2236df12a46af3db78e36c02e8eb5b001e35f0 Mon Sep 17 00:00:00 2001 From: minghangli-uni <24727729+minghangli-uni@users.noreply.github.com> Date: Mon, 20 Oct 2025 09:39:46 +1100 Subject: [PATCH 1/3] Ensure lto toolchain consistency by forcing cmake to use llvm-ar --- CMakeLists.txt | 3 +++ cmake/UseLlvmArchive.cmake | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 cmake/UseLlvmArchive.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index b76f41e..cf95f53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,9 @@ include(GNUInstallDirs) include(FortranLib) include(AddPatchedSource) +# Use llvm-ar for IntelLLVM Fortran compiler +include(UseLlvmArchive) + # Common compiler flags and definitions if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fbacktrace -fconvert=big-endian -ffree-line-length-none -ffixed-line-length-none") diff --git a/cmake/UseLlvmArchive.cmake b/cmake/UseLlvmArchive.cmake new file mode 100644 index 0000000..71ae0fa --- /dev/null +++ b/cmake/UseLlvmArchive.cmake @@ -0,0 +1,35 @@ +# Use llvm-ar with `rcs` so we dont need to setup a separate ranlib. + +# Identify compiler is IntelLLVM +# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html +if (NOT (CMAKE_Fortran_COMPILER_ID MATCHES "IntelLLVM")) + return() +endif() + +# set a temp variable to hold the Fortran compiler path +set(_TMP_VAR "") +if (CMAKE_Fortran_COMPILER) + set(_TMP_VAR "${CMAKE_Fortran_COMPILER}") +endif() + +# try to discover full paths to llvm-ar +# https://cmake.org/cmake/help/latest/command/execute_process.html +if (_TMP_VAR) + execute_process( + COMMAND "${_TMP_VAR}" -print-prog-name=llvm-ar + OUTPUT_VARIABLE LLVM_AR_PATH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +endif() + +# enforce llvm-ar +set(CMAKE_AR "${LLVM_AR_PATH}" CACHE FILEPATH "" FORCE) + +# write index table via `s` flag, which disables separate ranlib step. +# https://github.com/Kitware/CMake/blob/1c7fe4dc0b47de90bec6918b33f0aca47d688887/Modules/CMakeCInformation.cmake#L152-L162 +# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_ARCHIVE_FINISH.html +# +set(CMAKE_Fortran_ARCHIVE_CREATE " rcs ") +set(CMAKE_Fortran_ARCHIVE_FINISH "") + +unset(_TMP_VAR) From 98978c4a1cc54c03c5976a6c7cdf8e5abfb2b5c8 Mon Sep 17 00:00:00 2001 From: Anton Steketee <79179784+anton-seaice@users.noreply.github.com> Date: Tue, 21 Oct 2025 09:27:12 +1100 Subject: [PATCH 2/3] test removing =stable --- .github/build-ci/manifests/intel.spack.yaml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build-ci/manifests/intel.spack.yaml.j2 b/.github/build-ci/manifests/intel.spack.yaml.j2 index 6f9552c..6625415 100644 --- a/.github/build-ci/manifests/intel.spack.yaml.j2 +++ b/.github/build-ci/manifests/intel.spack.yaml.j2 @@ -4,7 +4,7 @@ spack: packages: access3-share: require: - '@git.{{ ref }}=stable' + '@git.{{ ref }}' all: require: - '%{{ intel_compiler }} target={{ target }}' From 600c72ede25e480305a115395daff19d62d3a9c8 Mon Sep 17 00:00:00 2001 From: Anton Steketee <79179784+anton-seaice@users.noreply.github.com> Date: Fri, 24 Oct 2025 16:13:53 +1100 Subject: [PATCH 3/3] Update oneapi.spack.yaml.j2 with =stable for both --- .github/build-ci/manifests/oneapi.spack.yaml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/build-ci/manifests/oneapi.spack.yaml.j2 b/.github/build-ci/manifests/oneapi.spack.yaml.j2 index af5dfea..e6fe871 100644 --- a/.github/build-ci/manifests/oneapi.spack.yaml.j2 +++ b/.github/build-ci/manifests/oneapi.spack.yaml.j2 @@ -1,6 +1,6 @@ spack: specs: - - access3 @git.{{ ref }} configurations={{ all_configurations }} + - access3 @git.{{ ref }}=stable configurations={{ all_configurations }} packages: access3-share: require: