Skip to content

Latest commit

 

History

History
50 lines (34 loc) · 1.79 KB

troubleshooting.md

File metadata and controls

50 lines (34 loc) · 1.79 KB

< Documentation

Troubleshooting

Linking strategy

Typically, this plugin offers two ways of handling linking libraries/frameworks of a package.

  • Based on xcconfig settings. This is the default linking
  • [DEPRECATED] Xcode's default linking

Based on xcconfig settings

We rely on xcconfig settings to provide all linker flags for a package's libraries/frameworks. This aligns with how CocoaPods is currently linking pod targets. This strategy is going to be how the plugin handles linking in the long term.

[DEPRECATED] Xcode's default linking

With this strategy, a product of a package is added to the "Link Binary With Libraries" section of a dependent target.

To opt in for this strategy, use the option use_default_xcode_linking (nested inside the :linking option) as follows:

spm_pkg "Foo",
        :path => "url/to/package",
        :linking => {
          :use_default_xcode_linking => true # <-- HERE
        }

While letting Xcode handles the linking is reliable, we might end up with some issues.

Duplicate symbols error

We often encounter the Duplicate symbols error during linking phases.

This happens when the -ObjC linker flag is present (related: here). This seems to be an issue with the new linker (since Xcode 15).

A workaround for this issue is to switch to the old linker by adding the -ld_classic linker flag.
Use the :linker_flags option (nested inside the :linking option) for this purpose.

spm_pkg "Foo",
        :path => "url/to/package",
        :linking => {
          :use_default_xcode_linking => true,
          :linker_flags => ["-ld_classic"] # <-- HERE
        }