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 fails while trying to call present? on a nil when using activesupport 7.1.0 #12089

Closed
1 task done
nikolaykasyanov opened this issue Oct 10, 2023 · 9 comments
Closed
1 task done

Comments

@nikolaykasyanov
Copy link
Contributor

nikolaykasyanov commented Oct 10, 2023

Report

What did you do?

Used CocoaPods master in my Gemfile:

gem 'cocoapods', git: 'git@github.com:CocoaPods/CocoaPods.git', branch: 'master'

Then I ran bundle update cocoapods to get the changes from #12082, which bumped both the cocoapods (to 2164788) and activesupport (to 7.1.0) gems.

Then I ran pod install.

What did you expect to happen?

pod install to succeed.

What happened instead?

NoMethodError - undefined method `present?' for nil:NilClass
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/CocoaPods-216478820851/lib/cocoapods/installer/podfile_validator.rb:100:in `validate_conflicting_external_sources!'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/CocoaPods-216478820851/lib/cocoapods/installer/podfile_validator.rb:85:in `block in validate_pod_directives'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/CocoaPods-216478820851/lib/cocoapods/installer/podfile_validator.rb:84:in `each'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/CocoaPods-216478820851/lib/cocoapods/installer/podfile_validator.rb:84:in `validate_pod_directives'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/CocoaPods-216478820851/lib/cocoapods/installer/podfile_validator.rb:40:in `validate'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/CocoaPods-216478820851/lib/cocoapods/installer/analyzer.rb:225:in `validate_podfile!'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/CocoaPods-216478820851/lib/cocoapods/installer/analyzer.rb:104:in `analyze'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/CocoaPods-216478820851/lib/cocoapods/installer.rb:422:in `analyze'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/CocoaPods-216478820851/lib/cocoapods/installer.rb:244:in `block in resolve_dependencies'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/CocoaPods-216478820851/lib/cocoapods/user_interface.rb:64:in `section'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/CocoaPods-216478820851/lib/cocoapods/installer.rb:243:in `resolve_dependencies'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/CocoaPods-216478820851/lib/cocoapods/installer.rb:162:in `install!'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/CocoaPods-216478820851/lib/cocoapods/command/install.rb:52:in `run'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/CocoaPods-216478820851/lib/cocoapods/command.rb:52:in `run'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/CocoaPods-216478820851/bin/pod:55:in `<top (required)>'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bin/pod:25:in `load'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bin/pod:25:in `<top (required)>'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bundler-2.2.18/lib/bundler/cli/exec.rb:63:in `load'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bundler-2.2.18/lib/bundler/cli/exec.rb:63:in `kernel_load'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bundler-2.2.18/lib/bundler/cli/exec.rb:28:in `run'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bundler-2.2.18/lib/bundler/cli.rb:474:in `exec'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bundler-2.2.18/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bundler-2.2.18/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bundler-2.2.18/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bundler-2.2.18/lib/bundler/cli.rb:30:in `dispatch'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bundler-2.2.18/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bundler-2.2.18/lib/bundler/cli.rb:24:in `start'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bundler-2.2.18/exe/bundle:49:in `block in <top (required)>'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bundler-2.2.18/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'
/Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bundler-2.2.18/exe/bundle:37:in `<top (required)>'
/Users/Redacted/.rbenv/versions/3.0.3/bin/bundle:23:in `load'
/Users/Redacted/.rbenv/versions/3.0.3/bin/bundle:23:in `<main>'

The affected line:

pod_spec_or_path = external_source[:podspec].present? || external_source[:path].present?

CocoaPods Environment

Stack

   CocoaPods : 1.13.0
        Ruby : ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [arm64-darwin22]
    RubyGems : 3.2.32
        Host : macOS 14.0 (23A344)
       Xcode : 15.0 (15A240d)
         Git : git version 2.42.0
Ruby lib dir : /Users/Redacted/.rbenv/versions/3.0.3/lib
Repositories : <redacted> - git - git@github.com:<redacted>/<redacted>.git @ <redacted>

               <redacted> - git - https://github.com/<redacted>/<redacted> @ <redacted>

               trunk - CDN - https://cdn.cocoapods.org/

Installation Source

Executable Path: /Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bin/pod

Plugins

cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.0

Podfile

I can't share it at this time, sorry, although I can tell that a dependency with :source => and :tag => is the one CocoaPods stumbles at.

@shareefhadid
Copy link

I see the fix is on the main branch, could you kindly release as soon as possible? This has a huge impact on a large number of mobile developers.

@eluzgin
Copy link

eluzgin commented Oct 10, 2023

There are many broken iOS build pipelines after ActiveSupport 7.1.0 release.
We need fix released ASAP!

@Vyazovoy
Copy link

@dnkoutso, would you be able to make a patch release with the activesupport fix? Despite it is pretty easy to workaround with explicit activesupport version in Gemfile it would help a lot of people who is not so familiar with Ruby/Bundler

@nikolaykasyanov
Copy link
Contributor Author

@shareefhadid there's a fix for #12081 but not for this one as far as I can see.

@movila
Copy link

movila commented Oct 11, 2023

add

require 'active_support'
require 'active_support/core_ext'

into the cocoapods.rb might work.

@nikolaykasyanov in your case, into /Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/CocoaPods-216478820851/lib/cocoapods.rb

@nikolaykasyanov
Copy link
Contributor Author

@movila thank you, it does help. I raised #12089, is it okay to credit you in the changelog?

@amorde amorde closed this as completed in ee5acbe Oct 15, 2023
amorde added a commit that referenced this issue Oct 15, 2023
Require active_support/core_ext in cocoapods.rb to fix #12089
@Jun2786184671
Copy link

This is caused by cocoapods 1.13.0 not yet adapting to the recent active_support 7.1.

Since active_support 7.1 has modified its api, and loads the minimum dependencies by default. It is broken in small pieces so that only the desired extensions can be loaded. Users should cherry-pick the extensions they want.

Just add the following two lines

require "active_support"
require "active_support/core_ext"

into cocoapods gem file

~/.gem/gems/cocoapods-1.13.0/lib/cocoapods.rb (in my case)

before line 7

require 'active_support/core_ext/string/strip'

@Tolulope05
Copy link

This is caused by cocoapods 1.13.0 not yet adapting to the recent active_support 7.1.

Since active_support 7.1 has modified its api, and loads the minimum dependencies by default. It is broken in small pieces so that only the desired extensions can be loaded. Users should cherry-pick the extensions they want.

Just add the following two lines

require "active_support"
require "active_support/core_ext"

into cocoapods gem file

~/.gem/gems/cocoapods-1.13.0/lib/cocoapods.rb (in my case)

before line 7

require 'active_support/core_ext/string/strip'

This works like charm

@Tolulope05
Copy link

add

require 'active_support'
require 'active_support/core_ext'

into the cocoapods.rb might work.

@nikolaykasyanov in your case, into /Users/Redacted/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/bundler/gems/CocoaPods-216478820851/lib/cocoapods.rb

This was really helpful, Thank you.

kodiakhq bot pushed a commit to monde-sistemas/xml_data_extractor that referenced this issue Nov 30, 2023
Conforme [comentado nessa issue](CocoaPods/CocoaPods#12089 (comment)), o ActiveSupport 7.1 mudou sua API e agora carrega apenas as dependências mínimas. 
Foi preciso adicionar o  `require "active_support"` e o `require "active_support/core_ext"` para o "extractor" funcionar.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants