问题描述
默认情况下 brew install openmpi
使用 clang
来创建它的包装器。
我需要为包装指定 gcc-4.9
(安装Homebrew)。
I已尝试
$ 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
我仍然可以获得
$ $ p $ $ $ $ c $ $ $ $ $ $
$ / $ / $ / /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)为自制程序添加环境变量(您也可以将这些行添加到〜\.bashrc
):
export HOMEBREW_CC = gcc-4.9
export HOMEBREW_CXX = g ++ - 4.9
2)重建并重新安装 openmpi
及其从源代码的依赖关系
brew重新安装openmpi --build-from-source
3)最后,您将收到如下消息:
==>重新安装open-mpi
==>使用自制软件提供的fortran编译器。
这可以通过设置FC环境变量来更改。
==>下载http://www.open-mpi.org/software/ompi/v1.8/downloads/openmpi-1.8。
已经下载:/Library/Caches/Homebrew/open-mpi-1.8.4.tar.bz2
==> ./configure --prefix = / usr / local / Cellar / open-mpi / 1.8.4 --disable-silent-rules
==>使所有
==>> make check
==> make install
警告:open-mpi依赖项gcc使用不同的C ++标准
库(来自clang的libstdc ++)构建。这可能会在运行时造成问题。
By default brew install openmpi
uses clang
to create its wrapper.
I need to specify gcc-4.9
(Homebrew installed) for the wrapper.
I have tried
$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
Finally, I've modified the openmpi
formula adding:
args = %W[
CC=gcc-4.9
CXX=g++-4.9
FC=gfortran
F77=gfortran
I still get
$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
解决方案 Finally it was solved as follows:
1) Add environment variables for homebrew (you can also add these lines to your ~\.bashrc
):
export HOMEBREW_CC=gcc-4.9
export HOMEBREW_CXX=g++-4.9
2) Rebuild and reinstall openmpi
and its dependencies from source
brew reinstall openmpi --build-from-source
3) In the end you will get a message like:
==> 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 installWarning: open-mpi dependency gcc was built with a different C++ standardlibrary (libstdc++ from clang). This may cause problems at runtime. 这篇关于如何用homebrew和gcc-4.9构建openmpi?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!