计算化学公社

 找回密码 Forget password
 注册 Register
楼主 Author: UW_0728.
打印 Print 上一主题 Last thread 下一主题 Next thread

[CP2K] 利用cmake编译和安装CP2K

[复制链接 Copy URL]

74

帖子

0

威望

414

eV
积分
488

Level 3 能力者

16#
 楼主 Author| 发表于 Post on 6 day ago | 只看该作者 Only view this author
dahai7719 发表于 2026-1-17 08:55
3. 运行构建指令的时候出错,倒腾了半天还没解决,求帮助:CMake Error at CMakeLists.txt:768 (find_packa ...

toolchain安装DFT-D4或tblite了吗,如果安装了的话,执行source {/path/to/cp2k}/tools/toolchain/install/setup那一步了吗

46

帖子

0

威望

1562

eV
积分
1608

Level 5 (御坂)

17#
发表于 Post on 5 day ago | 只看该作者 Only view this author
UW_0728. 发表于 2026-1-17 17:45
toolchain安装DFT-D4或tblite了吗,如果安装了的话,执行source {/path/to/cp2k}/tools/toolchain/instal ...

都安装了,dftd4-3.7.0,tblite-0.5.0,也显示安装成功了(toolchain/install下面各自的安装包下面都有install=successful的文件) ,也source了,但是就是不行

74

帖子

0

威望

414

eV
积分
488

Level 3 能力者

18#
 楼主 Author| 发表于 Post on 5 day ago | 只看该作者 Only view this author
dahai7719 发表于 2026-1-18 09:19
都安装了,dftd4-3.7.0,tblite-0.5.0,也显示安装成功了(toolchain/install下面各自的安装包下面都有inst ...

这是怎么两个都装上的,我记得如果装tblite的话会自动取消安装dftd4,因为tblite包含了dftd4;如果强制性地都安装了的话是不是有可能冲突了?

14

帖子

0

威望

167

eV
积分
181

Level 3 能力者

19#
发表于 Post on 5 day ago | 只看该作者 Only view this author
本帖最后由 Biubiubiu123 于 2026-1-18 22:22 编辑

前辈好,ubuntu 24.04.3 cmake 中报错,没有生成可执行文件
source /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/setup
cd /home/gh/cp2k/cp2k-2026.1
mkdir build
cd build
cmake -S .. -DCP2K_USE_EVERYTHING=ON -DCP2K_USE_DLAF=OFF -DCP2K_USE_PEXSI=OFF -DCP2K_USE_LIBSMEAGOL=OFF -DCP2K_USE_DEEPMD=OFF -DCP2K_USE_ACE=OFF -DCP2K_USE_TREXIO=OFF -DCP2K_USE_GREENX=OFF -DCP2K_USE_LIBTORCH=OFF -DCP2K_USE_MIMIC=OFF -DCMAKE_INSTALL_PREFIX=/home/gh/cp2k/cp2k-2026.1/exe/ -DCP2K_DATA_DIR=/home/gh/cp2k/cp2k-2026.1/data
make install -j40

log信息
[ 52%] Linking CXX shared library libcp2k.so
[ 98%] Built target cp2k
[ 98%] Building Fortran object src/CMakeFiles/gemm_square_unittest.dir/common/gemm_square_unittest.F.o
[ 98%] Building Fortran object src/CMakeFiles/parallel_rng_types_unittest.dir/common/parallel_rng_types_unittest.F.o
[ 98%] Building Fortran object src/CMakeFiles/cp2k-bin.dir/start/cp2k.F.o
[ 98%] Building Fortran object src/CMakeFiles/memory_utilities_unittest.dir/common/memory_utilities_unittest.F.o
[ 98%] Building Fortran object src/CMakeFiles/graph.dir/metadyn_tools/graph.F.o
[ 98%] Building Fortran object src/CMakeFiles/xyz2dcd.dir/motion/xyz2dcd.F.o
[ 98%] Building Fortran object src/CMakeFiles/dbt_unittest.dir/dbt/dbt_unittest.F.o
[ 98%] Building Fortran object src/CMakeFiles/dumpdcd.dir/motion/dumpdcd.F.o
[ 98%] Building C object src/CMakeFiles/libcp2k_unittest.dir/start/libcp2k_unittest.c.o
[ 98%] Building Fortran object src/CMakeFiles/nequip_unittest.dir/nequip_unittest.F.o
[ 98%] Building Fortran object src/CMakeFiles/gx_ac_unittest.dir/gx_ac_unittest.F.o
[ 98%] Building Fortran object src/CMakeFiles/dbt_tas_unittest.dir/dbt/tas/dbt_tas_unittest.F.o
[ 98%] Linking CXX executable ../bin/gx_ac_unittest.psmp
[ 98%] Linking CXX executable ../bin/libcp2k_unittest.psmp
[ 98%] Linking CXX executable ../bin/gemm_square_unittest.psmp
[ 98%] Linking CXX executable ../bin/memory_utilities_unittest.psmp
[ 98%] Linking CXX executable ../bin/parallel_rng_types_unittest.psmp
[ 98%] Linking CXX executable ../bin/nequip_unittest.psmp
[ 98%] Linking CXX executable ../bin/dbt_tas_unittest.psmp
...
...
...

collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/graph.dir/build.make:136:bin/graph.psmp] 错误 1
make[1]: *** [CMakeFiles/Makefile2:443:src/CMakeFiles/graph.dir/all] 错误 2
make: *** [Makefile:136:all] 错误 2

74

帖子

0

威望

414

eV
积分
488

Level 3 能力者

20#
 楼主 Author| 发表于 Post on 5 day ago | 只看该作者 Only view this author
Biubiubiu123 发表于 2026-1-18 22:05
前辈好,ubuntu 24.04.3 cmake 中报错,没有生成可执行文件
source /home/gh/cp2k/cp2k-2026.1/tools/tool ...

关键的那几行报错原因你恰好给省略掉了……

14

帖子

0

威望

167

eV
积分
181

Level 3 能力者

21#
发表于 Post on 5 day ago | 只看该作者 Only view this author
UW_0728. 发表于 2026-1-18 22:36
关键的那几行报错原因你恰好给省略掉了……

sorrysorry,再帮忙看下,我以为就中间不重要的
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Session_f2c'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Alltoallw_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPIX_Comm_ack_failed'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPIX_Comm_failure_ack'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Exscan_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPIX_Comm_agree'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so: undefined reference to `gotoblas'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Scatterv_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Session_get_nth_pset'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Neighbor_allgather_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Session_get_errhandler'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Neighbor_alltoallv_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Alltoall_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Status_f082f'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Psend_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Precv_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Bcast_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPIX_Comm_revoke'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Allreduce_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Allgather_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPIX_Comm_is_revoked'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Neighbor_alltoall_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Isendrecv'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Group_from_session_pset'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Info_create_env'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Session_get_pset_info'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Gather_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Session_finalize'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Session_set_errhandler'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `ompi_instance_count'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPIX_Comm_iagree'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Reduce_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Comm_create_from_group'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Comm_idup_with_info'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Reduce_scatter_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Scan_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Barrier_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Parrived'
collect2: error: ld returned 1 exit status
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Pready_list'
make[2]: *** [src/CMakeFiles/graph.dir/build.make:136:bin/graph.psmp] 错误 1
make[1]: *** [CMakeFiles/Makefile2:443:src/CMakeFiles/graph.dir/all] 错误 2
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPIX_Comm_shrink'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPIX_Comm_failure_get_acked'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Neighbor_allgatherv_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Neighbor_alltoallw_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Isendrecv_replace'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Status_f2f08'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Session_get_num_psets'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Alltoallv_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Pready'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Intercomm_create_from_groups'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Scatter_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Session_call_errhandler'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPIX_Comm_get_failed'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Reduce_scatter_block_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Gatherv_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Allgatherv_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Pready_range'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Session_c2f'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Session_get_info'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Session_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Session_f2c'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Alltoallw_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPIX_Comm_ack_failed'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPIX_Comm_failure_ack'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Exscan_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPIX_Comm_agree'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so: undefined reference to `gotoblas'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Scatterv_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Session_get_nth_pset'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Neighbor_allgather_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Session_get_errhandler'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Neighbor_alltoallv_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Alltoall_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Status_f082f'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Psend_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Precv_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Bcast_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPIX_Comm_revoke'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Allreduce_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Allgather_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPIX_Comm_is_revoked'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Neighbor_alltoall_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Isendrecv'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Group_from_session_pset'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Info_create_env'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Session_get_pset_info'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Gather_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Session_finalize'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Session_set_errhandler'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `ompi_instance_count'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPIX_Comm_iagree'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Reduce_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Comm_create_from_group'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Comm_idup_with_info'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Reduce_scatter_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Scan_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Barrier_init'
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9/lib/libmpi_mpifh.so: undefined reference to `PMPI_Parrived'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/dbt_unittest.dir/build.make:136:bin/dbt_unittest.psmp] 错误 1
make[1]: *** [CMakeFiles/Makefile2:603:src/CMakeFiles/dbt_unittest.dir/all] 错误 2
make: *** [Makefile:136:all] 错误 2

74

帖子

0

威望

414

eV
积分
488

Level 3 能力者

22#
 楼主 Author| 发表于 Post on 5 day ago | 只看该作者 Only view this author
Biubiubiu123 发表于 2026-1-18 22:43
sorrysorry,再帮忙看下,我以为就中间不重要的
/usr/bin/ld: /home/gh/cp2k/cp2k-2026.1/tools/toolcha ...

应该是toolchain编译或者程序编译环节出了问题,说清楚编译环境,以及编译cp2k时用的编译器是否和编译toolchain工具集时的一致

46

帖子

0

威望

1562

eV
积分
1608

Level 5 (御坂)

23#
发表于 Post on 4 day ago | 只看该作者 Only view this author
UW_0728. 发表于 2026-1-18 13:02
这是怎么两个都装上的,我记得如果装tblite的话会自动取消安装dftd4,因为tblite包含了dftd4;如果强制性 ...

因为用tootchain安装后(--with-dftd4=install),到了Cmake的时候会出现同样的出错问题,找不到dftd4的安装包,在install文件夹下也找不到,于是我用了(--with-dftd4没有加=install)重新toolchain了一遍之后Install里面就出现了dftd4-3.7.0, 但是source 过后cmake 还是出现了同样的问题,因此不知道是怎么回事?

14

帖子

0

威望

167

eV
积分
181

Level 3 能力者

24#
发表于 Post on 4 day ago | 只看该作者 Only view this author
本帖最后由 Biubiubiu123 于 2026-1-19 17:42 编辑
UW_0728. 发表于 2026-1-18 23:01
应该是toolchain编译或者程序编译环节出了问题,说清楚编译环境,以及编译cp2k时用的编译器是否和编译too ...

电脑装过orca,是不是因为有两个openmpi。
Compiling with 10 processes for target native.
==================== Finding GCC from system paths ====================
path to gcc is /usr/bin/gcc
path to g++ is /usr/bin/g++
path to gfortran is /usr/bin/gfortran
GCC compiler version 13.3.0 found
Found include directory /usr/include
Found lib directory /usr/lib/x86_64-linux-gnu
Step gcc took 0.00 seconds.
Step intel took 0.00 seconds.
Step amd took 0.00 seconds.
==================== Getting proc arch info using OpenBLAS tools ====================
wget  --quiet https://www.cp2k.org/static/downloads/OpenBLAS-0.3.30.tar.gz -O OpenBLAS-0.3.30.tar.gz
OpenBLAS-0.3.30.tar.gz: 成功
Checksum of OpenBLAS-0.3.30.tar.gz Ok
OpenBLAS detected LIBCORE = zen
OpenBLAS detected ARCH    = x86_64
==================== Installing CMake ====================
wget  --quiet https://www.cp2k.org/static/down ... 1.7-linux-x86_64.sh -O cmake-3.31.7-linux-x86_64.sh
cmake-3.31.7-linux-x86_64.sh: 成功
Checksum of cmake-3.31.7-linux-x86_64.sh Ok
Installing from scratch into /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/cmake-3.31.7
Step cmake took 21.00 seconds.
==================== Installing Ninja  ====================
wget  --quiet https://www.cp2k.org/static/downloads/ninja-v1.13.1.tar.gz -O ninja-v1.13.1.tar.gz
ninja-v1.13.1.tar.gz: 成功
Checksum of ninja-v1.13.1.tar.gz Ok
Installing from scratch into /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/ninja-v1.13.1
Step ninja took 10.00 seconds.
==================== Installing OpenMPI ====================
wget  --quiet https://www.cp2k.org/static/downloads/openmpi-5.0.9.tar.bz2 -O openmpi-5.0.9.tar.bz2
openmpi-5.0.9.tar.bz2: 成功
Checksum of openmpi-5.0.9.tar.bz2 Ok
Installing from scratch into /home/gh/cp2k/cp2k-2026.1/tools/toolchain/install/openmpi-5.0.9

1150

帖子

0

威望

4374

eV
积分
5524

Level 6 (一方通行)

25#
发表于 Post on 4 day ago | 只看该作者 Only view this author
UW_0728. 发表于 2026-1-7 23:08
我看了下2026.1的toolchain脚本,发现默认选项为with_hdf5="__DONTUSE__",即默认不安装HDF5。把cmake ...

这个问题在两周前 CP2K 的 Github 上也有人提出来了,但是开发者到现在并没有回应……
https://github.com/cp2k/cp2k/issues/4674

1150

帖子

0

威望

4374

eV
积分
5524

Level 6 (一方通行)

26#
发表于 Post on 4 day ago | 只看该作者 Only view this author
Qilin 发表于 2026-1-13 15:41
把下面三行直接写入 `~/.bashrc` 会把初学者拐带坏的。再不济也应该写入 `~/env/cp2k_2026.1.env`。
```
...

这不能怪作者,是 Sob 带出来的

1150

帖子

0

威望

4374

eV
积分
5524

Level 6 (一方通行)

27#
发表于 Post on 4 day ago | 只看该作者 Only view this author
本帖最后由 乐平 于 2026-1-19 18:07 编辑

正式编译 cp2k 之前的各种库的编译还是老样子,后面正式编译 cp2k 才换成了 cmake

cmake 编译模式并没有“报错概率更低一点” ……

CP2K 开发者们一贯的简陋手册是罪恶之源……
官网手册编译的例子 https://manual.cp2k.org/trunk/ge ... source.html#example  

  1. cd <CP2K_REPOSITORY>
  2. mkdir build/
  3. cmake -S . -B build \
  4.     -GNinja \
  5.     -DCP2K_USE_LIBXC=ON \
  6.     -DCP2K_USE_LIBINT2=ON \
  7.     -DCP2K_USE_SPGLIB=ON \
  8.     -DCP2K_USE_ELPA=ON \
  9.     -DCP2K_USE_SPLA=ON \
  10.     -DCP2K_USE_SIRIUS=ON \
  11.     -DCP2K_USE_COSMA=ON \
  12.     -DCP2K_USE_ACCEL=CUDA -DCP2K_WITH_GPU=A100

  13. cmake --build build -j 32
复制代码


第一个选项 -GNinja 至少在我这里是没法正常编译的,已经给 CP2K 的 Github 提了 issue
https://github.com/cp2k/cp2k/issues/4705

去掉 -GNinja 选项之后,Spglib 又报错说 Component omp of Spglib: NOT FOUND
之前 make 的时代是从来没有这种报错的……

74

帖子

0

威望

414

eV
积分
488

Level 3 能力者

28#
 楼主 Author| 发表于 Post on 4 day ago | 只看该作者 Only view this author
本帖最后由 UW_0728. 于 2026-1-19 19:46 编辑
乐平 发表于 2026-1-19 18:06
正式编译 cp2k 之前的各种库的编译还是老样子,后面正式编译 cp2k 才换成了 cmake

cmake 编译模式并没 ...

我没出过这样的问题
手册里那个应该是带GPU加速的,对我来说没意义
带个-G Ninja也不知道用处在哪儿

74

帖子

0

威望

414

eV
积分
488

Level 3 能力者

29#
 楼主 Author| 发表于 Post on 4 day ago | 只看该作者 Only view this author
Biubiubiu123 发表于 2026-1-19 17:32
电脑装过orca,是不是因为有两个openmpi。
Compiling with 10 processes for target native.
========= ...

应该是。你如果之前有OpenMPI的话直接--with-openmpi=system就可以了,否则可能会起冲突。鉴于你这也不知道是用哪套编译出来的,不行就把install文件夹删了,加上上面说的选项从头开始吧

74

帖子

0

威望

414

eV
积分
488

Level 3 能力者

30#
 楼主 Author| 发表于 Post on 4 day ago | 只看该作者 Only view this author
Qilin 发表于 2026-1-13 15:41
把下面三行直接写入 `~/.bashrc` 会把初学者拐带坏的。再不济也应该写入 `~/env/cp2k_2026.1.env`。
```
...

单另写个环境变量文件多此一举,我又没有区分不同环境的需要,需要区分不同环境的应该也不是初学者水平了,要么就是计算集群
在自己的个人电脑上开root用户完全可行,没有权限限制,畅行无阻,我也没有因为用root把系统搞不对劲过

本版积分规则 Credits rule

手机版 Mobile version|北京科音自然科学研究中心 Beijing Kein Research Center for Natural Sciences|京公网安备 11010502035419号|计算化学公社 — 北京科音旗下高水平计算化学交流论坛 ( 京ICP备14038949号-1 )|网站地图

GMT+8, 2026-1-23 11:30 , Processed in 0.262479 second(s), 20 queries , Gzip On.

快速回复 返回顶部 返回列表 Return to list