Non-zero exit code detected when using the CP2K toolchain script

When using the script tools/toolchain/install_cp2k_toolchain.sh for building dependencies of CP2K you may encounter the following message (here for the binutils package, but it may occur at any stage of the installation):

[...]
binutils-2.30.tar.gz: OK
Checksum of binutils-2.30.tar.gz Ok
Installing from scratch into /tmp/cp2k/tools/toolchain/install/binutils-2.30
ERROR: (/tmp/cp2k/tools/toolchain/scripts/install_binutils.sh, line 16) Non-zero exit code detected.

Solution

Check for the detailed error message in one of the *.log files in tools/toolchain/build/<THE_FAILED_PACKAGE>.

A command to find all log files for all packages built so far:

cd your/cp2k/code/location
find tools/toolchain -iname "*.log"

For the example with the binutils package given above, you should find a more elaborate error message in either configure.log, make.log or install.log in /tmp/cp2k/tools/toolchain/build/binutils-2.30/.