gpt4 book ai didi

gcc - 如何使用 Homebrew 软件和 gcc-4.9 构建 openmpi?

转载 作者:行者123 更新时间:2023-12-04 14:12:06 27 4
gpt4 key购买 nike

默认 brew install openmpi用途 clang创建它的包装器。

我需要指定 gcc-4.9 (安装 Homebrew 软件)用于包装器。

我试过了

$export CC=gcc-4.9
$brew install openmpi

$brew install --cc=gcc-4.9 openmpi

$brew install --with-gcc49 openmpi

$brew install -CC=gcc-4.9 -CXX=g++-4.9 -FC=gfortran -F77=gfortran openmpi

$brew install openmpi --cc=gcc-4.9

$brew install openmpi --CC=gcc-4.9 --CXX=g++-4.9 --FC=gfortran --F77=gfortran

最后,我修改了 openmpi公式添加:
 args = %W[
CC=gcc-4.9
CXX=g++-4.9
FC=gfortran
F77=gfortran

我仍然得到
$mpicc --showme
clang -I/usr/local/Cellar/open-mpi/1.8.4/include -L/usr/local/opt/libevent/lib -L/usr/local/Cellar/open-mpi/1.8.4/lib -lmpi

最佳答案

最后解决如下:

1)为 Homebrew 软件添加环境变量(您也可以将这些行添加到您的 ~\.bashrc ):

export HOMEBREW_CC=gcc-4.9
export HOMEBREW_CXX=g++-4.9

2) 重建并重新安装 openmpi以及它对源代码的依赖
brew reinstall openmpi --build-from-source

3)最后你会收到这样的消息:
==> Reinstalling open-mpi
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.
==> Downloading http://www.open-mpi.org/software/ompi/v1.8/downloads/openmpi-1.8.
Already downloaded: /Library/Caches/Homebrew/open-mpi-1.8.4.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/open-mpi/1.8.4 --disable-silent-rules
==> make all
==> make check
==> make install
Warning: open-mpi dependency gcc was built with a different C++ standard
library (libstdc++ from clang). This may cause problems at runtime.
🍺 /usr/local/Cellar/open-mpi/1.8.4: 785 files, 23M, built in 41.2 minutes

$mpicc --showme
gcc-4.9 -I/usr/local/Cellar/open-mpi/1.8.4/include -L/usr/local/opt/libevent/lib -L/usr/local/Cellar/open-mpi/1.8.4/lib -lmpi

在我的 MacBook 上,我与 XCode 6.2 发生了一些冲突,这些冲突在 this instructions 之后得到解决。

然而,我决定留在 clang版本以避免出现问题 gfortran .

关于gcc - 如何使用 Homebrew 软件和 gcc-4.9 构建 openmpi?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27930481/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com