dealii / candi

candi - (Compile & Install) - Downloads, configures, builds and installs deal.II
GNU Lesser General Public License v3.0
61 stars 61 forks source link

Linker issue on Xcode 15 and PETSc v 3.19 on macOS Sonoma(intel) #368

Open okaragoz opened 9 months ago

okaragoz commented 9 months ago

When attempting to configure PETSc (version 3.18.6 or 3.19) on macOS Sonoma (intel), I encountered an error related to linking Fortran libraries. The error message indicates that Fortran libraries cannot be used with C as the linker. I am using Apple Clang version 15.0.0 for C compilation and GNU Fortran (Homebrew GCC 13.2.0) version 13.2.0 for Fortran.

The following issue addresses this situation: https://gitlab.com/petsc/petsc/-/issues/1500#note_1658121055 (xcode-15 removed some ld options - compatible fixes for this are in petsc-3.20 [so 3.18, 3.19 are unlikely to compile/work with xcode-15]).

When I tried Petsc 3.20 it worked, is there any plan to update packages for 3.20?

Thanks.

cgw0814 commented 9 months ago

Hi~ @okaragoz I'm using M2 Mac to test the petsc

as direction on https://github.com/dealii/candi/blob/master/deal.II-toolchain/platforms/supported/macos.platform

first, type "brew install openmpi"

second, set environments in .zshrc export OMPI_CC="/opt/homebrew/bin/gcc-13" export OMPI_CXX="/opt/homebrew/bin/g++-13" export OMPI_FC="/opt/homebrew/bin/gfortran-13" export CC="/opt/homebrew/bin/mpicc" export CXX="/opt/homebrew/bin/mpic++" export FF="/opt/homebrew/bin/mpifort" export FC="/opt/homebrew/bin/mpifort"

third. Test the fortran links with C, type in terminal mpicc -showme

if shows /opt/homebrew/bin/gcc-13 -I/opt/homebrew/Cellar/open-mpi/5.0.0/include -L/opt/homebrew/Cellar/open-mpi/5.0.0/lib -lmpi

It means that the problem about "Fortran libraries cannot be used with C as the linker" is resolved

In this condition, install from petsc-lite-3.18.0 to petsc-3.20.2 with ./candi.sh would work.

As for downloading petsc-3.20.2 with ./candi.sh, you can add

VERSION=3.20.2 CHECKSUM=1e170a5f096433ca21aa643c80c749eb
in /deal.II-toolchain/packages/petsc.package

and modify the NAME and SOURCE of petsc as

NAME=petsc-${VERSION} SOURCE=https://web.cels.anl.gov/projects/petsc/download/release-snapshots/

after you download candi