如何用自制软件和 gcc-4.9 构建 openmpi?
How to build openmpi with homebrew and gcc-4.9?
默认情况下 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) 为自制程序添加环境变量(您也可以将这些行添加到您的~\.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
出现问题。
默认情况下 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) 为自制程序添加环境变量(您也可以将这些行添加到您的~\.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
出现问题。