Xcode 15 Beta: Duplicate LC_RPATH are deprecated – Xcode

by
Ali Hasan
axios xcode

Quick Fix: In Xcode 15, to prevent duplicate LC_RPATH warnings, add -ld_classic in the Other Linker Flags build setting.

The Problem:

When building an iOS project on Xcode 15 Beta 3, users encounter build warnings related to deprecated duplicate LC_RPATH in the form of ‘@executable_path/Frameworks’ and ‘@loader_path/Frameworks’. These warnings were not present in previous versions, such as Xcode 14, and users are seeking guidance on how to address or determine the significance of these deprecation warnings.

The Solutions:

Solution 1: -ld_classic

In Xcode 15, the linker has been updated to use a new format for specifying runtime paths. This change can cause duplicate LC_RPATH entries to be generated, which can lead to build warnings.

To prevent this warning, add -ld_classic to the Other Linker Flags build setting. This flag tells the linker to use the classic format for specifying runtime paths, which will prevent the duplicate LC_RPATH entries from being generated.

Build Settings -> Other Linker Flags -> Add `-ld_classic`

Solution 2: Investigate Third-Party Libraries

Xcode 15’s linker now detects and warns about duplicate LC_RPATH entries. These warnings are often caused by third-party libraries. To resolve the issue:

  1. Identify the third-party libraries causing the warnings by following the approach described in the GitHub issue linked in the provided answer.
  2. Once the problematic libraries are identified, remove duplicate LC_RPATH entries from their build settings. This can be done in the LD_RUNPATH_SEARCH_PATHS or similar parameter.

Solution 3: Add -ld64 to Other Linker Flags

Locate the “Target” section in your Xcode project’s Build Settings.

Within the "Target" section, navigate to the "Build Options" group.

Under the "Build Options" group, find the "Other Linker Flags" field.

In the "Other Linker Flags" field, add -ld64 to the existing flags.

Click "Apply" to save your changes.

Q&A

Xcode 15 Beta 3, Build Warnings

Add -ld_classic in Other Linker Flags

Xcode 15 Beta 6, LD warnings

Third-party libraries may generate the warnings. Contact library authors.

Xcode 15 Beta 3, Add -ld64

Add -ld64 in Other Linker Flags

Video Explanation:

The following video, titled "How to fix Linker error (Undefined symbols for architecture arm64 ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

This video provides further insights and detailed explanations related to the content discussed in the article.