Build failure with LLVM flang on macOS/Darwin — ltmain.sh flang detection fails with full compiler paths

19 views
Skip to first unread message

Matthew Mehrtens

unread,
Feb 8, 2026, 4:26:28 PMFeb 8
to Open MPI users
Hi,

I'm getting a build failure when building Open MPI 5.0.9 with LLVM compilers on macOS (Apple Silicon). Configure succeeds, but make fails when linking:

```
flang-21: error: unknown argument: '-compatibility_version'
flang-21: error: unknown argument: '-current_version'
flang-21: error: no such file or directory: '81'
flang-21: error: no such file or directory: '81.3'
make[3]: *** [libmpi_usempif08.la] Error 1
```

I believe this error comes from config/ltmain_flang_darwin.diff. The patch has three hunks that add flang-specific handling for Darwin linker flags. Hunks 1 and 3 match against $CC directly using `case $CC in flang*)`, which fails when the Fortran compiler is specified as a full path (e.g., /opt/homebrew/opt/flang/bin/flang). Hunk 2 correctly uses `func_cc_basename $CC` before matching, so it doesn't have this problem.

Environment:
  • macOS 26.2 (Darwin 25.2.0), aarch64 (Apple M1 Pro)
  • Homebrew clang/clang++/flang 21.1.8
  • Open MPI 5.0.9
Configure command:
```
$ ./configure \
      CC=/opt/homebrew/opt/llvm/bin/clang \
      CPPFLAGS=-I/opt/homebrew/opt/llvm/include \
      CXX=/opt/homebrew/opt/llvm/bin/clang++ \
      CXXCPPFLAGS=-I/opt/homebrew/opt/llvm/include \
      FC=flang \
      LDFLAGS="-L/opt/homebrew/opt/llvm/lib -L/opt/homebrew/opt/llvm/lib/c++ -L/opt/homebrew/opt/llvm/lib/unwind -lunwind" \
      --with-hwloc=/opt/homebrew/opt/hwloc \
      --with-libevent=/opt/homebrew/opt/libevent \
      --with-pmix=/opt/homebrew/opt/pmix
```

Build output: https://www.icloud.com/iclouddrive/00dSkBghSZdP0-MRsCPN7M7pw#ompi-output (let me know if you cannot access this, and I'll resubmit using a different service)

Workaround: Use `FC=flang` (bare name) instead of the full path, with /opt/homebrew/opt/flang/bin in $PATH.

Suggested fix: Update hunks 1 and 3 in config/ltmain_flang_darwin.diff to use `func_cc_basename $CC` and `$func_cc_basename_result` instead of matching $CC directly, consistent with hunk 2.

If this is indeed a bug and not intentional, I'd be happy to submit an issue/PR on GitHub if you can advise on the preferred approach. I wasn't sure whether to regenerate the diff against a specific libtool version or patch it directly.

Thanks,
Matthew Mehrtens

turnout4...@icloud.com

unread,
Mar 1, 2026, 11:26:40 PMMar 1
to us...@lists.open-mpi.org
Hi,

Bumping this thread. Is this the correct list to post this on?

Best regards,
Matthew Mehrtens

To unsubscribe from this topic, visit https://groups.google.com/a/lists.open-mpi.org/d/topic/users/4mIxq9op75k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to users+un...@lists.open-mpi.org.

George Bosilca

unread,
Mar 3, 2026, 9:46:51 AMMar 3
to us...@lists.open-mpi.org
I would create a github issue at https://github.com/open-mpi/ompi. And feel free to propose a PR, this looks like a bug to me.

  George.


To unsubscribe from this group and stop receiving emails from it, send an email to users+un...@lists.open-mpi.org.

Matthew Mehrtens

unread,
Mar 17, 2026, 12:13:23 PMMar 17
to Open MPI users, sa...@ucar.edu
Thanks to @billsacks for opening a GitHub issue and PRs (main and v5.0.x) for this bug.

I’ve been meaning to get around to this but have been busy with school. Cheers all!

Best regards,
Matthew Mehrtens

Reply all
Reply to author
Forward
0 new messages