Fortran compiler you provided with -FC=mpif90 cannot

817 views
Skip to first unread message

Guy Elisha

unread,
Feb 6, 2023, 2:16:27 PM2/6/23
to IBAMR Users
Hi everyone,

I am trying to build IBAMR on my Mac and ran into an issue when attempting to configure PETSc  (./configure --CC=mpicc --CXX=mpicxx --FC=mpif90 --PETSC_ARCH==$PETSC_ARCH --with-debugging=1 --download-hypre=1 --with-x=0)
I got an error saying that: " Fortran compiler you provided with -FC=mpif90 cannot be found or does not work. Cannot compile/link FC with mpif90".

I checked the mpif90 version, and it says: GNU Fortran (Homebrew GCC 12.2.0) 12.2.0
I checked the location, and it is the same as mpicc and mpicxx. Thus, I am not sure why there is an issue with mpif90.

Has anyone run into a similar issue?

Thank you!
Guy


Amneet Bhalla

unread,
Feb 6, 2023, 2:22:34 PM2/6/23
to ibamr...@googlegroups.com
For me this happened because command line tools became defunct with an update. David suggested to remove the old command line tools and rebuild it. That worked for me. Here is his original message:


======
Hi Amneet,

I see

ld: library not found for -lSystem


Fortunately I just fixed this on my machine. I don't remember everything I did but I did run

sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

to reinstall all the command-line tools. In particular, the error stems from an older version of the command line tools looking for things that don't exist any more.

You may need to run softwareupdate --all before that - I ran it but it wasn't on its own enough without the next two commands.

Let me know if this works!

===

 I also removed gcc@12 and gfortran from Mac, and rebuild it using brew after the command line update.

--
You received this message because you are subscribed to the Google Groups "IBAMR Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ibamr-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ibamr-users/b73d1040-63e7-4e9f-83be-1d316363645cn%40googlegroups.com.


--
--Amneet 



Amneet Bhalla

unread,
Feb 6, 2023, 2:23:42 PM2/6/23
to ibamr...@googlegroups.com
Also suggest to rebuild mpich locally or through brew after the command line update.  
--
--Amneet 



Guy Elisha

unread,
Feb 6, 2023, 4:00:06 PM2/6/23
to IBAMR Users
Hi Amneet,

Thank you for the response! I have seen someone who has mentioned it online over the weekend and have done these steps, but the problem persist. 
Just to clarify with you that I am taking the correct approach here:
1. In terminal, sudo rm -rf /Library/Developer/CommandLineTools
2. then to reinstall Brew by sudo xcode-select --install
3. Reinstalled the libraries in the first three commands presented on the IBAMR page: https://ibamr.github.io/mac#muparser

Then I tried to configure again and got the same error. By rebuilding mpich you mean reinstalling it through Brew?

Thank you again,
Best,
Guy

Kaustubh Khedkar

unread,
Feb 6, 2023, 4:06:46 PM2/6/23
to ibamr...@googlegroups.com, Guy Elisha
Hi Guy,

To install your own copy of mpich follow instructions on:

https://ibamr.github.io/linux

See the MPI section.

Best regards,
Kaustubh Khedkar


Guy Elisha

unread,
Feb 6, 2023, 4:42:22 PM2/6/23
to IBAMR Users
Hi Kaustubh,

But isn't it a step for Linux if one does not have a system MPI installation available? If I am using a Mac, isn't mpich available through HomeBrew? 

THank you,

Amneet Bhalla

unread,
Feb 6, 2023, 4:42:39 PM2/6/23
to ibamr...@googlegroups.com
sudo xcode-select --install 

will install command line tools on OSX. Brew is installed using the bash command given here:



--
--Amneet 



Kaustubh Khedkar

unread,
Feb 6, 2023, 4:43:29 PM2/6/23
to ibamr...@googlegroups.com
You can still follow the same steps and install it on your macOS.


Boyce Griffith

unread,
Feb 6, 2023, 8:53:06 PM2/6/23
to noreply-spamdigest via IBAMR Users

On Feb 6, 2023, at 4:42 PM, Amneet Bhalla <mail2...@gmail.com> wrote:

sudo xcode-select --install 

will install command line tools on OSX. Brew is installed using the bash command given here:

I use Homebrew to provide both Fortran and MPI:

➜ brew info gcc
==> gcc: stable 12.2.0 (bottled), HEAD
GNU compiler collection
/opt/homebrew/Cellar/gcc/12.2.0 (1,470 files, 358.9MB) *
  Poured from bottle on 2022-09-06 at 23:20:19
License: GPL-3.0-or-later with GCC-exception-3.1
==> Dependencies
Required: gmp ✔, isl ✔, libmpc ✔, mpfr ✘, zstd ✔
==> Options
--HEAD
Install HEAD version
==> Analytics
install: 75,574 (30 days), 230,156 (90 days), 1,397,079 (365 days)
install-on-request: 36,998 (30 days), 114,047 (90 days), 666,746 (365 days)
build-error: 260 (30 days)
➜ brew info openmpi
==> open-mpi: stable 4.1.4 (bottled), HEAD
High performance message passing library
Conflicts with:
  mpich (because both install MPI compiler wrappers)
/opt/homebrew/Cellar/open-mpi/4.1.4 (758 files, 17.6MB)
  Poured from bottle on 2022-08-03 at 15:38:42
/opt/homebrew/Cellar/open-mpi/4.1.4_1 (758 files, 17.6MB) *
  Poured from bottle on 2022-09-06 at 23:20:23
License: BSD-3-Clause
==> Dependencies
Required: gcc ✔, hwloc ✔, libevent ✔
==> Options
--HEAD
Install HEAD version
==> Analytics
install: 15,896 (30 days), 50,158 (90 days), 298,111 (365 days)
install-on-request: 6,184 (30 days), 21,412 (90 days), 130,612 (365 days)
build-error: 9 (30 days)

To get these, you would do:

➜ brew install gcc open-mpi

You can pass the “--show” flag to the MPI compiler wrapper to see what compilers are actually being used:

➜ mpicc --show
clang -I/opt/homebrew/Cellar/open-mpi/4.1.4_1/include -L/opt/homebrew/Cellar/open-mpi/4.1.4_1/lib -L/opt/homebrew/opt/libevent/lib -lmpi

➜ mpicxx --show
clang++ -I/opt/homebrew/Cellar/open-mpi/4.1.4_1/include -L/opt/homebrew/Cellar/open-mpi/4.1.4_1/lib -L/opt/homebrew/opt/libevent/lib -lmpi

➜ mpif90 --show
gfortran -I/opt/homebrew/Cellar/open-mpi/4.1.4_1/include -Wl,-flat_namespace -Wl,-commons,use_dylibs -I/opt/homebrew/Cellar/open-mpi/4.1.4_1/lib -L/opt/homebrew/Cellar/open-mpi/4.1.4_1/lib -L/opt/homebrew/opt/libevent/lib -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi

I get this because I set the following variables in my .zshrc:

# tell MPICH to use ccache:
export MPICH_CC="clang"
export MPICH_CXX="clang++"
export MPICH_FC="gfortran"

# tell OpenMPI to use ccache:
export OMPI_CC="clang"
export OMPI_CXX="clang++"
export OMPI_FC="gfortran"

Note also that if you have a working MPI, autoibamr (https://github.com/IBAMR/autoibamr) will take care of everything else if you are happy to use IBAMR’s master branch.

Guy Elisha

unread,
Feb 13, 2023, 5:37:11 PM2/13/23
to IBAMR Users
Hi Prof. Griffith and Prof. Bhalla,

Thank you very much for your help. I managed to configure (or at least I thought I managed) using Homebrew mpich rather than open-mpi. However, when I try installing libMesh, problems arise again. 

The error: 

note: Checking /lib and /include for MPI

note: Could not find /lib/libmpi(.a/.so/.dylib)

mpicxx -std=gnu++17 Compiler Supports MPI 

configure: error: *** PETSc was not found, but --enable-petsc-required was specified.

Note 1: I went to petsc/lib and the only folder in it is petsc which includes bin ans conf.

Note 2: I tried linking the mpi compilers through the following path: /usr/local/Cellar/mpich/4.1/bin/ but it did not help (I receive the same error).

Does it seem like I installed petsc wrong? Should I expect having a folder petsc/lib/libmpi?

Thank you again for your help,

Sincerely,

Guy



Boyce Griffith

unread,
Feb 17, 2023, 8:57:54 AM2/17/23
to ibamr...@googlegroups.com
Guy —

Would autoibamr work for your needs? It should build all of IBAMR’s dependencies (and IBAMR itself).

Currently autoibamr only works with IBAMR’s master branch. If you need to use a different branch, then you can use autoibamr to build all of IBAMR’s dependencies, and then build IBAMR yourself.

— Boyce

Amin Kolahdouz

unread,
Oct 11, 2023, 2:54:04 PM10/11/23
to IBAMR Users
I saw this relatively old post about issues with Fortran compilers on newer macOS systems and I thought I would post my own newly configured options (opt build) here, since I originally seemed to have the same issue.  I got IBAMR to compile on both Mac Ventura and Sonoma (OS 13.6 and 14 versions). Autoibamr is currently giving me a CMake error on those systems.

A few additional points: Installing openmpi or mpich through homebrew didn't seem to work for me. I, however, did use homebrew to install packages like gcc, boost and hdf5. I wound up having PETSc install mpich instead and had to pass the gcc-$version (gcc-13 in this case) for compiler flags in PETSc as shown below. I installed PETSc 3.17.5 (the latest PETSc, release namely 3.20.0, would also work with these options but note that the latest libMesh release (1.7.1.) is not compatible with petsc-3-20-0). In case of any MPI network errors (likely to happen on new macOS) be sure to replace 127.0.0.1   localhost  with 127.0.0.1   [your hostname] in /etc/hosts.

-Amin

============= PETSc =============


./configure --PETSC_ARCH=$PETSC_ARCH  --download-mpich --download-f2cblaslapack --with-cc=gcc-13 --with-cxx=g++-13 --with-fc=gfortran-13 --COPTFLAGS="-O3"  --CXXOPTFLAGS="-O3"  --FOPTFLAGS="-O3"  --with-debugging=0 --with-precision=double --with-scalar-type=real  --with-fortran-bindings=0 --download-make --download-hypre=1

============== SAMRAI =============

 ../SAMRAI-2.4.4/configure   CFLAGS="-fPIC -O3"   CXXFLAGS="-fPIC -O3"   FFLAGS="-fPIC -O3"   --prefix=$HOME/sfw/ventura/samrai/2.4.4/mac-g++-opt   --with-CC=$HOME/sfw/ventura/petsc/petsc-3.17.5/mac-opt/bin/mpicc   --with-CXX=$HOME/sfw/ventura/petsc/petsc-3.17.5/mac-opt/bin/mpicxx   --with-F77=$HOME/sfw/ventura/petsc/petsc-3.17.5/mac-opt/bin/mpifort   --with-hdf5=/usr/local   --without-petsc   --without-hypre   --with-silo=$HOME/sfw/ventura/silo/4.11.1   --without-blaslapack   --without-cubes   --without-eleven   --without-kinsol   --without-sundials   --without-x   --with-doxygen   --with-dot   --disable-debug   --enable-opt   --enable-implicit-template-instantiation   --disable-deprecated

============== libMesh =============

../LIBMESH/configure --prefix=$HOME/sfw/ventura/libmesh/1.7.1/1.7.1-opt --with-methods=opt PETSC_DIR=$HOME/sfw/ventura/petsc/petsc-3.17.5 PETSC_ARCH=mac-opt CC=$HOME/sfw/ventura/petsc/petsc-3.17.5/mac-opt/bin/mpicc CXX=$HOME/sfw/ventura/petsc/petsc-3.17.5/mac-opt/bin/mpicxx FC=$HOME/sfw/ventura/petsc/petsc-3.17.5/mac-opt/bin/mpifort F77=$HOME/sfw/ventura/petsc/petsc-3.17.5/mac-opt/bin/mpifort CFLAGS=-I$HOME/sfw/ventura/petsc/petsc-3.17.5/mac-opt/include --disable-boost --disable-capnproto --disable-cppunit --disable-eigen --disable-fparser --disable-hdf5 --disable-laspack --disable-metaphysicl --disable-openmp --disable-perflog --disable-pthreads --disable-reference-counting --disable-slepc --disable-strict-lgpl --disable-tbb --disable-tecio --disable-trilinos --enable-curl=no --enable-exodus=yes --enable-glpk=no --enable-nanoflann=no --enable-qhull=no --enable-tecplot=no --enable-timestamps=no --enable-petsc-required --enable-unique-id --with-methods=opt COPTFLAGS="-O3 -march=native" CXXOPTFLAGS="-O3 -march=native" FOPTFLAGS="-O3 -march=native"

============== IBAMR =============

../source/IBAMR/configure \
  CC=$HOME/sfw/ventura/petsc/petsc-3.17.5/mac-opt/bin/mpicc \
  CXX=$HOME/sfw/ventura/petsc/petsc-3.17.5/mac-opt/bin/mpicxx \
  FC=$HOME/sfw/ventura/petsc/petsc-3.17.5/mac-opt/bin/mpifort \
  F77=$HOME/sfw/ventura/petsc/petsc-3.17.5/mac-opt/bin/mpifort \
  MPICC=$HOME/sfw/ventura/petsc/petsc-3.17.5/mac-opt/bin/mpicc \
  MPICXX=$HOME/sfw/ventura/petsc/petsc-3.17.5/mac-opt/bin/mpicxx \
  CFLAGS="-O3 -pipe -Wall" \
  CXXFLAGS="-O3 -pipe -Wall" \
  FCFLAGS="-O3 -pipe -Wall" \
  CPPFLAGS="-DOMPI_SKIP_MPICXX" \
  --with-hypre=$PETSC_DIR/$PETSC_ARCH \
  --with-samrai=$HOME/sfw/ventura/samrai/2.4.4/mac-g++-opt \
  --with-hdf5=/usr/local \
  --with-silo=$HOME/sfw/ventura/silo/4.11.1 \
  --with-boost=/usr/local \
  --enable-libmesh \
  --with-libmesh=$HOME/sfw/ventura/libmesh/1.7.1/1.7.1-opt \
  --with-libmesh-method=opt


==================================


I also added the following paths to the root (while still keeping the variables Boyce mentioned in .zshrc). 

export PETSC_DIR=$HOME/sfw/ventura/petsc/petsc-3.17.5

export PETSC_ARCH=mac-opt

export PATH=$HOME/sfw/ventura/petsc/petsc-3.17.5/mac-opt/bin:$PATH

Reply all
Reply to author
Forward
0 new messages