The error message itself:
Installing blaze-markup-0.8.2.8 (lib)
Completed blaze-markup-0.8.2.8 (lib)
cabal: Failed to build basement-0.0.11 (which is required by
exe:cardano-submit-api from cardano-submit-api-3.1.2, test:cardano-api-test
from cardano-api-1.27.0 and others). The failure occurred during the configure
step. The build process was killed (i.e. SIGKILL). The typical reason for this
is that there is not enough memory available (e.g. the OS killed a process
using lots of memory).
Failed to build bimap-0.4.0 (which is required by exe:cardano-submit-api from
cardano-submit-api-3.1.2, test:chairman-tests from
cardano-node-chairman-1.27.0 and others). The failure occurred during the
configure step. The build process was killed (i.e. SIGKILL). The typical
reason for this is that there is not enough memory available (e.g. the OS
killed a process using lots of memory).
Failed to build canonical-json-0.6.0.0 (which is required by
test:cardano-api-test from cardano-api-1.27.0, test:cardano-cli-test from
cardano-cli-1.27.0 and others). The failure occurred during the configure
step. The build process was killed (i.e. SIGKILL). The typical reason for this
is that there is not enough memory available (e.g. the OS killed a process
using lots of memory).
Failed to build cereal-0.5.8.1 (which is required by exe:cardano-submit-api
from cardano-submit-api-3.1.2, test:chairman-tests from
cardano-node-chairman-1.27.0 and others). The failure occurred during the
configure step. The exception was:
/usr/local/bin/cabal: createProcess: fork: resource exhausted (Cannot allocate
memory)
For me the solution was to limit the number of CPUs used by cabal build:
cabal build all -j1
-j --jobs[=NUM] Run NUM jobs simultaneously
(or '$ncpus' if no NUM is
given).
By default it used all the CPUs and that involved a huge memory allocation which ended up killing the build process…