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

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

Closed
robmaceachern opened this Issue Nov 13, 2018 · 6 comments

Comments

Projects
None yet
3 participants
@robmaceachern
Copy link

robmaceachern commented Nov 13, 2018

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

  • iOS
  • macOS
  • tvOS
  • watchOS
  • playgrounds

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

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

Xcode version:

10.1

Installation method:

  • CocoaPods
  • Carthage
  • Git submodules

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

  • 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
  • I have a small code base
  • I have a significant code base
@kzaher

This comment has been minimized.

Copy link
Member

kzaher commented Nov 14, 2018

Hi @robmaceachern ,

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

@radex

This comment has been minimized.

Copy link
Contributor

radex commented Nov 15, 2018

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 :) )

@kzaher

This comment has been minimized.

Copy link
Member

kzaher commented Nov 15, 2018

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

@robmaceachern

This comment has been minimized.

Copy link

robmaceachern commented Nov 15, 2018

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

@kzaher

This comment has been minimized.

Copy link
Member

kzaher commented Dec 14, 2018

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?

kzaher added a commit that referenced this issue Dec 16, 2018

@kzaher

This comment has been minimized.

Copy link
Member

kzaher commented Dec 16, 2018

There was caching issue.

@kzaher kzaher closed this Dec 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment