With the help of ARCHER support team, I believe I've managed to get this to work now.
Here is the following script:
#!/bin/bash
set -e
export NWCHEM_TOP=...
# TomK's email
export LD=/usr/bin/ld
module swap PrgEnv-cray PrgEnv-intel/5.1.29
module swap intel intel/15.0.2.164
module swap cray-mpich/7.5.5 cray-mpich/7.2.6
module unload cray-libsci
# Fix SSL errors
module load openssl
module load git
module load wget
# Fix ga-5.6.5 failing to create configure script
# May be unneeded - original failure possibly due to "make -j12" instead
module load autotools
# MPI Setup
export USE_MPI=y
export USE_MPIF=y
export USE_MPIF4=y
export LIBMPI=" "
export MPI_LIB=$MPICH_DIR/lib
export MPI_INCLUDE=$MPICH_DIR/inc
# NWChem stuff
export NWCHEM_TARGET=LINUX64
export NWCHEM_MODULES=all
export LARGE_FILES=TRUE
export USE_64TO32=y
export ARMCI_NETWORK=MPI-TS
# BLAS and ScaLAPACK
export HAS_BLAS=y
export USE_SCALAPACK=y
export BLAS_SIZE=4
export LAPACK_SIZE=4
export SCALAPACK_SIZE=4
# lp for 32-bit libraries
export SCALAPACK="-L$MKLROOT/lib/intel64 -lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -lmkl_blacs_intelmpi_lp64 -lpthread -lm"
export BLASOPT="-L$MKLROOT/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -lmkl_core -lmkl_intel_thread -lpthread -lm"
# required to prevent compiler error
export USE_OPENMP=y
# Compilers
export FC=ftn
export _FC=ifort
export CC=cc
export _CC=icc
export CRAYPE_LINK_TYPE=dynamic
cd $NWCHEM_TOP/src
make clean
make nwchem_config 2>&1 | tee nwchem_config.log
make -j12 64_to_32
#make -j12 2>&1 | tee nwchem_build.log
# Parallel make causes errors here
make 2>&1 | tee nwchem_build.log
|