解决编译时错误mpicc,no such file or directory,error 127

在安装RAxML时遇到编译错误mpicc,提示no such file or directory,error 127。原因可能包括未安装openmpi和openmpi-devel,已安装但未添加至路径,或anaconda安装的mpicc版本无效。解决方法包括检查安装状态,添加可执行文件路径,以及调整路径优先级以避免anaconda中的错误版本。
摘要由CSDN通过智能技术生成

不知道这里应该写啥

  • 1 背景
  • 1 background
  • 2 原因分析与解决途径
  • 2 possible reasons and solutions
    • 2.1 没有安装openmpi和openmpi-devel(或mpich和mpich-devel)
    • 2.1 haven't install openmpi and openmpi-devel (or mpich and mpich-devel)
    • 2.2 已经安装了openmpi(或mpich),但没有添加至路径
    • 2.2 already installed openmpi (or mpich), but haven't added path
    • 2.3 已经安装了openmpi(或mpich),但优先调用了anaconda安装的错误版本
    • 2.3 Already installed openmpi (or mpich), but the invalid version which was installed by anaconda is called by default.

1 背景

1 background

date: 2020-02-15
keywords: mpi, mpicc, compile, error, linux

这是安装(编译)RAxML时出现的问题。报错信息大致如下。
This is an error that occurred when i install (compile) RAxML. Error messages seem somewhat like the following.

# make: mpicc: no such file or directory
# Error code 127

2 原因分析与解决途径

2 possible reasons and solutions

2.1 没有安装openmpi和openmpi-devel(或mpich和mpich-devel)

2.1 haven’t install openmpi and openmpi-devel (or mpich and mpich-devel)

可以使用以下命令(在centos中)查看是否已经安装了openmpi或mpich等。
You can use the following codes (in centos) to see if openmpi or mpich etc are installed.

dnf list --installed | grep -i mpi

安装命令举例(在centos中)如下。
Demo codes for installation (in centos).

# both methods are okay, choose only 1
dnf install openmpi openmpi-devel # method 1
dnf install mpich mpich-devel # method 2

xxx-devel的安装是必须的。安装xxx后有mpirun命令,安装xxx-devel后才有mpicc命令。
The installation of xxx-devel is necessary. After installing xxx, you have the mpirun command. Only after installing xxx-devel, can you have the mpicc comand.

安装之后需要将可执行文件的路径添加到PATH中。
You need to add the path of executables to $PATH after installing.

2.2 已经安装了openmpi(或mpich),但没有添加至路径

2.2 already installed openmpi (or mpich), but haven’t added path

openmpi(或mpich)中的可执行文件一般在/usr/lib64/openmpi/bin(或/usr/lib64/mpich/bin)中。它们在安装时一般没有被创建链接到/usr/bin等常用路径中。
The executables of openmpi (or mpich) usually locate at /usr/lib64/openmpi/bin (or /usr/lib64/mpich/bin). And their links are usually not created in /usr/bin or other common paths.

添加可执行文件所在路径的代码示例。
Demo codes to add the executables.

# both methods are okay, choose only 1
PATH=$PATH:/usr/lib64/openmpi/bin # runtime configuration
nano ~/.bashrc # permanent configuration. Manually add /usr/lib64/openmpi/bin to PATH on your own.

2.3 已经安装了openmpi(或mpich),但优先调用了anaconda安装的错误版本

2.3 Already installed openmpi (or mpich), but the invalid version which was installed by anaconda is called by default.

我们的centos服务器中安装了anaconda。但由于镜像或其它问题,anaconda安装了mpicc命令却不能用。而且路径中“anaconda3/bin”较靠前,优先调用了anaconda中的mpicc命令。使用“whereis mpicc”命令可以查看都安装了哪些mpicc版本,以便确认默认调用的版本是哪一个。
In our centos server, we’ve installed anaconda. But due to the problem of mirror or others, the command mpicc has been installed by anaconda but is now unable to run. And in our $PATH, “anaconda3/bin” locates at a relatively former place, so the invalid version is called by default. You can use “whereis mpicc” to see what versions have you installed, and which one is called by default.

解决方法为将"/usr/lib64/openmpi/bin"调前。示例代码如下。
The solution is to move “/usr/lib64/openmpi/bin” forward. Demo codes are as following.

# both methods are okay, choose only 1
PATH=/usr/lib64/openmpi/bin:$PATH # runtime configuration
nano ~/.bashrc # permanent configuration.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值