sourceryinstitute / OpenCoarrays

A parallel application binary interface for Fortran 2018 compilers.
http://www.opencoarrays.org
BSD 3-Clause "New" or "Revised" License
243 stars 58 forks source link

Defect: Homebrew-installed caf script fails to compile "Hello, world!" on Apple M1 #754

Closed rouson closed 2 years ago

rouson commented 2 years ago

System information

macOS Monterey 12.0.1 running on a MacBook Air with an 8-core Apple M1 processor:

To help us debug your issue please explain:

What happened (include command output, screenshots, logs, etc.)

After uninstall and reinstalling Homebrew on a MacBook Air with the Apple M1 chip,

% cat hello.f90 
program main
  implicit none
  print *, "Hello, world!"
end program
rouson@MacBook-Air ~ % caf hello.f90 
ld: warning: directory not found for option '-L/opt/homebrew/Cellar/open-mpi/4.1.1_2/lib'
ld: library not found for -lm
collect2: error: ld returned 1 exit status
Error: comand:
   `/opt/homebrew/bin/gfortran -I/opt/homebrew/Cellar/opencoarrays/2.9.2_1/include/OpenCoarrays-2.9.2_GNU-11.2.0 -fcoarray=lib -Wl,-flat_namespace -Wl,-commons,use_dylibs -L/opt/homebrew/Cellar/libevent/2.1.12/lib -L/opt/homebrew/Cellar/open-mpi/4.1.1_2/lib hello.f90 /opt/homebrew/Cellar/opencoarrays/2.9.2_1/lib/libcaf_mpi.a /opt/homebrew/lib/libmpi_usempif08.dylib /opt/homebrew/lib/libmpi_usempi_ignore_tkr.dylib /opt/homebrew/lib/libmpi_mpifh.dylib /opt/homebrew/lib/libmpi.dylib`
failed to compile.

By contrast, installing the same way on a MacBook Pro with an 8-core Intel Core i9 processor and with macOS Monterey 12.3.1 works as expected.

What you expected to happen

Compilation without error.

Step-by-step reproduction instructions to reproduce the error/bug

See above.

rouson commented 2 years ago

The above transcript includes a warning that caf is can't find OpenMPI 4.1.1_2 -- presumably is because Homebrew installs:

% brew info open-mpi
open-mpi: stable 4.1.3 (bottled), HEAD
rouson commented 2 years ago

It seems someone else encountered the same error message from gfortran, posted about it on stackoverflow, and solved it by installing a gfortran distribution from fxcoudert:

rouson commented 2 years ago

This appears to be a Homebrew/gfortran issue rather than an OpenCoarrays issue.