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

incompatibility with activesupport 7.1.0 #12081

Closed
konradzdunczyk opened this issue Oct 5, 2023 · 50 comments · Fixed by #12082
Closed

incompatibility with activesupport 7.1.0 #12081

konradzdunczyk opened this issue Oct 5, 2023 · 50 comments · Fixed by #12082

Comments

@konradzdunczyk
Copy link

konradzdunczyk commented Oct 5, 2023

activesupport 7.1.0 was released today (5.10.2023) and it breaks cocoapods entirely. If you update or install cocoapods, from this day, gem will install newest activesupport (7.1.0). cocoapods-core deasn't have strict version of it

s.add_runtime_dependency 'activesupport', '>= 5.0', '< 8'

If cocoapods install with activesupport 7.1.0 then any cocoapods command faile:

bundler: failed to load command: pod (/Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/bin/pod)
/Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-7.1.0/lib/active_support/core_ext/array/conversions.rb:108:in '<class:Array>': undefined method 'deprecator' for ActiveSupport:Module (NoMethodError)
Did you mean?  deprecate_constant
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-7.1.0/lib/active_support/core_ext/array/conversions.rb:8:in '<top (required)>'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/cocoapods-1.13.0/lib/cocoapods.rb:9:in 'require'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/cocoapods-1.13.0/lib/cocoapods.rb:9:in '<top (required)>'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/cocoapods-1.13.0/bin/pod:36:in 'require'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/cocoapods-1.13.0/bin/pod:36:in '<top (required)>'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/bin/pod:23:in 'load'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/bin/pod:23:in '<top (required)>'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.4.15/lib/bundler/cli/exec.rb:58:in 'load'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.4.15/lib/bundler/cli/exec.rb:58:in 'kernel_load'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.4.15/lib/bundler/cli/exec.rb:23:in 'run'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.4.15/lib/bundler/cli.rb:492:in 'exec'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.4.15/lib/bundler/vendor/thor/lib/thor/command.rb:27:in 'run'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.4.15/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in 'invoke_command'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.4.15/lib/bundler/vendor/thor/lib/thor.rb:392:in 'dispatch'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.4.15/lib/bundler/cli.rb:34:in 'dispatch'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.4.15/lib/bundler/vendor/thor/lib/thor/base.rb:485:in 'start'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.4.15/lib/bundler/cli.rb:28:in 'start'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.4.15/exe/bundle:37:in 'block in <top (required)>'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.4.15/lib/bundler/friendly_errors.rb:117:in 'with_friendly_errors'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/lib/ruby/gems/3.0.0/gems/bundler-2.4.15/exe/bundle:29:in '<top (required)>'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/bin/bundle:23:in 'load'
	from /Users/ext-kzduczyk/.asdf/installs/ruby/3.0.2/bin/bundle:23:in '<main>'

It doesn't matter if you use gem od bundler to run pod.
The problem has been issued on activesupport github: rails/rails#49495

@konradzdunczyk
Copy link
Author

konradzdunczyk commented Oct 5, 2023

WORKAROUND:
Add gem "activesupport", "= 7.0.8" to your Gemfile

#12081 (comment)

@itinance
Copy link

itinance commented Oct 5, 2023

For me, this happens when pod install is executed while running fastlane-tools for creating releases. It doesn't happen when I run pod install directly in the command line. I am using a Gemfile, including the workaround mentioned above, and have installed Cocoapods via homebrew.
Is someone facing the same?

@konradzdunczyk
Copy link
Author

For me, this happens when pod install is executed while running fastlane-tools for creating releases. It doesn't happen when I run pod install directly in the command line. I am using a Gemfile, including the workaround mentioned above, and have installed Cocoapods via homebrew.

Is someone facing the same?

Maybe fastlane use different version of pods/activesupport (for example via bundler)?

@macelangelo
Copy link

macelangelo commented Oct 5, 2023

Same problem as konradzdunczyk. We have fastlane set up to build a flutter app, and pod install fails to run, saying, Warning: CocoaPods is installed but broken. Skipping pod install. , which completely breaks the build.

Can confirm adding gem 'activesupport', '~> 7.0.8' to a gemfile fixes things for now.

@jisooround
Copy link

I haven't created any projects and I have the same problem, where can I find the gemfile?

@smart-fr
Copy link

smart-fr commented Oct 6, 2023

Same question for me: no project, just trying to use "pod install" in the folder of my Xcode project which was exported by the Construct 3 application with lacking libraries. Creating a Gemfile in this folder or in the cocoapods folder (where the pod executable is located) don't resolve the issue.

@konradzdunczyk
Copy link
Author

konradzdunczyk commented Oct 6, 2023

Same question for me: no project, just trying to use "pod install" in the folder of my Xcode project which was exported by the Construct 3 application with lacking libraries. Creating a Gemfile in this folder or in the cocoapods folder (where the pod executable is located) don't resolve the issue.

You have to use pods installed via gem / bundler.

I don't know other way how to force activesupport version then via Gemfile

@frytg
Copy link

frytg commented Oct 6, 2023

@jisooround @smart-fr This temporary workaround worked for me:

Create a file Gemfile (if there isn't one yet):

source "https://rubygems.org"

gem "activesupport", "~> 7.0.8"

Use said Gemfile to install this old version:

sudo bundle install

Then delete the new version:

sudo gem uninstall activesupport --version 7.1.0

You can also see the installed versions with this:

gem list

or

bundle info activesupport

(This is on Apple M1 with ruby and cocoapods via Homebrew!)

@ppamorim
Copy link

ppamorim commented Oct 6, 2023

This change destroyed my CI, I can't deploy our product all day long because this error happened and corrupted all our env.

@smart-fr
Copy link

smart-fr commented Oct 6, 2023

@frytg thank you!

It doesn't seem to work:

MoMac:3.2.2_1 stephane$ sudo bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on
this machine.
Fetching gem metadata from https://rubygems.org/........
Resolving dependencies...
Bundler could not find compatible versions for gem "ruby":
  In Gemfile:
    ruby

    activesupport (~> 7.0.8) was resolved to 7.0.8, which depends on
      ruby (>= 2.7.0)
MoMac:3.2.2_1 stephane$ sudo gem uninstall activesupport --version 7.1.0
Gem 'activesupport' is not installed

Do I do something wrong?

@konradzdunczyk
Copy link
Author

For everyone who use sudo with gem or bundler - use rbenv or alternatives to install newer version of ruby then the macos one. MacOS version of ruby sucks so changing it saves you a lot of problems. Choose version of ruby >= 3.0

@ratheesh-vr
Copy link

When I try to use gem "activesupport", "~> 7.0.8" i am getting Unknown command activesupport, error.

@konradzdunczyk
Copy link
Author

When I try to use gem "activesupport", "~> 7.0.8" i am getting Unknown command activesupport, error.

Because it's not a command. Use it in Gemfile.

@TwinklePatel3
Copy link

TwinklePatel3 commented Oct 7, 2023

Add this line to Gemfile of your project folder
gem 'activesupport', '~> 7.0.8'
Then follow these steps:

  • cd iOS to navigate to the ios folder.
  • bundle install to install Bundler
  • bundle update activesupport to update version of active support
  • bundle exec pod install to install the iOS dependencies managed by CocoaPods.

@rarkins
Copy link

rarkins commented Oct 7, 2023

How can you work around this if you install pod globally using a command like gem install cocoapods... followed by pod install?

@chengcheng1231
Copy link

chengcheng1231 commented Oct 7, 2023

My solution is to replace original gem 'cocoapods' with this below in Gemfile in root directory.

gem 'cocoapods', '~> 1.12'
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'

Then, cd ios to enter in ios folder and run these below. And it will work like before. I am not familiar with this part. Maybe some commands are not necessary. but it worked for me.

1. bundle update
2. bundle install
3. pod repo update
4. bundle exec pod install

@konradzdunczyk
Copy link
Author

How can you work around this if you install pod globally using a command like gem install cocoapods... followed by pod install?

Via brew? IDK. But cocapds installed via Gemfile is available globally so

  1. Intsall normal ruby via rbenv or similar
  2. Remove previus versions of cocoapds and activesupport
  3. Create dir with Gemfile (use one from this topic)
  4. gem install

I think it should works.

@smart-fr
Copy link

smart-fr commented Oct 7, 2023

How can you use this workaround if you install cocoapods globally via Homebrew?
Neither 'gem' nor 'bundle' commands apply in this case, I think.

@konradzdunczyk
Copy link
Author

How can you use this workaround if you install cocoapods globally via Homebrew?

Neither 'gem' nor 'bundle' commands apply in this case, I think.

Did you try?

@smart-fr
Copy link

smart-fr commented Oct 7, 2023

How can you use this workaround if you install cocoapods globally via Homebrew?
Neither 'gem' nor 'bundle' commands apply in this case, I think.

Did you try?

Yes: #12081 (comment)

@konradzdunczyk
Copy link
Author

How can you use this workaround if you install cocoapods globally via Homebrew?

Neither 'gem' nor 'bundle' commands apply in this case, I think.

Did you try?

Yes: #12081 (comment)

Did you change macos ruby to proper one as I mentioned here #12081 (comment) ?

Show me your Gemfile

@smart-fr
Copy link

smart-fr commented Oct 7, 2023

Thank you @konradzdunczyk, now I think I really have followed your instructions.
Here is the output. I'm a bit lost.

MoMac:ReKtaNG_0_4_39.ios.project stephane$ sudo gem uninstall activesupport --version 7.1.0
Password:
Gem 'activesupport' is not installed
MoMac:ReKtaNG_0_4_39.ios.project stephane$ bundle info activesupport
  * activesupport (7.0.8)
	Summary: A toolkit of support libraries and Ruby core extensions extracted from the Rails framework.
	Homepage: https://rubyonrails.org
	Documentation: https://api.rubyonrails.org/v7.0.8/
	Source Code: https://github.com/rails/rails/tree/v7.0.8/activesupport
	Changelog: https://github.com/rails/rails/blob/v7.0.8/activesupport/CHANGELOG.md
	Bug Tracker: https://github.com/rails/rails/issues
	Mailing List: https://discuss.rubyonrails.org/c/rubyonrails-talk
	Path: /Users/stephane/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/activesupport-7.0.8
MoMac:ReKtaNG_0_4_39.ios.project stephane$ pod install
/usr/local/Cellar/cocoapods/1.13.0/libexec/gems/activesupport-7.1.0/lib/active_support/core_ext/array/conversions.rb:108:in `<class:Array>': undefined method `deprecator' for ActiveSupport:Module (NoMethodError)

  deprecate to_default_s: :to_s, deprecator: ActiveSupport.deprecator
                                                          ^^^^^^^^^^^
Did you mean?  deprecate_constant
	from /usr/local/Cellar/cocoapods/1.13.0/libexec/gems/activesupport-7.1.0/lib/active_support/core_ext/array/conversions.rb:8:in `<top (required)>'
	from <internal:/usr/local/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/local/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/local/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/lib/cocoapods.rb:9:in `<top (required)>'
	from <internal:/usr/local/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/usr/local/Cellar/ruby/3.2.2_1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /usr/local/Cellar/cocoapods/1.13.0/libexec/gems/cocoapods-1.13.0/bin/pod:36:in `<top (required)>'
	from /usr/local/Cellar/cocoapods/1.13.0/libexec/bin/pod:25:in `load'
	from /usr/local/Cellar/cocoapods/1.13.0/libexec/bin/pod:25:in `<main>'

My Gemfile is:

source "https://rubygems.org"

gem "activesupport", "~> 7.0.8"

@opendeluxe
Copy link

I am confused about where to place the Gemfile? Do I need to put this in the Project base folder (where ios, android, src and so on lives) or in the iOS-Folder?

@konradzdunczyk
Copy link
Author

konradzdunczyk commented Oct 7, 2023

I wrote a little text how I use tools like cocoapods in my workflow. For the workaround call bundle add activesupport -v 7.0.8 in step 10.

https://gist.github.com/konradzdunczyk/3c07012b68cf4cf2185945242e544a21

iangmaia added a commit to woocommerce/woocommerce-ios that referenced this issue Oct 17, 2023
iangmaia added a commit to wordpress-mobile/WordPress-iOS that referenced this issue Oct 17, 2023
iangmaia added a commit to wordpress-mobile/WordPress-iOS that referenced this issue Oct 17, 2023
@Jun2786184671
Copy link

Jun2786184671 commented Oct 18, 2023

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. (See https://guides.rubyonrails.org/active_support_core_extensions.html#stand-alone-active-support)

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. You can find the file path to cocoapods.rb in your pod install's error output.)

before line 7

require 'active_support/core_ext/string/strip'

@ciekawy
Copy link

ciekawy commented Oct 19, 2023

why this is closed if there is no new release of cocoapods with above fix?

@kevnm67
Copy link

kevnm67 commented Oct 24, 2023

None of the above worked for me. However, the Gemfile change from this PR resolved the issue for us.

@fatihsever
Copy link

gem uninstall activesupport
gem install activesupport -v 7.0.8

This worked for me.

Liquidsoul added a commit to AliSoftware/OHHTTPStubs that referenced this issue Oct 25, 2023
Use cocoapods 1.11.x because I do not want to apply this workaround for
activesupport:
CocoaPods/CocoaPods#12081 (comment)
@amorde
Copy link
Member

amorde commented Oct 26, 2023

Just released 1.14.0 which includes a fix for this.

iangmaia added a commit to wordpress-mobile/WordPress-iOS that referenced this issue Oct 26, 2023
iangmaia added a commit to woocommerce/woocommerce-ios that referenced this issue Oct 26, 2023
jaclync added a commit to woocommerce/woocommerce-ios that referenced this issue Oct 27, 2023
…ty-rules

* trunk: (191 commits)
  Update WooCommerce/WooCommerceTests/ViewRelated/LedgerTableViewCellTests.swift
  Update WooCommerce/Classes/ViewRelated/ReusableViews/LedgerTableViewCell.swift
  Update WooCommerce/Classes/ViewRelated/Orders/Order Creation/CustomAmounts/OrderCustomAmountsSection.swift
  Move track event to viewmodel. Add tests
  Separate add-edit track events to separate methods
  Update test
  Track tap on add and edit discount
  Update “Add” discount event button
  update release notes
  Refactor totalPriceAfterDiscountLabel
  Update CocoaPods
  Update Dangermattic gem
  Move Dangerfile to project root, per Danger standard
  Update how activesupport version is locked
  Improve Dangerfile code
  Use DANGER_GITHUB_API_TOKEN from CI env
  Fix Cocoapods Active Support issue (CocoaPods/CocoaPods#12081)
  Add initial Danger setup with Dangermattic
  11009 Add hiding of Set up button to 16.0 release
  Fix hound warning
  ...

# Conflicts:
#	WooCommerce/WooCommerceTests/ViewRelated/Orders/Order Creation/ProductRowViewModelTests.swift
iangmaia added a commit to wordpress-mobile/WordPress-iOS that referenced this issue Oct 31, 2023
salimbraksa pushed a commit to wordpress-mobile/WordPress-iOS that referenced this issue Oct 31, 2023
confiks pushed a commit to MinBZK/nl-wallet that referenced this issue Nov 7, 2023
@martin-braun
Copy link

How can you use this workaround if you install cocoapods globally via Homebrew? Neither 'gem' nor 'bundle' commands apply in this case, I think.

You can actually bypass this issue if you installed it via Homebrew, because Homebrew will just install the cocoapods that depends on Ruby, it's not a binary that embeds the interpreter or something like that.

Liquidsoul added a commit to AliSoftware/OHHTTPStubs that referenced this issue Mar 7, 2024
Use cocoapods 1.11.x because I do not want to apply this workaround for
activesupport:
CocoaPods/CocoaPods#12081 (comment)
chaedirdwiantara pushed a commit to chaedirdwiantara/BamcoArtist that referenced this issue Mar 15, 2024
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

Successfully merging a pull request may close this issue.