Hi @justinquinn
I keep tinkering with this in the hope that it will be useful to me, or someone else! I think I've narrowed down the issue (at least a little). Apologies for the longwinded post, but I wanted to document this progress.
Using the ISSM external package install scripts, I've been able to successfully build and run ISSM using the gfortran version here (based on initial recommendation from @mathieumorlighem). However, this build is where I ran into issue with the inversion. This issue looks to stem from the PETSc install.
To try and rectify this, I have been attempting a new build with updates to everything. I updated the package versions called in the ISSM external package installation scripts, and was able to return another successful build using this same gfortan version. The inversion issue remained.
Following this, I grabbed the different experimental gfortran version (here) built intentionally for Monterey on ARM machines. Using this gfortran version, all external packages install successfully, but when running make
, I get the pesky ld: file not found: @rpath/libgcc_s.1.1.dylib for architecture arm64
error. This is where I get [alot] out of my depth.
I chased down that the libgfortran.dylib
is linked to the libgcc_s.1.1.dylib
, so I suspect this is where the issue arises. I think it's the use of @rpath
here that's the issue. In the original gfortran version (where make
is successful), the linked libraries appear to use absolute paths, and not the @rpath
call. For example, running otool -L libgfortran.dylib
on the original gfortran version returns:
/usr/local/gfortran/lib/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
/usr/local/gfortran/lib/libgcc_s.2.dylib (compatibility version 2.0.0, current version 2.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)
Running otool -L libgfortran.dylib
on the updated gfortran version (where make
is unsuccessful) returns:
@rpath/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
@rpath/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
@rpath/libgcc_s.1.1.dylib (compatibility version 1.0.0, current version 1.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)
I tried using the install_name_tool
to force the @rpath
to be an absolute path. While this worked to return absolute paths when running otool -L libgfortran.dylib
, it broke the gfortran build (probably not unsurprisingly!). When trying to re-install PETSc using this brute-forced change, PETSc fails with the following error:
Cannot run executables created with FC. If this machine uses a batch system
to submit jobs you will need to configure using ./configure with the additional option --with-batch.
Otherwise there is problem with the compilers. Can you compile and run code with your compiler 'gfortran'?
Do you have any knowledge of the use of @rpath
and how I might be able to overcome this linking issue? I'm wondering if there is another flag that can be included in the configure/make step (probably needed for the PETSc build itself) that can specify what/where @rpath
refers to? My suspicion/fear is that this all needs to happen during the build of gfortran though 🙁.
Apologies if this all appears way out-to-lunch - I'm definitely out of my depth here and have just been sleuthing the internet for potential clues.
Thanks!
Lawrence