RxSwift 4.4 can't be integrated as Cocoapods static library due to RxAtomic dependency

Created on 13 Nov 2018  Â·  6Comments  Â·  Source: ReactiveX/RxSwift

Short description of the issue:

Cocoapods (1.6.0.beta.2) can't integrate RxSwift 4.4 as a static library without workarounds. RxSwift 4.3 doesn't have this problem. Sample Podfile:

platform :ios, '11.0'

target 'Project' do
  pod 'RxSwift', '~> 4.4'
end

Expected outcome:

pod install succeeds: Pod installation complete!

What actually happens:

pod install fails:

[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod `RxSwift` depends upon `RxAtomic`, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.

Workarounds

  1. Add use_modular_headers! to the Podfile. This allows the integration to succeed but it applies to all pods in the Podfile (I'm not sure what side-effects this could potentially have).
  2. Add pod 'RxAtomic', '~> 4.0', :modular_headers => true to the Podfile. Allows integration to succeed. Not sure about the side-effects but should be safer than use_modular_headers!.

RxSwift/RxCocoa/RxBlocking/RxTest version/commit

4.4

Platform/Environment

  • [x] iOS
  • [ ] macOS
  • [ ] tvOS
  • [ ] watchOS
  • [ ] playgrounds

How easy is to reproduce? (chances of successful reproduce after running the self contained code)

  • [x] easy, 100% repro
  • [ ] sometimes, 10%-100%
  • [ ] hard, 2% - 10%
  • [ ] extremely hard, %0 - 2%

Xcode version:

10.1

Installation method:

  • [x] CocoaPods
  • [ ] Carthage
  • [ ] Git submodules

I have multiple versions of Xcode installed:
(so we can know if this is a potential cause of your issue)

  • [x] yes (9.4.1, 10.0, 10.1)
  • [ ] no

Level of RxSwift knowledge:
(this is so we can understand your level of knowledge
and formulate the response in an appropriate manner)

  • [ ] just starting
  • [x] I have a small code base
  • [ ] I have a significant code base

Most helpful comment

There was caching issue.

All 6 comments

Hi @robmaceachern ,

The workarounds you've suggested are only workarounds for Podfile. Any idea what should we do to add proper support? PR?

I have the same issue, but the workarounds are not working for me. My Podfile setup is… well… pretty complicated:

def common
  pod 'RxSwift',                '~> 4.0', inhibit_warnings: true
  pod 'RxCocoa',                '~> 4.0'
  pod 'RxAtomic',               '~> 4.0', :modular_headers => true
  # other pods…
end

abstract_target 'CommonIOS' do
  platform :ios, '11.2'
  use_frameworks!

  common

  target 'iOS' do
    # other pods
  end

  target 'NozbeKit' # <- this is a framework included by main app and also app extensions of the same app
  # … app extensions
end

target 'WatchApp' do
  platform :watchos, '3.0'
  use_frameworks!

  common
end

(I don't have a solution to offer, but I thought I'll post this so that a nested frameworks case is taken into account in the discussion :) )

Ok, but does anyone know what do we need to add to our RxAtomic podfile to support this properly?

I’m not very familiar with the details of this but it looks like what is required is setting DEFINES_MODULE in the podspec config settings. From the Cocoapods 1.5 release notes:

... you will be able to opt into stricter header search paths (and module map generation for Objective-C pods). As a pod author, you can add 'DEFINES_MODULE' => 'YES' to your pod_target_xcconfig.

So something like this to RxAtomic.podspec might work:

s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }

I don't have time for a PR at the moment but if some free time opens up I can give it a try.

Possibly useful info:
ios - Is there any downside to setting DEFINES_MODULE = YES in my podspec? - Stack Overflow

As far as I can tell adding use_modular_headers! to top of Podfile works.

Adding s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } to RxAtomic.podspec doesn't work as far as I can tell. (Cocoapods 1.6.0-beta.2)

Does anybody have any more information?

There was caching issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Z-JaDe picture Z-JaDe  Â·  3Comments

jeremiegirault picture jeremiegirault  Â·  3Comments

marlowcharite picture marlowcharite  Â·  3Comments

RobinFalko picture RobinFalko  Â·  3Comments

trant picture trant  Â·  3Comments