Skip to content

Cocoapods 1.0.0 - SystemStackError - stack level too deep - Subspecs cross ref. #5362

@WiesnerPeti

Description

@WiesnerPeti

Report

What did you do?

  1. Updated cocoapods from 0.39 to 1.0
  2. Updated Podfile and Podspecs to fix install errors. (Only missing description or home page properties)
  3. Run pod install

What did you expected to happen?

Install all pod dependencies correctly.

What happened instead?

At the Generating Pods project, the script stopped with the following error:

SystemStackError - stack level too deep
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/target/pod_target.rb:191:in `each'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/target/pod_target.rb:191:in `flat_map'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/target/pod_target.rb:191:in `recursive_dependent_targets'

This each - flat_map - recursive_dependent_targets runs for ~100 lines, then:

/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/generator/xcconfig/pod_xcconfig.rb:66:in `generate'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/generator/xcconfig/pod_xcconfig.rb:35:in `save_as'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/installer/target_installer/pod_target_installer.rb:204:in `create_xcconfig_file'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/installer/target_installer/pod_target_installer.rb:22:in `block in install!'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/user_interface.rb:144:in `message'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/installer/target_installer/pod_target_installer.rb:17:in `install!'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/installer.rb:621:in `block (2 levels) in install_libraries'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/installer.rb:619:in `each'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/installer.rb:619:in `block in install_libraries'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/user_interface.rb:144:in `message'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/installer.rb:618:in `install_libraries'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/installer.rb:170:in `block in generate_pods_project'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/user_interface.rb:63:in `section'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/installer.rb:167:in `generate_pods_project'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/installer.rb:119:in `install!'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/command/install.rb:37:in `run'
/usr/local/lib/ruby/gems/2.3.0/gems/claide-1.0.0/lib/claide/command.rb:334:in `run'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/lib/cocoapods/command.rb:50:in `run'
/usr/local/lib/ruby/gems/2.3.0/gems/cocoapods-1.0.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

CocoaPods Environment

Sorry sensitive information, but I will try to describe the problem:
Environment: Cocoapods 1.0.0 (0.39 also installed), ruby 2.3.0
The developer pods causing the issues have only subspecs. One of the developer pod's subspec refers to the suspec of the other and vice versa. This recursion was introduced earlier, but in the 0.39 version this was not a problem as I understand, the true recursion for target dependency resolution was only introduced in the 1.0.0 9 days ago, I believe here: ef854ab

I will try to reproduce the podspec environment:

In s1.podspec:

Pod::Spec.new do |s1|
   s1.subspec 'subspecA' do |subspecA|
       subspecA.dependency 's2/subspecB'
   end
   s1.subspec 'subspecB' do |subspecB|
      subspecB.source_files = './**/*.{h,m}'
   end
end


In s2.podspec:
Pod::Spec.new do |s2|
   s2.subspec 'subspecA' do |subspecA|
        subspecA.dependency 's1/subspecB'
   end
   s2.subspec 'subspecB' do |subspecB|
      subspecB.source_files = './**/*.{h,m}'
   end
end

Sample app pod env (without private repos):

   CocoaPods : 1.0.0
        Ruby : ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
    RubyGems : 2.5.1
        Host : Mac OS X 10.11.4 (15E65)
       Xcode : 7.3.1 (7D1014)
         Git : git version 2.7.4 (Apple Git-66)
Ruby lib dir : /Users/peterwiesner/.rvm/rubies/ruby-2.3.0/lib

Installation Source

Executable Path: /Users/peterwiesner/.rvm/gems/ruby-2.3.0/bin/pod

Plugins

cocoapods-deintegrate : 1.0.0
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.0.0
cocoapods-try         : 1.0.0

Podfile

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

target 'SubSpecCircular' do
  # Uncomment this line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for SubSpecCircular
  pod "Pod3/s3", :path => "./DeveloperPods/Pod3"
  pod "Pod1", :path => "./DeveloperPods/Pod1"
  pod "Pod2", :path => "./DeveloperPods/Pod2"

  project "./SubSpecCircular.xcodeproj"
end

target 'SubSpecCircularTests' do
    project "./SubSpecCircular.xcodeproj"
end

target 'SubSpecCircularUITests' do
    project "./SubSpecCircular.xcodeproj"
end

Question

Is this a valid construction of using subspecs? (As this was correctly installed for 0.39) Can you suggest a resolution for this? (extract these subspecs to a separate developer pod)
Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    s3:detailedIssues with in-depth explanations and examples that make it easier to troubleshoott2:defectThese are known bugs. The issue should also contain steps to reproduce. PRs welcome!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions