Skip to content

Commit ef417cf

Browse files
authored
Update open-mpi.rb to use homebrew gcc
1 parent d1951a1 commit ef417cf

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Formula/o/open-mpi.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ class OpenMpi < Formula
3737

3838
def install
3939
ENV.runtime_cpu_detection
40+
# Force use of Homebrew's default GCC
41+
gcc = Formula["gcc"]
42+
ENV["CC"] = gcc.opt_bin/"gcc-#{gcc.version.major}"
43+
ENV["CXX"] = gcc.opt_bin/"g++-#{gcc.version.major}"
4044

4145
# Otherwise libmpi_usempi_ignore_tkr gets built as a static library
4246
ENV["MACOSX_DEPLOYMENT_TARGET"] = MacOS.version if OS.mac?
@@ -50,8 +54,8 @@ def install
5054
ompi/tools/ompi_info/param.c
5155
oshmem/tools/oshmem_info/param.c
5256
]
53-
cxx = OS.linux? ? "g++" : ENV.cxx
54-
cc = OS.linux? ? "gcc" : ENV.cc
57+
cxx = ENV.cxx
58+
cc = ENV.cc
5559
inreplace inreplace_files, "OMPI_CXX_ABSOLUTE", "\"#{cxx}\""
5660
inreplace inreplace_files, "OPAL_CC_ABSOLUTE", "\"#{cc}\""
5761
inreplace "3rd-party/prrte/src/tools/prte_info/param.c", "PRTE_CC_ABSOLUTE", "\"#{cc}\""
@@ -74,6 +78,7 @@ def install
7478

7579
system "./configure", *args, *std_configure_args
7680
system "make", "all"
81+
7782
system "make", "check"
7883
system "make", "install"
7984

0 commit comments

Comments
 (0)