delocate icon indicating copy to clipboard operation
delocate copied to clipboard

Delocate "@rpath" when search paths include "/usr/lib/swift"

Open timoffex opened this issue 6 months ago • 13 comments

Describe the bug delocate works with /usr/lib/swift/libswiftCore.dylib paths, but fails with @rpath/libswiftCore.dylib when the search path includes "/usr/lib/swift".

Expected behavior I'm not sure. This might not be a bug; I can understand why the latter might not work. Do you have any pointers as to why the Swift package manager (swift build) might output @rpath/ entries in one environment, and /usr/lib/swift/ entries in another? I would really appreciate some help.

See additional context.

Platform (please complete the following information):

  • OS version: macOS 13
  • Delocate version: 0.10.4

Additional context When I build a Swift binary on my personal laptop, otool -L outputs a bunch of paths like

  • /usr/lib/swift/libswiftCore.dylib
  • /usr/lib/swift/libswiftCoreFoundation.dylib
  • /usr/lib/swift/libswiftCoreImage.dylib
  • ...

My "/usr/lib/swift" does not include those directories, but the binary works fine (I don't understand why) and delocate works fine as well.

When I do the same in a GitHub workflow, the otool -L output instead shows

  • @rpath/libswiftCore.dylib
  • @rpath/libswiftCoreFoundation.dylib
  • @rpath/libswiftCoreImage.dylib
  • ...

I don't know where the discrepancy comes from exactly, but I know that the macOS version is different and that the CI is using Xcode_15.1.app whereas I'm using the Xcode CommandLineTools.

Importantly, however, the error messages show that the RPATH includes /usr/lib/swift:

  ERROR:delocate.libsana:
  @rpath/libswiftCore.dylib not found:
    Needed by: /private/var/folders/14/hgs_fjmn5ms001tb8qtxxn5c0000gn/T/tmp3fkfmyzr/wheel/wandb_core/AppleStats
    Search path:
      /usr/lib/swift
      @loader_path
      /Applications/Xcode_15.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.5/macosx

So I would expect delocate to have the same behavior in my CI as on my personal laptop.

timoffex avatar Feb 08 '24 05:02 timoffex