Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect OTHER_LDFLAGS generated for XCFrameworks containing libraries #10071

Closed
1 task done
Westacular opened this issue Sep 20, 2020 · 0 comments
Closed
1 task done
Labels
r:xcframeworks Related to the support for XCFrameworks
Milestone

Comments

@Westacular
Copy link
Contributor

Report

What did you do?

pod install with in a project with use_frameworks! (and dynamic linking), where one of the dependencies includes a vendored XCFramework containing a .a library where the library name does not match the XCFramework name.

(Specifically, I'm working with Swift-sodium, a Swift wrapper of the Sodium C library, which vendors Clibsodium.xcframework that contains libsodium.a libraries for various architectures.)

What did you expect to happen?

The pod target's xcconfig should have OTHER_LDFLAGS = $(inherited) -l"sodium"

What happened instead?

The XCFramework's name is used instead: OTHER_LDFLAGS = $(inherited) -l"Clibsodium"

... and the build fails.

However, if :linkage => :static is used, the app target's OTHER_LDFLAGS does contain the correct -l"sodium", and things work correctly.

I believe the issue is that define_build_settings_method :libraries uses the raw name

            xcframework_libraries = vendored_xcframeworks.
                                    select { |xcf| xcf.build_type.static_library? }.
                                    map(&:name).
                                    uniq

while define_build_settings_method :static_libraries_to_import actually inspects for the contained library's name:

            xcframework_libraries = vendored_xcframeworks.
                                    select { |xcf| xcf.build_type.static_library? }.
                                    flat_map { |xcf| linker_names_from_libraries([xcf.slices.first.binary_path]) }.
                                    uniq

Assuming that's the case, and both these code blocks should be the same, I'll have a PR to fix this shortly.

CocoaPods Environment

Stack

   CocoaPods : 1.10.0.rc.1
        Ruby : ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19]
    RubyGems : 3.0.3
        Host : Mac OS X 10.15.6 (19G2021)
       Xcode : 12.0 (12A7209)
         Git : git version 2.26.2
Ruby lib dir : /Users/wes/.rbenv/versions/2.6.5/lib

Installation Source

Executable Path: /Users/wes/.rbenv/versions/2.6.5/bin/pod

Plugins

claide-plugins         : 0.9.2
cocoapods-deintegrate  : 1.0.4
cocoapods-dependencies : 1.0.0.beta.1
cocoapods-plugins      : 1.0.0
cocoapods-search       : 1.0.0
cocoapods-stats        : 1.1.0
cocoapods-trunk        : 1.5.0
cocoapods-try          : 1.2.0
cocoapods_debug        : 0.1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
r:xcframeworks Related to the support for XCFrameworks
Projects
None yet
Development

No branches or pull requests

2 participants