Fix macOS arch file for Apple M1

- Homebrew under macOS 15.4.1 (Sequoia) provides only CMake 4.0.1 which does not build the latest ScaLAPACK version 2.2.2
- CMake 3.31.2 -> 3.31.7
This commit is contained in:
Matthias Krack 2025-04-25 14:04:55 +02:00
parent 34fb91ba6b
commit e308244da1
2 changed files with 29 additions and 16 deletions

View file

@ -3,13 +3,13 @@
# CP2K Darwin arch file for a parallel arm64 binary
# (https://www.cp2k.org/howto:compile_on_macos)
#
# Tested with: GNU 14.2.0 and OpenMPI 5.0.6 on an Apple M1 (macOS 15.3 Sequoia)
# Tested with: GNU 14.2.0 and OpenMPI 5.0.7 on an Apple M1 (macOS 15.4.1 Sequoia)
#
# Usage: Source this arch file and then run make as instructed.
# Ensure the links in /opt/homebrew/bin to the gcc version
# and "brew unlink openmpi" (or mpich) if installed.
#
# Last update: 12.02.2025
# Last update: 25.04.2025
#
# \
if [[ "${0}" == "${BASH_SOURCE}" ]]; then \
@ -23,11 +23,11 @@
[[ -z "${mpi_implementation}" ]] && mpi_implementation="openmpi"; \
[[ -z "${target_cpu}" ]] && target_cpu="native"; \
if $(command -v brew >/dev/null 2>&1); then \
brew install cmake; \
brew install coreutils; \
brew install fftw; \
brew install gawk; \
brew install gcc; \
brew install gmp; \
brew install gsed; \
brew install gsl; \
brew install hdf5; \
@ -45,9 +45,9 @@
return 1; \
fi; \
./install_cp2k_toolchain.sh --install-all -j${maxtasks} --no-arch-files --target-cpu=${target_cpu} \
--with-cmake=$(brew --prefix cmake) --with-elpa=no --with-fftw=$(brew --prefix fftw) --with-gcc=system \
--with-gsl=$(brew --prefix gsl) --with-hdf5=$(brew --prefix hdf5) --with-libxc=$(brew --prefix libxc) \
--with-ninja=$(brew --prefix ninja) --with-openblas=$(brew --prefix openblas) --with-${mpi_implementation} \
--with-elpa=no --with-fftw=$(brew --prefix fftw) --with-gcc=system --with-gsl=$(brew --prefix gsl) \
--with-hdf5=$(brew --prefix hdf5) --with-libxc=$(brew --prefix libxc) --with-ninja=$(brew --prefix ninja) \
--with-openblas=$(brew --prefix openblas) --with-${mpi_implementation} --with-gmp=$(brew --prefix gmp) \
--with-libsmeagol --with-libtorch=no --with-deepmd=no; \
source ./install/setup; \
cd ../..; \
@ -196,7 +196,6 @@ endif
ifneq ($(USE_SIRIUS),)
USE_SIRIUS := $(strip $(USE_SIRIUS))
USE_GSL := ${GSL_VER}
LIBVDWXC_INC := $(INSTALL_PATH)/libvdwxc-$(LIBVDWXC_VER)/include
LIBVDWXC_LIB := $(INSTALL_PATH)/libvdwxc-$(LIBVDWXC_VER)/lib
PUGIXML_LIB := $(INSTALL_PATH)/pugixml-$(PUGIXML_VER)/lib

View file

@ -20,16 +20,26 @@ cd "${BUILDDIR}"
case "${with_cmake}" in
__INSTALL__)
echo "==================== Installing CMake ===================="
cmake_ver="3.31.2"
cmake_ver="3.31.7"
cmake_ext="sh"
if [ "${OPENBLAS_ARCH}" = "arm64" ]; then
cmake_arch="linux-aarch64"
cmake_sha256="85cc81f782cd8b5ac346e570ad5cfba3bdbe5aa01f27f7ce6266c4cef9334255"
if [ "$(uname -s)" = "Darwin" ]; then
cmake_arch="macos-universal"
cmake_sha256="1cb11aa2edae8551bb0f22807c6f5246bd0eb60ae9fa1474781eb4095d299aca"
cmake_ext="tar.gz"
elif [ "$(uname -s)" = "Linux" ]; then
cmake_arch="linux-aarch64"
cmake_sha256="ce8e32b2c1c497dd7f619124c043ac5c28a88677e390c58748dd62fe460c62a2"
else
report_error ${LINENO} \
"cmake installation for ARCH=${OPENBLAS_ARCH} under $(uname -s) is not supported. You can try to use the system installation using the flag --with-cmake=system instead."
fi
elif [ "${OPENBLAS_ARCH}" = "x86_64" ]; then
cmake_arch="linux-x86_64"
cmake_sha256="b81cf3f4892683133f330cd7c016c28049b5725617db24ca8763360883545d34"
cmake_sha256="b7a5c909cdafc36042c8c9bd5765e92ff1f2528cf01720aa6dc4df294ec7e1a0"
else
report_error ${LINENO} \
"cmake installation for ARCH=${ARCH} is not supported. You can try to use the system installation using the flag --with-cmake=system instead."
"cmake installation for ARCH=${OPENBLAS_ARCH} under $(uname -s) is not supported. You can try to use the system installation using the flag --with-cmake=system instead."
exit 1
fi
pkg_install_dir="${INSTALLDIR}/cmake-${cmake_ver}"
@ -37,14 +47,18 @@ case "${with_cmake}" in
if verify_checksums "${install_lock_file}"; then
echo "cmake-${cmake_ver} is already installed, skipping it."
else
if [ -f cmake-${cmake_ver}-${cmake_arch}.sh ]; then
echo "cmake-${cmake_ver}-${cmake_arch}.sh is found"
if [ -f cmake-${cmake_ver}-${cmake_arch}.${cmake_ext} ]; then
echo "cmake-${cmake_ver}-${cmake_arch}.${cmake_ext} is found"
else
download_pkg_from_cp2k_org "${cmake_sha256}" "cmake-${cmake_ver}-${cmake_arch}.sh"
download_pkg_from_cp2k_org "${cmake_sha256}" "cmake-${cmake_ver}-${cmake_arch}.${cmake_ext}"
fi
echo "Installing from scratch into ${pkg_install_dir}"
mkdir -p ${pkg_install_dir}
/bin/sh cmake-${cmake_ver}-${cmake_arch}.sh --prefix=${pkg_install_dir} --skip-license > install.log 2>&1 || tail -n ${LOG_LINES} install.log
if [ "${cmake_arch}" = "macos-universal" ]; then
tar --strip-components=3 -xvf cmake-${cmake_ver}-${cmake_arch}.${cmake_ext} -C ${pkg_install_dir} > install.log 2>&1 || tail -n ${LOG_LINES} install.log
else
/bin/sh cmake-${cmake_ver}-${cmake_arch}.${cmake_ext} --prefix=${pkg_install_dir} --skip-license > install.log 2>&1 || tail -n ${LOG_LINES} install.log
fi
write_checksums "${install_lock_file}" "${SCRIPT_DIR}/stage0/$(basename ${SCRIPT_NAME})"
fi
;;