Gromacs2023.4 installation error with cp2k2023.2

GROMACS version:2023.4
hello developers. im compiling Gromacs-2023.4 with cp2k-2023.2,and the GNU complier used is gcc-11.4 installed by cp2k toolchain.I successfully installed GROMACS (with some extended versions like double precision and MPI) and CP2K separately, but encountered problems when using libcp2k.a to install GROMACS with QM/MM functionality support. My installation command is as follows:
module load cmake/3
source /home/elapsebos/scratch/cp2k-2023.2/tools/toolchain/install/setup
cd /home/elapsebos/scratch/gromacs-2023.5
rm -rf build
mkdir build
cd build
cmake …
-DCMAKE_INSTALL_PREFIX=/scratch/elapsebos/gmx2023.5_qm
-DCMAKE_PREFIX_PATH=/scratch/elapsebos/cp2k-2023.2/tools/toolchain/install/fftw-3.3.10
-DGMX_BUILD_OWN_FFTW=off
-DGMX_DOUBLE=on -DGMX_MPI=off -DGMX_SIMD=AVX_512
-DGMX_FFT_LIBRARY=fftw3
-DFFTWF_LIBRARY=“/scratch/elapsebos/cp2k-2023.2/tools/toolchain/install/fftw-3.3.10/lib/libfftw3.so.3.6.10”
-DFFTWF_INCLUDE_DIR=“/scratch/elapsebos/cp2k-2023.2/tools/toolchain/install/fftw-3.3.10/include”
-DBUILD_SHARED_LIBS=OFF -DGMXAPI=OFF -DGMX_INSTALL_NBLIB_API=OFF
-DGMX_CP2K=ON -DCP2K_DIR=/scratch/elapsebos/cp2k-2023.2/lib/local/ssmp
-DGMX_BLAS_USER=/scratch/elapsebos/cp2k-2023.2/tools/toolchain/install/openblas-0.3.27
-DGMX_LAPACK_USER=/scratch/elapsebos/cp2k-2023.2/tools/toolchain/install/scalapack-2.2.1
-DGMX_DEFAULT_SUFFIX=OFF -DGMX_BINARY_SUFFIX=_qm -DGMX_LIBS_SUFFIX=_qm_d
make -j48
make -j48 check && make -j48 install
But when the make -j command was about to finish, I encountered the following issue:
/project2/elapsebos/binutils/bin/ld: warning: libgfortran.so.3, needed by /lib/…/lib64/libxc.so, may conflict with libgfortran.so.5

/project2/elapsebos/binutils/bin/ld: warning: libgfortran.so.3, needed by /lib/…/lib64/libxc.so, may conflict with libgfortran.so.5

/project2/elapsebos/binutils/bin/ld: /scratch/elapsebos/cp2k-2023.2/lib/local/ssmp/libcp2k.a(xc_libxc.o): in function `__xc_libxc_MOD_libxc_add_sections’:

/scratch/elapsebos/cp2k-2023.2/src/xc/xc_libxc.F:227: undefined reference to `xc_number_of_functionals’

/project2/elapsebos/binutils/bin/ld: /scratch/elapsebos/cp2k-2023.2/src/xc/xc_libxc.F:228: undefined reference to `xc_maximum_name_length’

/project2/elapsebos/binutils/bin/ld: /scratch/elapsebos/cp2k-2023.2/src/xc/xc_libxc.F:232: undefined reference to `xc_available_functional_numbers’

/project2/elapsebos/binutils/bin/ld: /scratch/elapsebos/cp2k-2023.2/src/xc/xc_libxc.F:232: undefined reference to `xc_available_functional_numbers’

[100%] Linking CXX static library …/…/lib/libtestutils.a

[100%] Built target testutils

/project2/elapsebos/binutils/bin/ld: /home/elapsebos/scratch/cp2k-2023.2/tools/toolchain/install/libxc-6.2.2/lib/libxcf03.a(libxcf03.o): in function `__xc_f03_lib_m_MOD_xc_f03_aux_func_weights’:

/home/elapsebos/scratch/cp2k-2023.2/tools/toolchain/build/libxc-6.2.2/src/…/…/src/libxc_master.F90:1445: undefined reference to `xc_aux_func_weights’

/project2/elapsebos/binutils/bin/ld: /home/elapsebos/scratch/cp2k-2023.2/tools/toolchain/install/libxc-6.2.2/lib/libxcf03.a(libxcf03.o): in function `__xc_f03_lib_m_MOD_xc_f03_aux_func_ids’:

/home/elapsebos/scratch/cp2k-2023.2/tools/toolchain/build/libxc-6.2.2/src/…/…/src/libxc_master.F90:1438: undefined reference to `xc_aux_func_ids’

/project2/elapsebos/binutils/bin/ld: /home/elapsebos/scratch/cp2k-2023.2/tools/toolchain/install/libxc-6.2.2/lib/libxcf03.a(libxcf03.o): in function `__xc_f03_lib_m_MOD_xc_f03_func_set_ext_params_name’:

/home/elapsebos/scratch/cp2k-2023.2/tools/toolchain/build/libxc-6.2.2/src/…/…/src/libxc_master.F90:1142: undefined reference to `xc_func_set_ext_params_name’

It appears that all functions related to libxc are undefined. Hope someone could help me…

The issue was resolved manually by specifying the -DCP2K_LINKER_FLAGS, which is an optional step as outlined in the official GROMACS documentation.