OpenFOAM用wmake编译applications/test里的文件时缺少libmpi.so.1的解决办法:
说明:系统OpenSUSE Tumbleweed;OpenFOAM 3.0.x;openMPI 1.10.2。
问题描述:
OpenFOAM用wmake编译applications/test里的文件时报:
warning: libmpi.so.1, needed by /home/weiming/OpenFOAM/OpenFOAM-3.0.x/platforms/linux64GccDPInt32Opt/lib/openmpi-system/libPstream.so, not found (try using -rpath or -rpath-link)
...
对‘ompi_mpi_op_sum’未定义的引用
对‘ompi_mpi_byte’未定义的引用
...
解决办法:
1.查看/usr/lib64(有些LINUX版本在/usr/lib)中的libmpi.so
/usr/lib64#ls -l `find -depth -name "*libmpi.so*"`
结果如下:
lrwxrwxrwx 1 root root 15 6月 15 20:31 ./libmpi.so -> libmpi.so.0.0.0
lrwxrwxrwx 1 root root 15 6月 15 20:31 ./libmpi.so.0 -> libmpi.so.0.0.0
-rwxr-xr-x 1 root root 705888 6月 15 20:31 ./libmpi.so.0.0.0
lrwxrwxrwx 1 root root 42 7月 20 12:24 ./libmpi.so.1 -> /usr/lib64/mpi/gcc/openmpi/lib64/libmpi.so
lrwxrwxrwx 1 root root 16 6月 15 23:02 ./mpi/gcc/openmpi/lib64/libmpi.so -> libmpi.so.12.0.2
lrwxrwxrwx 1 root root 16 6月 15 23:02 ./mpi/gcc/openmpi/lib64/libmpi.so.12 -> libmpi.so.12.0.2
-rwxr-xr-x 1 root root 869320 6月 15 23:03 ./mpi/gcc/openmpi/lib64/libmpi.so.12.0.2
2.创建软链接
/usr/lib64#ln -s /usr/lib64/mpi/gcc/openmpi/lib64/libmpi.so /usr/lib64/libmpi.so.1
注意libmpi.so.0.0.0并不是openmpi的lib,所以ln -s /usr/lib64/libmpi.so.0.0.0 /usr/lib64/libmpi.so.1这个会出错。
3.如果想删除软链接:
/usr/lib64#rm -rf /usr/lib64/libmpi.so.1
参考:OpenFOAM on Ubuntu 16.04