A native build of CP2K is enabled with the default settings of build_system=cmake build_type=Release, which can override the given Spack architecture target. When using GCC compilers, for example, the compiler flags -march=native -mtune=native are added. This can cause a run-time failure (e.g., illegal instruction) when the build node is a different microarchitecture than compute nodes (e.g., building on an x86_64_v4 node with a target of x86_64_v3).
For reference: https://github.com/cp2k/cp2k/blob/v2026.2/cmake/CompilerConfiguration.cmake#L55
One way to address this issue is to use Spack's filter_file() function to remove or replace compiler flags like -march=native -mtune=native from the CompilerConfiguration.cmake file before the CMake build process begins.
Package maintainers: @mtaillefumier @RMeli @abussy
A native build of CP2K is enabled with the default settings of
build_system=cmake build_type=Release, which can override the given Spack architecture target. When using GCC compilers, for example, the compiler flags-march=native -mtune=nativeare added. This can cause a run-time failure (e.g., illegal instruction) when the build node is a different microarchitecture than compute nodes (e.g., building on an x86_64_v4 node with a target of x86_64_v3).For reference: https://github.com/cp2k/cp2k/blob/v2026.2/cmake/CompilerConfiguration.cmake#L55
One way to address this issue is to use Spack's
filter_file()function to remove or replace compiler flags like-march=native -mtune=nativefrom the CompilerConfiguration.cmake file before the CMake build process begins.Package maintainers: @mtaillefumier @RMeli @abussy