[CP2K-user] [CP2K:21363] Undefined reference error when linking to Gromacs

jona...@hotmail.com jonas.baa at hotmail.com
Sun Apr 13 12:08:24 UTC 2025


Hi! 
After having installed CP2K (2025.1 version) following the installation 
instructions and compiling both the executable and a static library 
(libcp2k.a), I try to link to Gromacs (2022.1 version). By trying all 
different kind of variables in the cmake function and different compilers I 
only get a lot of "underfined reference" errors when the download reaches 
100%. 

Here is the cmake command I'm using:

cmake .. \
         -DGMX_BUILD_OWN_FFTW=OFF \
         -DREGRESSIONTEST_DOWNLOAD=ON \
         -DCMAKE_INSTALL_PREFIX=~/gromacs \
         -DBUILD_SHARED_LIBS=OFF \
         -DGMX_PREFER_STATIC_LIBS=ON \
         -DGMXAPI=OFF \
         -DGMX_INSTALL_NBLIB_API=OFF \
         -DGMX_DOUBLE=ON \
         -DGMX_FFT_LIBRARY=fftw3 \
        
 -DFFTWF_LIBRARY=/home/jonasbaa/Documents/WaterPhase/cp2k/tools/toolchain/install/fftw-3.3.10/lib/libfftw3.a 
\
        
 -DFFTWF_INCLUDE_DIR=/home/jonasbaa/Documents/WaterPhase/cp2k/tools/toolchain/install/fftw-3.3.10/include 
\
        
 -DGMX_BLAS_USER=/home/jonasbaa/Documents/WaterPhase/cp2k/tools/toolchain/install/openblas-0.3.28/lib/libopenblas.a 
\
        
 -DGMX_LAPACK_USER=/home/jonasbaa/Documents/WaterPhase/cp2k/tools/toolchain/install/openblas-0.3.28/lib/libopenblas.a 
\
        
 -DCP2K_DIR=/home/jonasbaa/Documents/WaterPhase/cp2k/lib/Linux-gnu-x86_64/psmp 
\
         -DGMX_CP2K=ON \
        
 -DCMAKE_C_COMPILER=/home/jonasbaa/Documents/WaterPhase/cp2k/tools/toolchain/install/openmpi-5.0.6/bin/mpicc 
\
        
 -DCMAKE_CXX_COMPILER=/home/jonasbaa/Documents/WaterPhase/cp2k/tools/toolchain/install/openmpi-5.0.6/bin/mpicxx 
\
        
 -DCMAKE_Fortran_COMPILER=/home/jonasbaa/Documents/WaterPhase/cp2k/tools/toolchain/install/openmpi-5.0.6/bin/mpifort

Please take an extra look at the FFTWF, BLAS and LAPACK lines as they 
produce warnings. Cmake gives the following output: "DFFTWF_LIBRARY and 
DFFTWF_INCLUDE_DIR  is not used by the project". 

Here is a few examples of the undefined reference errors, as they are 
produced in huge amounts for all libraries downloaded with CP2K:

/usr/bin/ld: 
/home/jonasbaa/Documents/WaterPhase/cp2k/lib/Linux-gnu-x86_64/psmp/exts/dbcsr/libdbcsr.a(dbcsr_mpiwrap.o): 
in function `__dbcsr_mpiwrap_MOD_mp_file_write_at_all_iv':
/home/jonasbaa/Documents/WaterPhase/cp2k/obj/Linux-gnu-x86_64/psmp/exts/dbcsr/dbcsr_mpiwrap.F90:5394:(.text+0x1da0c): 
undefined reference to `mpi_file_write_at_all_f08_'
/usr/bin/ld: 
/home/jonasbaa/Documents/WaterPhase/cp2k/lib/Linux-gnu-x86_64/psmp/exts/dbcsr/libdbcsr.a(dbcsr_mpiwrap.o): 
in function `__dbcsr_mpiwrap_MOD_mp_file_write_at_i':
/home/jonasbaa/Documents/WaterPhase/cp2k/obj/Linux-gnu-x86_64/psmp/exts/dbcsr/dbcsr_mpiwrap.F90:5364:(.text+0x1dac7): 
undefined reference to `mpi_file_write_at_f08_'
/usr/bin/ld: 
/home/jonasbaa/Documents/WaterPhase/cp2k/lib/Linux-gnu-x86_64/psmp/exts/dbcsr/libdbcsr.a(dbcsr_mpiwrap.o): 
in function `__dbcsr_mpiwrap_MOD_mp_file_write_at_iv':
/home/jonasbaa/Documents/WaterPhase/cp2k/obj/Linux-gnu-x86_64/psmp/exts/dbcsr/dbcsr_mpiwrap.F90:5342:(.text+0x1dbc8): 
undefined reference to `mpi_file_write_at_f08_'
/usr/bin/ld: 
/home/jonasbaa/Documents/WaterPhase/cp2k/lib/Linux-gnu-x86_64/psmp/exts/dbcsr/libdbcsr.a(dbcsr_mpiwrap.o): 
in function `__dbcsr_mpiwrap_MOD_mp_deallocate_i':
/home/jonasbaa/Documents/WaterPhase/cp2k/obj/Linux-gnu-x86_64/psmp/exts/dbcsr/dbcsr_mpiwrap.F90:5544:(.text+0x1dc83): 
undefined reference to `mpi_free_mem_f08_'
/usr/bin/ld: 
/home/jonasbaa/Documents/WaterPhase/cp2k/lib/Linux-gnu-x86_64/psmp/exts/dbcsr/libdbcsr.a(dbcsr_mpiwrap.o): 
in function `__dbcsr_mpiwrap_MOD_mp_allocate_i':
/home/jonasbaa/Documents/WaterPhase/cp2k/obj/Linux-gnu-x86_64/psmp/exts/dbcsr/dbcsr_mpiwrap.F90:5531:(.text+0x1dd30): 
undefined reference to `mpi_type_size_f08_'
/home/jonasbaa/Documents/WaterPhase/cp2k/obj/Linux-gnu-x86_64/psmp/exts/dbcsr/dbcsr_block_operations.F90:1584:(.text+0xf4b9): 
undefined reference to `__libxsmm_MOD_libxsmm_ptr_s0'
/usr/bin/ld: 
/home/jonasbaa/Documents/WaterPhase/cp2k/obj/Linux-gnu-x86_64/psmp/exts/dbcsr/dbcsr_block_operations.F90:1584:(.text+0xf4ee): 
undefined reference to `__libxsmm_MOD_libxsmm_ptr_s0'
/usr/bin/ld: 
/home/jonasbaa/Documents/WaterPhase/cp2k/obj/Linux-gnu-x86_64/psmp/exts/dbcsr/dbcsr_block_operations.F90:1584:(.text+0xf52b): 
undefined reference to `__libxsmm_MOD_libxsmm_otrans_p0'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
make[2]: *** [src/programs/CMakeFiles/gmx.dir/build.make:101: bin/gmx_d] 
Error 1
make[1]: *** [CMakeFiles/Makefile2:7251: 
src/programs/CMakeFiles/gmx.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

Will appreciate all the help I can get! 

Best regards,
Jonas 



-- 
You received this message because you are subscribed to the Google Groups "cp2k" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cp2k+unsubscribe at googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/cp2k/41fb67d1-7dc7-475b-b3e5-9c217cd71fe5n%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cp2k.org/archives/cp2k-user/attachments/20250413/1f6c72b4/attachment.htm>


More information about the CP2K-user mailing list