计算化学公社
标题: 编译OpenMPI4.1.1时出现错误 [打印本页]
作者Author: andycheng2026 时间: 2021-10-19 05:17
标题: 编译OpenMPI4.1.1时出现错误
小白在按照 http://bbs.keinsci.com/thread-11697-1-1.html 的方法安装OpenMPI4.1.1时,运行make all install 后出现以下错误:
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:1880: opal_wrapper] Error 1
make[2]: Leaving directory '/home/ubuntu/Downloads/openmpi-4.1.1/opal/tools/wrappers'
make[1]: *** [Makefile:2383: all-recursive] Error 1
make[1]: Leaving directory '/home/ubuntu/Downloads/openmpi-4.1.1/opal'
make: *** [Makefile:1901: all-recursive] Error 1
请问该如何解决?谢谢!
作者Author: sobereva 时间: 2021-10-19 06:09
看编译过程产生的日志文件末尾提示的信息试图判断
作者Author: andycheng2026 时间: 2021-10-19 08:20
文件末尾如下:
make[2]: Entering directory '/home/ubuntu/Downloads/openmpi-4.1.1/opal/tools/wrappers'
CCLD opal_wrapper
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_last'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_libevent2022_evthread_use_pthreads'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_topology_get_support'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_libevent2022_event_base_loop'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_dup'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_isincluded'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_set_area_membind'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_copy'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_topology_destroy'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_list_asprintf'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_or'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_obj_type_string'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_set'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_libevent2022_event_add'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_obj_type_snprintf'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_topology_export_xmlbuffer'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_isfull'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_get_type_depth'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_libevent2022_event_base_free'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_shmem_topology_adopt'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_libevent2022_event_base_loopbreak'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_topology_load'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_topology_set_xml'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_set_membind'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_isset'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_iszero'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `mca_event_libevent2022_component'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_list_sscanf'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_intersects'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_get_depth_type'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_libevent2022_event_priority_set'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_topology_init'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_snprintf'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_topology_get_depth'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_free'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_topology_set_flags'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_libevent2022_event_del'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_first'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_libevent2022_event_assign'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_obj_attr_snprintf'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_alloc'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_get_obj_by_depth'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_distances_release'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_topology_set_io_types_filter'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_libevent2022_event_base_priority_init'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_distances_get_by_depth'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_zero'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `mca_hwloc_hwloc201_component'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_topology_dup'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_topology_set_xmlbuffer'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_get_nbobjs_by_depth'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_get_cpubind'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_libevent2022_event_reinit'
/usr/bin/ld: ../../../opal/.libs/libopen-pal.so: undefined reference to `opal_hwloc201_hwloc_bitmap_weight'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:1880: opal_wrapper] Error 1
make[2]: Leaving directory '/home/ubuntu/Downloads/openmpi-4.1.1/opal/tools/wrappers'
make[1]: *** [Makefile:2383: all-recursive] Error 1
make[1]: Leaving directory '/home/ubuntu/Downloads/openmpi-4.1.1/opal'
make: *** [Makefile:1901: all-recursive] Error 1
不懂是什么原因导致。
作者Author: zjxitcc 时间: 2021-10-20 01:14
试试用Intel编译器编译openmpi,即一开始
./configure --prefix=你要的安装路径 FC=ifort F77=ifort CC=icc CXX=icpc
作者Author: sobereva 时间: 2021-10-20 03:09
说明当前用的是什么编译器
作者Author: andycheng2026 时间: 2021-10-20 05:18
应该是gcc和g++,因为编译过程中提示安装了。
作者Author: andycheng2026 时间: 2021-10-20 05:23
会出现如下报错:
*** Startup tests
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for gcc... icc
checking whether the C compiler works... no
configure: error: in `/home/ubuntu/Downloads/openmpi-4.1.1':
configure: error: C compiler cannot create executables
See `config.log' for more details
作者Author: zjxitcc 时间: 2021-10-20 10:31
你能截图说明你的运行命令么?我感觉你不是按我说的那么运行的。另外,先运行
ifort --version
icc --version
icpc --version
如果这三个显示找不到,说明你机子上没有intel编译器,自然也就没法使用其编译openmpi
作者Author: 九曜 时间: 2023-3-31 20:26
本帖最后由 九曜 于 2023-3-31 20:35 编辑
请问师兄:
1.如果编译openmpi的时候,module load 加载了 gcc/gcc-8.3.0 是不是就已经默认指定了CC=gcc CXX=g++ FC=gfortran。
2.如果这时候我再想编译一个xxx.f90文件,指定了FC=mpi90,他会报错Fatal Error: File 'mpi.mod' opened at (1) is not a GNU Fortran module file。mpi90 --show 显示使用的是gfortran,是不是用gfortran就无法加载这个mpi.mod库呢,需要改成ifort才可以么。具体应该怎么修改呢,需要重新编译openmpi 指定FC=ifort么。
3.我已经用现在的openmpi安装了block2,如果用intel 编译器重新编译openmpi,我的block2还需要重新编译一次么。
作者Author: zjxitcc 时间: 2023-4-2 09:48
本帖最后由 zjxitcc 于 2023-4-2 09:49 编辑
1. 不是。
2. 我没见过指定FC=mpif90的,一般来说比较完善的程序的configure/Makefile/CMakeLists.txt会认MPIF90之类变量的值为MPI编译器,而FC变量仍留给ifort或gfortran。另外,FC与MPIF90的值建议具有一致性,例如当FC=ifort时,MPIF90最好采用Intel编译器编译的openmpi,而非GNU编译的openmpi。
建议阅读一下程序安装说明。(当然,如果是自己写的程序,那是想怎么指定就怎么指定,只不过不太符合传统约定)
3. 是的。但我没见过/试过用Intel编译的openmpi去编译block2是否可以。所以比较好的办法是将环境变量写在提交任务的脚本里,要啥写啥。安装block2可参考我写的《block2的编译和安装》
作者Author: 算量子 时间: 2025-4-8 16:47
本帖最后由 算量子 于 2025-5-8 20:40 编辑
1. 安装基础依赖
sudo yum install -y gcc gcc-c++ gcc-gfortran make automake libtool
sudo yum install -y openssl-devel zlib-devel hwloc-devel libevent-devel
2. 清理并重新配置
cd /路径/openmpi416(存放openmpi的文件夹路径)
make distclean
./configure --prefix=/path/to/install/dir
3. 检查编译器兼容性
sudo yum install -y centos-release-scl
sudo yum install -y devtoolset-8
scl enable devtoolset-8 bash
4. 检查环境变量冲突
(将环境变量.bashrc文件中关于openmpi的配置全部删掉或者首行打#备注掉)
确保环境变量未干扰编译:
unset LD_LIBRARY_PATH
export C_INCLUDE_PATH=/usr/include:/usr/local/include
export LIBRARY_PATH=/usr/lib:/usr/local/lib
5. 编译调试
./configure --prefix=/路径/openmpi416 --disable-builtin-atomics
make all install
6. 重新编辑openmpi变量环境
#OpenMPI
export PATH=$PATH:/路径/openmpi416/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/路径/openmpi416/lib
export OMPI_ALLOW_RUN_AS_ROOT=1
export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
7. 验证安装:
运行mpiexec -V命令,显示出了OpenMPI的版本
Centos7 停止维护之后 升级gcc||找不到devtoolset-8-gcc* 问题解决方案
1. 修改CentOS-SCLo-scl.repo
vi /etc/yum.repos.d/CentOS-SCLo-scl.repo
2. 修改此部分的baseurl
[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/sclo/
# mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-sclo
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
3. 修改CentOS-SCLo-scl-rh.repo
vi /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
4. 修改此部分的baseurl
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
# mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-rh
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
5. 刷新缓存
yum repolist
yum clean all
yum makecache
sudo yum install -y devtoolset-8
欢迎光临 计算化学公社 (http://ccc.keinsci.com/) |
Powered by Discuz! X3.3 |