Skip to content

[Bug] Importing packages with internal targets results in 'missing required module' error #171

@robertlis-qz

Description

@robertlis-qz

What happened?

I am trying to use spm_pkg to import RxSwift as a Swift package in my otherwise Cocoapods based project as follows:

  spm_pkg "RxSwift",
          :url => "https://github.com/ReactiveX/RxSwift.git",
          :version => "6.9.0",
          :products => ["RxSwift", "RxCocoa", "RxRelay", "RxBlocking", "RxTest"]

However, using RxSwift in my internal pod by declaring it as a dependency

  s.spm_dependency "RxSwift/RxRelay"
  s.spm_dependency "RxSwift/RxCocoa"
  s.spm_dependency "RxSwift/RxSwift"

results in missing required module RxCocoaRuntime compilation error wherever RxSwift is imported. Having looked at RxSwift's https://github.com/ReactiveX/RxSwift/blob/main/Package%40swift-5.9.swift it seems that RxCocoaRuntime is an internal target which does not seem to generate .swiftmodule when build. Generated .xcconfig files of my internal pods do appear to look for it:

OTHER_SWIFT_FLAGS =
...
-fmodule-map-file="${GENERATED_MODULEMAP_DIR}/RxCocoaRuntime.modulemap" -Xcc
...

Which results in a compilation error. Not quite sure how to work around this.

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions