CP2K / Installation errors

Causes and fixes for CP2K installation errors

Common errors when building CP2K with the official toolchain script, listed by exact message, each with its cause and fix.

Short answer

CP2K depends on more than ten numerical libraries such as OpenBLAS, FFTW, ScaLAPACK, ELPA, libint and libxc, and the official toolchain script downloads and builds them one by one, so when one fails every later step fails too.

Setting up your environment this way avoids most errors on this page.

PracticeWhat happens if you skip it
Run install_requirements.sh before the toolchain to install compilers and system development packages.OpenBLAS, the first package built, fails with stdio.h not found or a non-zero exit.
Set the MPI type explicitly with --mpi-mode and match the MPI your system actually uses.ScaLAPACK and ELPA compile or link against the wrong MPI, and the logs rarely make that obvious.
Make sure there is enough memory before libint builds, and limit parallel jobs with -j.The script compiles on all cores by default, and libint is killed when memory runs out.
When something fails, open make.log for the failing package and start from the first error.The final install_successful error is only a consequence of an earlier failure, so fixing it directly fixes the wrong thing.
If you only need to run CP2K, prefer prebuilt packages from conda-forge or your Linux distribution.A full source build takes hours and has to be repeated on every new machine.

Troubleshooting by error message

Find your exact error message. Each entry gives the cause, the fix, and what may come up after the fix.

getarch.c:80:10: fatal error: stdio.h: No such file or directory

Cause: The toolchain cannot find the C standard headers while building OpenBLAS, usually because the compiler or system development packages are incomplete.

Fix: Run which gcc to see which compiler is used; on Ubuntu install build-essential and rerun the toolchain.

What may come next: The make: *** No rule to make target 'Makefile.' error that follows in the same log is a consequence and disappears once the header problem is fixed.

ERROR: (.../install_openblas.sh, line 72) Non-zero exit code detected.

Cause: The OpenBLAS build failed, most often because system dependencies are missing.

Fix: Run sudo ./install_requirements.sh in the toolchain folder, then rerun install_cp2k_toolchain.sh.

What may come next: Once OpenBLAS builds, ScaLAPACK, ELPA and later packages may still fail and need fixing one by one.

ERROR: (./scripts/install_scalapack.sh, line 47) Non-zero exit code detected. (ELPA, libint and others use the same format)

Cause: This is the toolchain's generic message: a package failed to build, and the real cause is in that package's build log.

Fix: Open make.log for that package under the build folder, find the first error, and handle that error.

What may come next: ScaLAPACK and ELPA failures are often tied to MPI compiler settings, and changing MPI may mean rebuilding every package built so far.

make[2]: *** [CMakeFiles/libint_f.dir/build.make:117: CMakeFiles/libint_f.dir/depend] Killed

Cause: libint needs a lot of memory to compile, and the script compiles on all cores by default, so the system kills it when memory runs out. On clusters you will usually also see an oom-kill message.

Fix: Request more memory, or reduce parallel jobs by passing something like -j 10 to the toolchain.

What may come next: With all cores in use, peak memory can reach about 181 GB, and fewer parallel jobs make the build much slower.

install_successful: No such file or directory

Cause: An earlier package failed before writing its success marker, so the script cannot find it.

Fix: Scroll up to the first package that failed, fix it, and rerun the toolchain.

error: call to undeclared function 'BI_ivmcopy'; ISO C99 and later do not support implicit function declarations

Cause: When building ScaLAPACK with Intel icx, the newer compiler enforces the C standard more strictly and the old ScaLAPACK code fails.

Fix: Use icx, icpx and ifx as compilers instead of the MPI wrappers mpiicc, mpiicpc and mpiifort.

What may come next: After switching compilers, every package already built with the Intel compilers must be rebuilt.

Geometry optimization hangs after the first force evaluation (with toolchain-built ELPA)

Cause: The ELPA built by the toolchain hangs during diagonalization.

Fix: Add PREFERRED_DIAG_LIBRARY SL to the GLOBAL section of the input so ScaLAPACK does the diagonalization.

What may come next: This only bypasses ELPA, and diagonalization may be slower for large systems.

Scientify is a cloud computer with research software installed and AI agents such as Codex and Claude Code built in. Describe what you need in one sentence, for example "optimize the structure of this water cluster with the PBE functional and a DZVP basis set", and the agent uses the preinstalled CP2K to do the modeling and computation, with no software to install and no code to write.

Compared with installing more on your own computer, the cloud computer already has CP2K 2026.1 (OpenMPI parallel build) with PLUMED 2.10.1, so there is no toolchain to run and no hours spent compiling libint, and runs continue after you close your laptop.

The cloud computer comes with more computing power: CPU and GPU clusters can be called on demand for large-scale scientific computing. Compute is billed by the minutes you actually use, so nothing is wasted.

Cloud computer
4 vCPU · 8 GB
Top configuration, for data processing and small to medium jobs
Callable GPU
96 GB VRAM
Up to an RTX PRO 6000 per GPU; H800 80 GB and up to 8 × A10G also available
Callable CPU
224 cores · 3 TB
Largest spec, for large parallel computations

References

Frequently asked questions

Do I have to start over after the toolchain fails?

No. Packages that finished keep a success marker, so rerunning the script skips them and resumes at the failed package.

How much memory does libint need to compile?

It depends on parallel jobs. Using all cores, peak memory can reach about 181 GB; fewer parallel jobs reduce it a lot.

How do I find which package failed?

The first Non-zero exit code detected in the terminal names the failing script; the details are in that package's make.log under the build folder.

Run first-principles calculations with Scientify without setup

Upload your data, describe the computation, and Scientify runs it on a cloud computer that is already set up. New accounts get a free cloud computer and US$5 in credit.