<div dir="ltr">Dear Petsc devs,<div><br></div><div>I have been having issues lately when compiling petsc on MacOS with various libraries. This is probably due to the updated linker in MacOS and unfortunately the newer operating systems do not allow using older toolchains.</div><div><br></div><div>on arm64, only 3.20 and up can be configured</div><div><br></div><div><br></div><div>My configure command usually looks like this:</div><div>'sudo ./configure  COPTFLAGS=-O3 -g CXXOPTFLAGS=-O3 -g FOPTFLAGS=-O3 -g --with-cxx-dialect=C++11 --with-mpi-dir=/opt/openfpm/dep_clang/MPI --with-64-bit-indices  --with-parmetis-dir=/opt/openfpm/dep_clang/PARMETIS --with-metis-dir=/opt/openfpm/dep_clang/METIS --with-boost=yes --with-boost-dir=/opt/openfpm/dep_clang/BOOST --with-suitesparse-dir=/opt/openfpm/dep_clang/SUITESPARSE --download-superlu_dist --download-hypre --prefix=/opt/openfpm/dep_clang/PETSC --download-scalapack --download-mumps --with-debugging=0 --with-clean</div><div>'</div><div><br></div><div>There are two main issues:</div><div><br></div><div>1) Duplicate 'LC_Paths' when compiling code with apple clang and gfortran. If I enable download_scalapack, the the cmake findPetsc fails with the following error on both x86 and arm64:</div><div>"""</div> kind: "try_run-v1"<br>    backtrace:<br>      - "/opt/homebrew/Cellar/cmake/3.27.7/share/cmake/Modules/Internal/CheckSourceRuns.cmake:93 (try_run)"<br>      - "/opt/homebrew/Cellar/cmake/3.27.7/share/cmake/Modules/CheckCSourceRuns.cmake:52 (cmake_check_source_runs)"<br>      - "cmake_modules/FindPackageMultipass.cmake:97 (check_c_source_runs)"<br>      - "cmake_modules/FindPETSc.cmake:284 (multipass_source_runs)"<br>      - "cmake_modules/FindPETSc.cmake:318 (petsc_test_runs)"<br>      - "CMakeLists.txt:69 (find_package)"<br>    checks:<br>      - "Performing Test MULTIPASS_TEST_4_petsc_works_all"<br>    directories:<br>      source: "/Users/absingh/openfpm_pdata/build/CMakeFiles/CMakeScratch/TryCompile-LJcmJB"<br>      binary: "/Users/absingh/openfpm_pdata/build/CMakeFiles/CMakeScratch/TryCompile-LJcmJB"<br>    cmakeVariables:<br>      CMAKE_C_FLAGS: ""<br>      CMAKE_EXE_LINKER_FLAGS: ""<br>      CMAKE_MODULE_PATH: "/Users/absingh/openfpm_pdata/cmake_modules/"<br>      CMAKE_OSX_ARCHITECTURES: ""<br>      CMAKE_OSX_DEPLOYMENT_TARGET: ""<br>      CMAKE_OSX_SYSROOT: "/Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk"<br>    buildResult:<br>      variable: "MULTIPASS_TEST_4_petsc_works_all_COMPILED"<br>      cached: true<br>      stdout: |<br>        Change Dir: '/Users/absingh/openfpm_pdata/build/CMakeFiles/CMakeScratch/TryCompile-LJcmJB'<br>        <br>        Run Build Command(s): /opt/homebrew/Cellar/cmake/3.27.7/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_e0165/fast<br>        /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/cmTC_e0165.dir/build.make CMakeFiles/cmTC_e0165.dir/build<br>        Building C object CMakeFiles/cmTC_e0165.dir/src.c.o<br>        /Library/Developer/CommandLineTools/usr/bin/cc -DMULTIPASS_TEST_4_petsc_works_all -I/opt/openfpm/dep_clang/PETSC/include -I/opt/openfpm/dep_clang/SUITESPARSE/include -I/opt/openfpm/dep_clang/PARMETIS/include -I/opt/openfpm/dep_clang/METIS/include -I/opt/openfpm/dep_clang/BOOST/include -I/opt/openfpm/dep_clang/MPI/include -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk -MD -MT CMakeFiles/cmTC_e0165.dir/src.c.o -MF CMakeFiles/cmTC_e0165.dir/src.c.o.d -o CMakeFiles/cmTC_e0165.dir/src.c.o -c /Users/absingh/openfpm_pdata/build/CMakeFiles/CMakeScratch/TryCompile-LJcmJB/src.c<br>        Linking C executable cmTC_e0165<br>        /opt/homebrew/Cellar/cmake/3.27.7/bin/cmake -E cmake_link_script CMakeFiles/cmTC_e0165.dir/link.txt --verbose=1<br>        /Library/Developer/CommandLineTools/usr/bin/cc  -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_e0165.dir/src.c.o -o cmTC_e0165  -Wl,-rpath,/opt/openfpm/dep_clang/PETSC/lib -Wl,-rpath,/opt/openfpm/dep_clang/SUITESPARSE/lib /opt/openfpm/dep_clang/PETSC/lib/libpetsc.dylib /opt/openfpm/dep_clang/PETSC/lib/libHYPRE.dylib /opt/openfpm/dep_clang/SUITESPARSE/lib/libspqr.dylib /opt/openfpm/dep_clang/SUITESPARSE/lib/libumfpack.dylib /opt/openfpm/dep_clang/SUITESPARSE/lib/libklu.dylib /opt/openfpm/dep_clang/SUITESPARSE/lib/libcholmod.dylib /opt/openfpm/dep_clang/SUITESPARSE/lib/libbtf.dylib /opt/openfpm/dep_clang/SUITESPARSE/lib/libccolamd.dylib /opt/openfpm/dep_clang/SUITESPARSE/lib/libcolamd.dylib /opt/openfpm/dep_clang/SUITESPARSE/lib/libcamd.dylib /opt/openfpm/dep_clang/SUITESPARSE/lib/libamd.dylib /opt/openfpm/dep_clang/SUITESPARSE/lib/libsuitesparseconfig.dylib /opt/openfpm/dep_clang/PETSC/lib/libdmumps.a /opt/openfpm/dep_clang/PETSC/lib/libmumps_common.a /opt/openfpm/dep_clang/PETSC/lib/libpord.a /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/lib/libpthread.tbd /opt/openfpm/dep_clang/PETSC/lib/libscalapack.dylib /opt/openfpm/dep_clang/PETSC/lib/libsuperlu_dist.dylib /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/lib/liblapack.tbd /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/lib/libblas.tbd /opt/openfpm/dep_clang/PARMETIS/lib/libparmetis.a /opt/openfpm/dep_clang/METIS/lib/libmetis.dylib /opt/openfpm/dep_clang/MPI/lib/libmpi_usempif08.dylib /opt/openfpm/dep_clang/MPI/lib/libmpi_usempi_ignore_tkr.a /opt/openfpm/dep_clang/MPI/lib/libmpi_mpifh.dylib /opt/openfpm/dep_clang/MPI/lib/libmpi.dylib /opt/homebrew/Cellar/gcc/13.2.0/lib/gcc/current/libgfortran.dylib /opt/homebrew/Cellar/gcc/13.2.0/lib/gcc/current/gcc/aarch64-apple-darwin23/13/libemutls_w.a /opt/homebrew/Cellar/gcc/13.2.0/lib/gcc/current/libquadmath.dylib /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/lib/libc++.tbd /Library/Developer/CommandLineTools/SDKs/MacOSX14.0.sdk/usr/lib/libgcc_s.1.tbd <br>        ld: warning: duplicate LC_RPATH are deprecated ('/opt/homebrew/Cellar/gcc/13.2.0/lib/gcc/current/gcc/aarch64-apple-darwin23/13')<br>        ld: warning: duplicate LC_RPATH are deprecated ('/opt/homebrew/Cellar/gcc/13.2.0/lib/gcc/current/gcc')<br>        ld: warning: duplicate LC_RPATH are deprecated ('/opt/homebrew/Cellar/gcc/13.2.0/lib/gcc/current')<br>        ld: warning: duplicate LC_RPATH are deprecated ('/opt/homebrew/Cellar/gcc/13.2.0/lib/gcc/current/gcc/aarch64-apple-darwin23/13')<br>        ld: warning: duplicate LC_RPATH are deprecated ('/opt/homebrew/Cellar/gcc/13.2.0/lib/gcc/current/gcc')<br>        ld: warning: duplicate LC_RPATH are deprecated ('/opt/homebrew/Cellar/gcc/13.2.0/lib/gcc/current')<br>        ld: duplicate LC_RPATH '/opt/homebrew/Cellar/gcc/13.2.0/lib/gcc/current/gcc/aarch64-apple-darwin23/13' in '/opt/openfpm/dep_clang/PETSC/lib/libscalapack.2.2.1.dylib'<br>        clang: error: linker command failed with exit code 1 (use -v to see invocation)<br>        make[1]: *** [cmTC_e0165] Error 1<br>        make: *** [cmTC_e0165/fast] Error 2<br>        <br>      exitCode: 2<br>    runResult:<br>      variable: "MULTIPASS_TEST_4_petsc_works_all_EXITCODE"<br>      cached: true<br><div>"""<br></div><div><br></div><div>Second, on arm64, I am unable to use the option "with-metis-dir=/path/to/metis". The installation works fine but when I run make check, I get the error that 'libmetis.dylib' is not found. This behavior continues even when I export 'DYLD_LIBRARY_PATH' to have the libmetis. CMake findPetsc also fails with the same error.</div><div><br></div><div>Any advice would be great. </div><div><br></div><div>Thank you!</div><div>Abhinav</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>