After upgrading to 10.14.6, openmpi no longer works on my MacBook Air (2019). Attempting to run any related commands mpicxx or mpiexec produce the error

    dyld: Library not loaded: /usr/local/opt/libevent/lib/libevent-2.1.6.dylib

I reinstalled the latest versions of openmpi (4.0.1) and libevent (2.1.11) (this wasn't necessary in the previous openmpi installation, but openmpi could not make without it). However, even though the installation of openmpi was successful, it still seems to be still corrupted and fails with the same error as above when running mpiexec.

Any ideas what is causing this, or how to get this working again?

  • How did you install openmpi etc? Are you sure you installed the update over the ol version, and don‘t have the new version somewhere outside your PATH? – nohillside Sep 15 '19 at 6:06
  • Seems you're using Homebrew. Checking /usr/local/opt/libevent/lib, there's no libevent-2.1.6.dylib at all. You'd better report this bug to homebrew-core – Simba Sep 15 '19 at 9:49
  • I installed openmpi from source (./configure;make all;sudo make install ). And I'm pretty sure it is the new version running because the error changed slightly after reinstalling openmpi. – Jono Sep 16 '19 at 1:14
  • Any idea why openmpi would require libevent to even complete it's build with make? – Jono Sep 16 '19 at 1:17
  • Following Simba's comment, I deleted open-mpi from Homebrew manually. After installing openmpi from source again, it all seems to work. So it seems that the issue was caused by something related to Homebrew after the Mac OS X update, and some things in the earlier installation must have been pointing to the wrong place (since make all failed when building openmpi at first). – Jono Sep 16 '19 at 1:47

Open MPI 4.0.3 is now available from homebrew. brew upgrade openmpi will solve the problem.

| improve this answer | |

As explained in the Building Open MPI FAQ, this error can happen when a number of factors occur together:

  • If Open MPI's configure script chooses to use an "external" installation of hwloc and/or Libevent (i.e., outside of Open MPI's source tree).
  • If Open MPI's configure script chooses C and Fortran compilers from different suites/installations.

Put simply: if the default search library search paths differ between the C and Fortran compiler suites, the C linker may find a system-installed libhwloc and/or libevent, but the Fortran linker may not.

This tends to happen more frequently on macOS because it is common for Homebrew or MacPorts to install:

  • hwloc and/or Libevent
  • gcc and gfortran

There are a few different possible solutions to this issue:

  1. The best solution is to always ensure that Open MPI uses a C and Fortran compiler from the same suite/installation. This will ensure that both compilers/linkers will use the same default library search paths, and all behavior should be consistent.

    For example, the following instructs Open MPI's configure script to use Homebrew's gcc-9 for the C compiler by specifying an absolute path for it (and for the Fortran compiler):

    $ ./configure CC=/usr/local/bin/gcc-9 FC=/usr/local/bin/gfortran ...

    Note that this will likely cause configure to not find the Homebrew-installed hwloc, and instead fall back to using the bundled hwloc in the Open MPI source tree.

  2. Alternatively, you can simply force configure to select the bundled versions of hwloc and libevent, which avoids the issue altogether:

    $ ./configure --with-hwloc=internal --with-libevent=internal ...
  3. Finally, you can tell configure exactly where to find the external hwloc library. This can have some unintended consequences, however, because it will prefix both the C and Fortran linker's default search paths with /usr/local/lib:

    $ ./configure --with-hwloc-libdir=/usr/local/lib ...

Be sure to also see this FAQ question for more information about using the bundled hwloc and/or Libevent vs. system-installed versions.

| improve this answer | |
  • Instead of merely posting a link (which may stop working in the future and become useless) perhaps you should simply copy & paste the pertinent information into your answer. Answers this brief are usually removed because they don't give any help. – IconDaemon Jun 22 at 20:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .