@justinquinn since Claire is reinstalling ISSM, should we recommend to install form Github? There are more recent PETSc installation scripts which would probably help too
Mathieu

    mathieumorlighem Yes, that's a good point. Claire, you might consider checking out a copy of the repo from https://github.com/ISSMteam/ISSM. It will not have the same issues as there have been in the past with the production and public repositories being out of sync. It has the same install script that I linked to above.

      justinquinn That script solved my problem with Petsc/MPICH, thanks. I've gotten to the point of trying to compile ISSM, however I have encountered another error. The output I got when I tried to use make ended with these lines:

      ld: file not found: @rpath/libquadmath.0.dylib for architecture x86_64
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      make[4]: *** [libISSMApi.la] Error 1
      make[3]: *** [all-recursive] Error 1
      make[2]: *** [all-recursive] Error 1
      make[1]: *** [all-recursive] Error 1
      make: *** [all] Error 2

      There were also a lot of warnings prior to that, but I'm not sure whether or not they're related to the error. Here's a few examples of the type of warnings I saw a lot of in the output:
      *** Warning: Linking the shared library libISSMCore.la against the
      *** static library /Users/clairec/trunk/externalpackages/m1qn3/install/libddot.a is not portable!
      ld: warning: could not create compact unwind for what0: stack subq instruction is too different from dwarf stack size
      ld: warning: dylib (/Users/clairec/trunk/externalpackages/petsc/install/lib/libparmetis.dylib) was built for newer macOS version (12.7) than being linked (12.0)
      ld: warning: dylib (/Users/clairec/trunk/externalpackages/petsc/install/lib/libscalapack.dylib) was built for newer macOS version (12.7) than being linked (12.0)
      ld: warning: dylib (/Users/clairec/trunk/externalpackages/petsc/install/lib/libmetis.dylib) was built for newer macOS version (12.7) than being linked (12.0)
      ld: warning: dylib (/usr/local/gfortran/lib/libgfortran.dylib) was built for newer macOS version (12.3) than being linked (12.0)
      ld: warning: dylib (/usr/local/gfortran/lib/libquadmath.dylib) was built for newer macOS version (12.3) than being linked (12.0)

      I've also attached the full output I got from running make.
      This attempt was still using the copy of ISSM I got through SVN, but I'll try starting over from the version on github, in case that might resolve some issues. In the meantime though, I'd appreciate any suggestions for what might be causing this last error.

      Thanks,
      Claire

      make-20240531-v1.txt
      238kB

      ooh, I think you have more than one C++ compiler and somehow 2 different versions are being used. Can you do mpic++ --version and g++ --version and see if you have the same output? Can you also do which -a g++ and see if you have more than one?

        mathieumorlighem I got the same output for mpic++ --version and g++ --version and only one version of g++. Here's the specific output I got:

        bash-3.2$ mpic++ --version
        Apple clang version 14.0.0 (clang-1400.0.29.202)
        Target: x86_64-apple-darwin21.6.0
        Thread model: posix
        InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
        bash-3.2$ g++ --version
        Apple clang version 14.0.0 (clang-1400.0.29.202)
        Target: x86_64-apple-darwin21.6.0
        Thread model: posix
        InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
        bash-3.2$ which -a g++
        /usr/bin/g++

        You may be missing the option --with-fortran-lib= in your configure.sh script. Mine looks like this (could be different for you:

           --with-fortran-lib="-L/usr/local/gfortran/lib/ -lgfortran" \

        Could you try configuring ISSM again (no need to reinstall external packages) and compiling?
        Mathieu

          mathieumorlighem I have the line --with-fortran-lib="-L/usr/local/gfortran/lib -lgfortran" in my configure.sh, since /usr/local/gfortran/lib is also the correct location for the version of gfortran that I installed. I included the -L at the beginning and the -lgfortran at the end based on the example configure script, though I'm not sure what they do. I'm also not sure if /usr/local/gfortran/lib is the version of gfortran actually being used by my machine when I'm doing make. When I try which gfortran I get /usr/local/bin/gfortran which is not the version I installed, and it also isn't a directory (so there's no /usr/local/bin/gfortran/lib). I added usr/local/gfortran and usr/local/gfortran/lib to my path in my .bash_profile but still get /usr/local/bin/gfortran when I try which gfortran. Not sure if that's relevant, but I thought it could be part of the problem...
          Thanks for your help so far.

          ok let's try something else. Can you do mpifort -show and show us the output? and then

          cat $ISSM_DIR/externalpackages/petsc/install/lib/petsc/conf/petscvariables | grep PETSC_EXTERNAL_LIB_BASIC

          and show us the output? That should help

            mathieumorlighem mpifort -show gives:
            gfortran -g -O2 -fPIC -fallow-argument-mismatch -I/Users/clairec/trunk/externalpackages/petsc/install/include -I/Users/clairec/trunk/externalpackages/petsc/install/include -L/Users/clairec/trunk/externalpackages/petsc/install/lib -lmpifort -lmpi -lpmpi

            cat $ISSM_DIR/externalpackages/petsc/install/lib/petsc/conf/petscvariables | grep PETSC_EXTERNAL_LIB_BASIC gives:
            SL_LINKER_LIBS = ${PETSC_EXTERNAL_LIB_BASIC}
            PETSC_EXTERNAL_LIB_BASIC = -Wl,-rpath,/Users/clairec/trunk/externalpackages/petsc/install/lib -L/Users/clairec/trunk/externalpackages/petsc/install/lib -Wl,-rpath,/usr/local/Cellar/gcc/13.2.0/lib/gcc/current/gcc/x86_64-apple-darwin20/13 -L/usr/local/Cellar/gcc/13.2.0/lib/gcc/current/gcc/x86_64-apple-darwin20/13 -Wl,-rpath,/usr/local/Cellar/gcc/13.2.0/lib/gcc/current/gcc -L/usr/local/Cellar/gcc/13.2.0/lib/gcc/current/gcc -Wl,-rpath,/usr/local/Cellar/gcc/13.2.0/lib/gcc/current -L/usr/local/Cellar/gcc/13.2.0/lib/gcc/current -ldmumps -lmumps_common -lpord -lpthread -lscalapack -lflapack -lfblas -lparmetis -lmetis -lz -lmpifort -lmpi -lpmpi -lgfortran -lgcc_s.1.1 -lquadmath -lc++

            haha! You are using Homebrew... we will try to make it work but it creates all sorts of library conflicts. Alright, looking at this, it shows that you need to link against libgfortran.so and it should be here: /usr/local/Cellar/gcc/13.2.0/lib/gcc/current/ can you check? If that's the case you can use this:

               --with-fortran-lib="-L/usr/local/Cellar/gcc/13.2.0/lib/gcc/current/ -lgfortran" \

              mathieumorlighem Alternatively, Claire, you could uninstall either the copy you installed to /usr/local or the copy installed via Homebrew. Note that because of some changes that Apple has made to the way shared libraries are linked, you may need to recompile your external packages after you have landed on one installation of gfortran.

                mathieumorlighem I checked /usr/local/Cellar/gcc/13.2.0/lib/gcc/current and these files starting with libgfortran were present, but not libgfortran.so:

                libgfortran.5.dylib
                libgfortran.a
                libgfortran.dylib
                libgfortran.spec

                I also searched /usr/local for libgfortran.so but did not find it anywhere in that directory.

                  clairewcook That's okay. .dylib is the equivalent of .so under macOS. If you do find /usr/local -name libgfortran*.dylib, then all instances should be shown.

                  yep sorry! I forgot you had a mac, yes dylib is the equivalent of so, that command should work

                  7 months later

                  Hi @mathieumorlighem and @justinquinn, I am running into a similar problem to @clairewcook's first problem related to MPICH. I am installing ISSM from source via the ISSM github on MacOS (Sonoma 14.7.2), but having issues with the petsc install script. I am using the ISSM/externalpackages/petsc/install-3.22-mac.sh script and it fails on the make call for MPICH. Here is the relevant stdout from the script:

                  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                  The version of PETSc you are using is out-of-date, we recommend updating to the new release
                   Available Version: 3.22.2   Installed Version: 3.22.0
                  https://petsc.org/release/download/
                  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                  =============================================================================================
                                           Configuring PETSc to compile on your system
                  =============================================================================================
                  =============================================================================================
                                                       ***** WARNING *****
                    Found environment variable: LDFLAGS= -Wl,-ld_classic -Wl,-commons,use_dylibs. Ignoring
                    it, since it's also set on command line
                  =============================================================================================
                  =============================================================================================
                                                       ***** WARNING *****
                    Using default C optimization flags "-g -O3". You might consider manually setting optimal
                    optimization flags for your system with COPTFLAGS="optimization flags" see
                    config/examples/arch-*-opt.py for examples
                  =============================================================================================
                  =============================================================================================
                                                       ***** WARNING *****
                    Using default Cxx optimization flags "-g -O3". You might consider manually setting
                    optimal optimization flags for your system with CXXOPTFLAGS="optimization flags" see
                    config/examples/arch-*-opt.py for examples
                  =============================================================================================
                  =============================================================================================
                                                       ***** WARNING *****
                    Using default FC optimization flags "-g -O". You might consider manually setting optimal
                    optimization flags for your system with FOPTFLAGS="optimization flags" see
                    config/examples/arch-*-opt.py for examples
                  =============================================================================================
                  =============================================================================================
                                                       ***** WARNING *****
                    You have a version of GNU make older than 4.0. It will work, but may not support all the
                    parallel testing options. You can install the latest GNU make with your package manager,
                    such as Brew or MacPorts, or use the --download-make option to get the latest GNU make
                  =============================================================================================
                  =============================================================================================
                    Trying to download
                    https://github.com/pmodels/mpich/releases/download/v4.2.3rc1/mpich-4.2.3rc1.tar.gz for
                    MPICH
                  =============================================================================================
                  =============================================================================================
                                    Running configure on MPICH; this may take several minutes
                  =============================================================================================
                  =============================================================================================
                                       Running make on MPICH; this may take several minutes
                  =============================================================================================
                  
                  *********************************************************************************************
                             UNABLE to CONFIGURE with GIVEN OPTIONS (see configure.log for details):
                  ---------------------------------------------------------------------------------------------
                                            Error running make; make install on MPICH
                  *********************************************************************************************

                  I also looked at configure.log but it is quite long (80,000 lines) with a lot of error and critical error messages. Can you help me look into this?

                    elizadawson Yes, could you please attach your configure.log (you can use the little upload button when replying)?

                      Hi @justinquinn just wanted to follow up about the petsc installation problems to see if you have any suggestions. Also I forgot to mention before that I am installing on a mac with apple silicon chip (sonoma 14.7.2). Thanks for your help!