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

Pod install using cocoapods 1.11.0 fails with a does not define modules message #10912

Closed
1 task done
polmum opened this issue Sep 2, 2021 · 16 comments · Fixed by #10914
Closed
1 task done

Pod install using cocoapods 1.11.0 fails with a does not define modules message #10912

polmum opened this issue Sep 2, 2021 · 16 comments · Fixed by #10914
Labels
s2:confirmed Issues that have been confirmed by a CocoaPods contributor s7:workaround available A workaround for the issue is available
Milestone

Comments

@polmum
Copy link

polmum commented Sep 2, 2021

Report

What did you do?

Run pod install using the latest cocoapods version (1.11.0)

What did you expect to happen?

Install all pod dependencies correctly, as it was happening with the previous version (1.10.1).

What happened instead?

The command failed with the following message:

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

The Swift pod `BidMachine` depends upon `Protobuf`, which does 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.

CocoaPods Environment

Stack

   CocoaPods : 1.11.0
        Ruby : ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin19]
    RubyGems : 3.0.3
        Host : macOS 11.4 (20F71)
       Xcode : 12.5.1 (12E507)
         Git : git version 2.30.1 (Apple Git-130)
Ruby lib dir : /usr/local/Cellar/ruby@2.6/2.6.6_1/lib
Repositories :  trunk - CDN - https://cdn.cocoapods.org/

Installation Source

Executable Path: /Users/currentuser/.gem/bin/pod

Plugins

claide-plugins        : 0.9.2
cocoapods-deintegrate : 1.0.5
cocoapods-keys        : 2.2.1
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.0

Podfile

platform :ios, '10.0'

target 'TestApp' do
  pod 'BidMachine'

  target 'TestAppTests' do
    inherit! :search_paths
  end

  target 'TestAppUITests' do

  end
end

Project that demonstrates the issue

CocoapodsTestApp.zip
If you run the sample project with older cocoapods versions, the pod install command will succeed.

@dnkoutso dnkoutso added this to the 1.11.1 milestone Sep 2, 2021
@dnkoutso
Copy link
Contributor

dnkoutso commented Sep 2, 2021

thanks for this great report and sample app. will investigate for 1.11.1

@dnkoutso
Copy link
Contributor

dnkoutso commented Sep 2, 2021

while i have not inspected this at all, there is a tiny chance cocoapods 1.11 now catches this case more correctly than previous versions but again I will need to investigate.

@polmum
Copy link
Author

polmum commented Sep 2, 2021

Yes, I was thinking this might be the case, but I wanted to make sure by letting you know. If this is indeed the case, there will most likely be more users with issues like the one I'm reporting.

@dnkoutso
Copy link
Contributor

dnkoutso commented Sep 2, 2021

if it is the case then the error message describes what needs to be done but lets cross that bridge if its true

@polmum
Copy link
Author

polmum commented Sep 2, 2021

Agreed.
I really hope that's not the case though, as we'd rather not use use_modular_headers! globally, and the :modular_headers => true flag in this case would have to be used on a indirect dependency (we do not depend upon Protobuf directly).

@dnkoutso
Copy link
Contributor

dnkoutso commented Sep 2, 2021

a quick look shows that no changes were made related to throwing this warning...........this is kinda weird.

@dnkoutso
Copy link
Contributor

dnkoutso commented Sep 2, 2021

@polmum I think I found the culprit and might be "by design" after all.

The pod BidMachine (https://github.com/appodeal/CocoaPods/blob/master/BidMachine/1.7.3.5/BidMachine.podspec) has no sources and its a treated as a vendored pre-compiled pod.

There is a change in 1.11.0 that inspects whether this pod uses swift or not to fix this issue which now checks if the pod author has specified swift_versions in their podspec as the supported version of Swift for a pre-compiled pod.

So CocoaPods now treats BidMachine as if it uses swift and performs the checks needed. This now causes the inspect to scan BidMachine to ensure its dependencies for static libraries are also using modular headers for its dependencies so the Protobuf pod breaks now.

This is only limited to a very specific scenario or using static libraries and consuming pre-compiled pods.

There is an enhancement somewhere here that asks to skip some dependencies if they are not imported from modular headers but that is for non-vendored frameworks.

Based on this change and fix I think you'd have to modular_headers true.

@dnkoutso dnkoutso added the s1:awaiting input Waiting for input from the original author label Sep 2, 2021
@stale stale bot removed the s1:awaiting input Waiting for input from the original author label Sep 2, 2021
@dnkoutso dnkoutso added the s1:awaiting input Waiting for input from the original author label Sep 2, 2021
@dnkoutso
Copy link
Contributor

dnkoutso commented Sep 2, 2021

Was able to pod install and compile successfully with:

platform :ios, '10.0'

target 'TestApp' do
  pod 'BidMachine'
  pod 'Protobuf', :modular_headers => true

  target 'TestAppTests' do
    inherit! :search_paths
  end

  target 'TestAppUITests' do

  end
end

@stale stale bot removed the s1:awaiting input Waiting for input from the original author label Sep 2, 2021
@dnkoutso dnkoutso added the s1:awaiting input Waiting for input from the original author label Sep 2, 2021
@dnkoutso
Copy link
Contributor

dnkoutso commented Sep 2, 2021

We could maybe update the check to skip inspecting targets that do not require building? They are afterall pre built...

@stale stale bot removed the s1:awaiting input Waiting for input from the original author label Sep 2, 2021
@dnkoutso
Copy link
Contributor

dnkoutso commented Sep 2, 2021

@polmum I will be updating to relax the validation to exclude prebuilt pods.

@dnkoutso dnkoutso added s7:workaround available A workaround for the issue is available s2:confirmed Issues that have been confirmed by a CocoaPods contributor labels Sep 2, 2021
@dnkoutso
Copy link
Contributor

dnkoutso commented Sep 2, 2021

PR up #10914

@polmum
Copy link
Author

polmum commented Sep 2, 2021

Great news! Thanks for your quick replies and for considering relaxing the validation.
I was not really a big fan of adding Protobuf to the podfile, as it was not really a dependency of our project. Also, unless i'm mistaken, an update on the depended version of Protobuf by BidMachine would have forced us to do a pod update Protobuf instead of a pod install

@dnkoutso
Copy link
Contributor

dnkoutso commented Sep 2, 2021

Merged. I will wait a few days for 1.11.1 for new issues to pop up. You can use Bundler in the meantime to point to the 1-11-stable branch if you need this fix today.

@umang-simform
Copy link

It worked, thank you :)

@dnkoutso
Copy link
Contributor

dnkoutso commented Sep 7, 2021

awesome!

@dnkoutso dnkoutso modified the milestones: 1.11.1, 1.11.2 Sep 13, 2021
@dnkoutso
Copy link
Contributor

dnkoutso commented Sep 13, 2021

I accidentally merged the fix to master branch and not 1-11-stable, this will now go to 1.11.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s2:confirmed Issues that have been confirmed by a CocoaPods contributor s7:workaround available A workaround for the issue is available
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants