mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-27 13:45:19 -04:00
Fixes for the GCC 15 compiler
Add -std=c17 flag where needed, because GCC 15 applies -std=gnu23 by default
This commit is contained in:
parent
10557513d2
commit
2ee47d2aa5
10 changed files with 42 additions and 19 deletions
|
|
@ -6,7 +6,7 @@
|
|||
#
|
||||
# Usage: Source this arch file and then run make as instructed.
|
||||
#
|
||||
# Last update: 16.05.2025
|
||||
# Last update: 12.06.2025
|
||||
#
|
||||
# \
|
||||
if [[ "${0}" == "${BASH_SOURCE}" ]]; then \
|
||||
|
|
@ -19,7 +19,8 @@
|
|||
rm -rf build; \
|
||||
[[ -z "${target_cpu}" ]] && target_cpu="native"; \
|
||||
echo "Found GCC $(gcc -dumpfullversion) compiler"; \
|
||||
./install_cp2k_toolchain.sh -j${maxtasks} --mpi-mode=no --no-arch-files --target-cpu=${target_cpu} --with-gcc --with-ace --with-dftd4 --with-hdf5 --with-trexio; \
|
||||
./install_cp2k_toolchain.sh -j${maxtasks} --mpi-mode=no --no-arch-files --target-cpu=${target_cpu} --with-gcc \
|
||||
--with-ace --with-dftd4 --with-hdf5 --with-tblite --with-trexio; \
|
||||
source ./install/setup; \
|
||||
cd ../..; \
|
||||
echo; \
|
||||
|
|
@ -234,7 +235,7 @@ endif
|
|||
|
||||
CFLAGS += $(DFLAGS) $(CFLAGS_DEBUG)
|
||||
|
||||
CXXFLAGS := $(CFLAGS) --std=c++14
|
||||
CXXFLAGS := $(CFLAGS)
|
||||
|
||||
FCFLAGS := $(CFLAGS) $(FCFLAGS_DEBUG) $(WFLAGS)
|
||||
ifeq ($(shell [ $(shell gcc -dumpversion | cut -d. -f1) -gt 9 ] && echo yes), yes)
|
||||
|
|
@ -246,6 +247,9 @@ FCFLAGS += -ffree-line-length-none
|
|||
FCFLAGS += -fno-omit-frame-pointer
|
||||
FCFLAGS += -std=f2008
|
||||
|
||||
CFLAGS += -std=c17
|
||||
CXXFLAGS += -std=c++17
|
||||
|
||||
# The LeakSanitizer does not work with static linking
|
||||
ifeq ($(DO_CHECKS), yes)
|
||||
LDFLAGS += $(FCFLAGS)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
# Optionally, GNU compiler and MPI implementation can be specified as arguments.
|
||||
# Replace or adapt the "module add" commands below if needed.
|
||||
#
|
||||
# Last update: 16.05.2025
|
||||
# Last update: 12.06.2025
|
||||
#
|
||||
# \
|
||||
if [[ "${0}" == "${BASH_SOURCE}" ]]; then \
|
||||
|
|
@ -478,7 +478,7 @@ endif
|
|||
|
||||
CFLAGS += $(DFLAGS) $(CFLAGS_DEBUG)
|
||||
|
||||
CXXFLAGS := $(CFLAGS) --std=c++14
|
||||
CXXFLAGS := $(CFLAGS)
|
||||
|
||||
FCFLAGS := $(CFLAGS) $(FCFLAGS_DEBUG) $(WFLAGS)
|
||||
ifeq ($(shell [ $(shell gcc -dumpversion | cut -d. -f1) -gt 9 ] && echo yes), yes)
|
||||
|
|
@ -490,6 +490,9 @@ FCFLAGS += -ffree-line-length-none
|
|||
FCFLAGS += -fno-omit-frame-pointer
|
||||
FCFLAGS += -std=f2008
|
||||
|
||||
CFLAGS += -std=c17
|
||||
CXXFLAGS += -std=c++17
|
||||
|
||||
LDFLAGS += $(FCFLAGS)
|
||||
|
||||
LIBS += -lz -ldl -lstdc++
|
||||
|
|
|
|||
|
|
@ -143,16 +143,16 @@ if [ "${with_intel}" != "__DONTUSE__" ]; then
|
|||
FC_arch+=" IF_MPI(-fc=${I_MPI_FC}|)"
|
||||
LD_arch+=" IF_MPI(-fc=${I_MPI_FC}|)"
|
||||
fi
|
||||
CFLAGS="${G_CFLAGS} -std=c11 -Wall \$(DFLAGS)"
|
||||
CXXFLAGS="${G_CFLAGS} -std=c++14 -Wall \$(DFLAGS)"
|
||||
CFLAGS="${G_CFLAGS} -std=c17 -Wall \$(DFLAGS)"
|
||||
CXXFLAGS="${G_CFLAGS} -std=c++17 -Wall \$(DFLAGS)"
|
||||
FCFLAGS="${FCFLAGS} -diag-disable=8291 -diag-disable=8293 -fpp -fpscomp logicals -free"
|
||||
# Suppress warnings and add include path to omp_lib.mod explicitly.
|
||||
# No clue why the Intel oneAPI setup script does not include that path (bug?)
|
||||
FCFLAGS="${FCFLAGS} -diag-disable=10448 -I/opt/intel/oneapi/2024.1/opt/compiler/include/intel64"
|
||||
elif [ "${with_amd}" != "__DONTUSE__" ]; then
|
||||
CFLAGS="$G_CFLAGS -std=c11 -Wall \$(DFLAGS)"
|
||||
CFLAGS="$G_CFLAGS -std=c17 -Wall \$(DFLAGS)"
|
||||
else
|
||||
CFLAGS="$G_CFLAGS -std=c11 -Wall -Wextra -Werror -Wno-vla-parameter -Wno-deprecated-declarations \$(DFLAGS)"
|
||||
CFLAGS="${G_CFLAGS} -std=c17 -Wall -Wextra -Werror -Wno-vla-parameter -Wno-deprecated-declarations \$(DFLAGS)"
|
||||
fi
|
||||
|
||||
# Linker flags
|
||||
|
|
@ -166,9 +166,9 @@ LDFLAGS="IF_STATIC(${STATIC_FLAGS}|) \$(FCFLAGS) ${CP_LDFLAGS}"
|
|||
LIBS="${CP_LIBS} -lstdc++"
|
||||
|
||||
if [ "${with_intel}" == "__DONTUSE__" ] && [ "${with_amd}" == "__DONTUSE__" ]; then
|
||||
CXXFLAGS+=" --std=c++14 \$(DFLAGS) -Wno-deprecated-declarations"
|
||||
CXXFLAGS+=" -std=c++17 \$(DFLAGS) -Wno-deprecated-declarations"
|
||||
else
|
||||
CXXFLAGS+=" --std=c++14 \$(DFLAGS)"
|
||||
CXXFLAGS+=" -std=c++17 \$(DFLAGS)"
|
||||
fi
|
||||
# CUDA handling
|
||||
if [ "${ENABLE_CUDA}" = __TRUE__ ] && [ "${GPUVER}" != no ]; then
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_NAME")/.." && pwd -P)"
|
|||
|
||||
gcc_ver="14.2.0"
|
||||
gcc_sha256="7d376d445f93126dc545e2c0086d0f647c3094aae081cdb78f42ce2bc25e7293"
|
||||
#gcc_ver="15.1.0"
|
||||
#gcc_sha256="51b9919ea69c980d7a381db95d4be27edf73b21254eb13d752a08003b4d013b1"
|
||||
|
||||
source "${SCRIPT_DIR}"/common_vars.sh
|
||||
source "${SCRIPT_DIR}"/tool_kit.sh
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ case "$with_gmp" in
|
|||
mkdir build
|
||||
cd build
|
||||
# autotools setup, out-of-source build
|
||||
../configure --prefix="${pkg_install_dir}" \
|
||||
../configure CFLAGS="${CFLAGS} -std=c17" \
|
||||
--prefix="${pkg_install_dir}" \
|
||||
--libdir="${pkg_install_dir}/lib" \
|
||||
--enable-cxx=yes \
|
||||
--includedir="${pkg_install_dir}/include" \
|
||||
|
|
|
|||
|
|
@ -54,7 +54,10 @@ case "$with_fftw" in
|
|||
grep '\bavx512f\b' /proc/cpuinfo 1> /dev/null && FFTW_FLAGS="${FFTW_FLAGS} --enable-avx512"
|
||||
fi
|
||||
fi
|
||||
./configure --prefix=${pkg_install_dir} --libdir="${pkg_install_dir}/lib" ${FFTW_FLAGS} \
|
||||
./configure CFLAGS="${CFLAGS} -std=c17" \
|
||||
--prefix=${pkg_install_dir} \
|
||||
--libdir="${pkg_install_dir}/lib" \
|
||||
${FFTW_FLAGS} \
|
||||
> configure.log 2>&1 || tail -n ${LOG_LINES} configure.log
|
||||
make -j $(get_nprocs) > make.log 2>&1 || tail -n ${LOG_LINES} make.log
|
||||
make install > install.log 2>&1 || tail -n ${LOG_LINES} install.log
|
||||
|
|
|
|||
|
|
@ -48,16 +48,19 @@ case "$with_scalapack" in
|
|||
cflags=""
|
||||
fflags=""
|
||||
if ("${FC}" --version | grep -q 'GNU'); then
|
||||
cflags="-fpermissive"
|
||||
cflags="-fpermissive -std=c17"
|
||||
fflags=$(allowed_gfortran_flags "-fallow-argument-mismatch")
|
||||
fi
|
||||
CFLAGS=${cflags} FFLAGS=${fflags} cmake -DCMAKE_FIND_ROOT_PATH="$ROOTDIR" \
|
||||
cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release .. \
|
||||
-DCMAKE_C_FLAGS="${cflags}" \
|
||||
-DCMAKE_Fortran_FLAGS="${fflags}" \
|
||||
-DCMAKE_FIND_ROOT_PATH="${ROOTDIR}" \
|
||||
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
|
||||
-DCMAKE_INSTALL_LIBDIR="lib" \
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
|
||||
-DCMAKE_VERBOSE_MAKEFILE=ON \
|
||||
-DBUILD_SHARED_LIBS=NO \
|
||||
-DCMAKE_BUILD_TYPE=Release .. \
|
||||
-DBUILD_TESTING=NO \
|
||||
-DSCALAPACK_BUILD_TESTS=NO \
|
||||
> configure.log 2>&1 || tail -n ${LOG_LINES} configure.log
|
||||
|
|
|
|||
|
|
@ -45,10 +45,14 @@ case "$with_ace" in
|
|||
tar -xzf ${ace_pkg}
|
||||
cd ${ace_dir}
|
||||
|
||||
# Fix for GCC 15
|
||||
sed -i '1i #include <cstdint>' yaml-cpp/src/emitterutils.cpp
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
cmake \
|
||||
-DCMAKE_CXX_STANDARD=11 \
|
||||
-DCMAKE_CXX_STANDARD=17 \
|
||||
.. > cmake.log 2>&1 || tail -n ${LOG_LINES} cmake.log
|
||||
make -j > make.log 2>&1 || tail -n ${LOG_LINES} make.log
|
||||
# no make install.
|
||||
|
|
|
|||
|
|
@ -47,10 +47,10 @@ case "$with_deepmd" in
|
|||
mkdir build
|
||||
cd build
|
||||
cmake \
|
||||
-DENABLE_PYTORCH=TRUE \
|
||||
-DCMAKE_INSTALL_PREFIX="${pkg_install_dir}" \
|
||||
-DCMAKE_CXX_STANDARD=17 \
|
||||
-DCMAKE_CXX_STANDARD=11 \
|
||||
-DCMAKE_CXX_STANDARD_REQUIRED=TRUE \
|
||||
-DENABLE_PYTORCH=TRUE \
|
||||
.. > cmake.log 2>&1 || tail -n ${LOG_LINES} cmake.log
|
||||
make -j deepmd_c > make.log 2>&1 || tail -n ${LOG_LINES} make.log
|
||||
make install > install.log 2>&1 || tail -n ${LOG_LINES} install.log
|
||||
|
|
|
|||
|
|
@ -118,6 +118,9 @@ case "$with_sirius" in
|
|||
# Workaround for https://github.com/electronic-structure/SIRIUS/issues/1073
|
||||
patch -p1 < ${SCRIPT_DIR}/stage8/sirius_memory.patch
|
||||
|
||||
# Fix for GCC 15
|
||||
sed -i '1i #include <cstdint>' src/core/memory.hpp
|
||||
|
||||
rm -Rf build
|
||||
mkdir build
|
||||
cd build
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue