Broken dynamic linker/rpath with gfortran on darwin

I’m attempting to build wsjtx for darwin and i’ve fixed the usual suspects (disabling mac qt app deployment quirks, libiconv, iconutil → icnsutil in the build script), and the build works, but one of the binaries that contains Fortran (compiled with gfortran) loads a shim that fails to link with libgcc_s.1.1.dylib.

The error:

dyld[67252]: Library not loaded: @rpath/libgcc_s.1.1.dylib
  Referenced from: <8F7610B8-C577-36D8-B9E6-DBE4983B2DE9> /nix/store/v8a4n4yy1z6f71dxi3jmkbvvh7kr6i1m-gfortran-15.2.0-lib/lib/libgcc_s.1.dylib
  Reason: no LC_RPATH's found
zsh: abort   

I can’t tell if this is gfortran being broken or if i’m meant to add an rpath to the final binary (i’ve tried this but it seems to just get stripped).

relevant portion of otool -l output on libgcc_s.1.dylib

Load command 2
          cmd LC_ID_DYLIB
      cmdsize 112
         name /nix/store/v8a4n4yy1z6f71dxi3jmkbvvh7kr6i1m-gfortran-15.2.0-lib/lib/libgcc_s.1.dylib (offset 24)
   time stamp 1 Wed Dec 31 16:00:01 1969
      current version 1.1.0
compatibility version 1.0.0
Load command 3
      cmd LC_DYLD_CHAINED_FIXUPS
  cmdsize 16
  dataoff 16384
 datasize 48
Load command 4
      cmd LC_DYLD_EXPORTS_TRIE
  cmdsize 16
  dataoff 16432
 datasize 8
Load command 5
     cmd LC_SYMTAB
 cmdsize 24
  symoff 0
   nsyms 0
  stroff 16448
 strsize 8
Load command 6
            cmd LC_DYSYMTAB
        cmdsize 80
      ilocalsym 0
      nlocalsym 0
     iextdefsym 0
     nextdefsym 0
      iundefsym 0
      nundefsym 0
         tocoff 0
           ntoc 0
      modtaboff 0
        nmodtab 0
   extrefsymoff 0
    nextrefsyms 0
 indirectsymoff 0
  nindirectsyms 0
      extreloff 0
        nextrel 0
      locreloff 0
        nlocrel 0
Load command 7
     cmd LC_UUID
 cmdsize 24
    uuid 8F7610B8-C577-36D8-B9E6-DBE4983B2DE9
Load command 8
      cmd LC_BUILD_VERSION
  cmdsize 32
 platform 1
    minos 14.0
      sdk 14.4
   ntools 1
     tool 3
  version 954.16
Load command 9
      cmd LC_SOURCE_VERSION
  cmdsize 16
  version 0.0
Load command 10
          cmd LC_REEXPORT_DYLIB
      cmdsize 56
         name @rpath/libgcc_s.1.1.dylib (offset 24)
   time stamp 2 Wed Dec 31 16:00:02 1969
      current version 1.1.0
compatibility version 1.0.0
Load command 11
          cmd LC_LOAD_DYLIB
      cmdsize 56
         name /usr/lib/libSystem.B.dylib (offset 24)
   time stamp 2 Wed Dec 31 16:00:02 1969
      current version 1345.100.2
compatibility version 1.0.0
Load command 12
          cmd LC_LOAD_DYLIB
      cmdsize 104
         name /nix/store/y232hw0pamh3zsmjf8ilfyq2ichnzv6q-gettext-1.0/lib/libintl.8.dylib (offset 24)
   time stamp 2 Wed Dec 31 16:00:02 1969
      current version 13.6.0
compatibility version 13.0.0
Load command 13

frustratingly, libgcc_s.1.1.dylib exists in the same package lib/folder as .1.dylib To me this seems like an issue with the gfortran packaging (I think that rpath probably shouldn’t be there and should instead be an absolute link back into the store), but i’m not very familiar with this. Any help or input would be appreciated :slight_smile: