Cocoapods: Podfile.lock [SPEC REPOS] is updated on CircleCI, breaking build

Created on 5 Apr 2018  路  10Comments  路  Source: CocoaPods/CocoaPods

First off, sorry for the contrived issue title, couldn't formulate something coherent that describes my issue.

馃寛

Report

What did you do?

Update CocoaPods to 1.5, and ran pod install on CircleCI, with updated the committed Podfile.lock.

What did you expect to happen?

The pods to be installed, without changes to Podfile.lock.

What happened instead?

Podfile.lock was changed, leading to build failure. Here's the diff:

 SPEC REPOS:
-  https://github.com/CocoaPods/Specs.git:
+  https://github.com/cocoapods/specs.git:

CocoaPods Environment

TL;DR;

Repositories key differ between machines (note casing in url):

Machine|Key
--|--
Local|Repositories : master - https://github.com/CocoaPods/Specs.git
CI|Repositories : master - https://github.com/cocoapods/specs.git

Full output below


Local Machine

Stack

   CocoaPods : 1.5.0
        Ruby : ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
    RubyGems : 2.6.13
        Host : Mac OS X 10.13.4 (17E199)
       Xcode : 9.3 (9E145)
         Git : git version 2.16.3
Ruby lib dir : /usr/local/Cellar/ruby/2.4.1_2/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ e18c80251adfc1d148c734f1093963b901c6803e

Installation Source

Executable Path: /Users/hmps/dev/mindoktor/app/ios/vendor/bundle/ruby/2.4.0/bin/pod

Plugins

cocoapods-deintegrate : 1.0.2
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.3.0
cocoapods-try         : 1.1.0

Podfile

# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
install! 'cocoapods',
  :deterministic_uuids => false

def shared
  # Third party deps
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  pod 'React', :path => '../node_modules/react-native', :subspecs => [
      'Core',
      'CxxBridge', # Include this for RN >= 0.47
      'RCTText',
      'RCTNetwork',
      'RCTWebSocket', # needed for debugging
      'RCTImage',
      # Add any other subspecs you want to use in your project
      'DevSupport'
    ]
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'CodePush', :path => '../node_modules/react-native-code-push'
  pod 'Mixpanel'
  pod 'FBSDKCoreKit'
  pod 'FBSDKShareKit'
  pod 'FBSDKLoginKit'
  pod 'GoogleConversionTracking'
  pod 'AdformTracking'
  pod 'Analytics', '~> 3.0'
  pod 'AppsFlyerFramework', '~> 4.8.0'
  pod 'Fabric'
  pod 'Crashlytics'
  pod 'OpenTok'
  pod 'Firebase/Messaging'
  pod 'react-native-maps', path: '../node_modules/react-native-maps'
  pod 'GoogleMaps'
  pod 'react-native-google-maps', path: '../node_modules/react-native-maps'
end

target 'MinDoktor' do
  shared
end

post_install do |installer|

  # This is needed because of a bug in RN 0.52.0. See https://github.com/facebook/react-native/issues/17274
  # A fix has been made and is due to ship with 0.53.0
  installer.pods_project.targets.each do |target|
    if target.name == 'yoga'
      puts ">>>> RESETTING YOGA WARNING LEVELS <<<<<"
      target.build_configurations.each do |config|
        config.build_settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'NO'
        config.build_settings['GCC_WARN_64_TO_32_BIT_CONVERSION'] = 'NO'
      end
    end

    if target.name == 'react-native-google-maps'
      target.build_configurations.each do |config|
        config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
      end
    end
  end

  # Because of the Yoga issue above, this loop needs to run a second time. We can't put these in the same loop, since removing
  # React will also remove the Yoga target as far as this scipt is concerned.
  installer.pods_project.targets.each do |target|
    # We have had an issue with the React pod being installed twice, causing build errors because 'duplicate symbols'
    if target.name == "React"
      puts ">>>>> REMOVING DUPLICATE REACT TARGETS <<<<<"
      target.remove_from_project
    end
  end
end


CI Machine

Stack

   CocoaPods : 1.5.0
        Ruby : ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-darwin17]
    RubyGems : 2.6.14
        Host : Mac OS X 10.13.3 (17D102)
       Xcode : 9.3 (9Q127n)
         Git : git version 2.16.2
Ruby lib dir : /Users/distiller/.rubies/ruby-2.4.3/lib
Repositories : master - https://github.com/cocoapods/specs.git @ 2a08fb549864569545e3f4e21a410ba197183138

Installation Source

Executable Path: /Users/distiller/project/ios/vendor/bundle/ruby/2.4.0/bin/pod

Plugins

cocoapods-deintegrate : 1.0.2
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.3.0
cocoapods-try         : 1.1.0

Podfile

# Disable sending stats
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
install! 'cocoapods',
  :deterministic_uuids => false

def shared
  # Third party deps
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  pod 'React', :path => '../node_modules/react-native', :subspecs => [
      'Core',
      'CxxBridge', # Include this for RN >= 0.47
      'RCTText',
      'RCTNetwork',
      'RCTWebSocket', # needed for debugging
      'RCTImage',
      # Add any other subspecs you want to use in your project
      'DevSupport'
    ]
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'CodePush', :path => '../node_modules/react-native-code-push'
  pod 'Mixpanel'
  pod 'FBSDKCoreKit'
  pod 'FBSDKShareKit'
  pod 'FBSDKLoginKit'
  pod 'GoogleConversionTracking'
  pod 'AdformTracking'
  pod 'Analytics', '~> 3.0'
  pod 'AppsFlyerFramework', '~> 4.8.0'
  pod 'Fabric'
  pod 'Crashlytics'
  pod 'OpenTok'
  pod 'Firebase/Messaging'
  pod 'react-native-maps', path: '../node_modules/react-native-maps'
  pod 'GoogleMaps'
  pod 'react-native-google-maps', path: '../node_modules/react-native-maps'
end

target 'MinDoktor' do
  shared
end

post_install do |installer|

  # This is needed because of a bug in RN 0.52.0. See https://github.com/facebook/react-native/issues/17274
  # A fix has been made and is due to ship with 0.53.0
  installer.pods_project.targets.each do |target|
    if target.name == 'yoga'
      puts ">>>> RESETTING YOGA WARNING LEVELS <<<<<"
      target.build_configurations.each do |config|
        config.build_settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'NO'
        config.build_settings['GCC_WARN_64_TO_32_BIT_CONVERSION'] = 'NO'
      end
    end

    if target.name == 'react-native-google-maps'
      target.build_configurations.each do |config|
        config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
      end
    end
  end

  # Because of the Yoga issue above, this loop needs to run a second time. We can't put these in the same loop, since removing
  # React will also remove the Yoga target as far as this scipt is concerned.
  installer.pods_project.targets.each do |target|
    # We have had an issue with the React pod being installed twice, causing build errors because 'duplicate symbols'
    if target.name == "React"
      puts ">>>>> REMOVING DUPLICATE REACT TARGETS <<<<<"
      target.remove_from_project
    end
  end
end

More details

The issue most likely occurs because CircleCI has a roundabout way to update CocoaPods specs. They keep a tar bundle available in an S3 bucket, and provide a script that downloads and uncompresses this on the CI machine. For reference, that script is available here The reasoning behind this is that it's faster to download this via HTTP than git on a new machine.

CircleCI updates this file by pulling from the spec repo every 30 minutes or so, and I guess that their local repo is setup with the repo url in all lowercase, which creates the diff described above.

I've filed an issue with them to use the correct casing for the repo, and I though that it might be a good idea to change the CocoaPods CLI as well, making it a little more resilient to issues like this.

My suggestion is to always lowercase all repo urls in the SPEC REPOS part of the Podfile.lock. Is that a feasible idea?

As far as I know there are no problems using a lowercased url, even if the "proper" url is cased differently.

_I tried digging into the source, but my Ruby skills weren't really up for it. :(_

馃檹 Thank you for CocoaPods, it has made our iOS project soooo much easier to work with.

easy confirmed detailed

Most helpful comment

I am facing the same issue but reversed. For me pod install changes, lower case to upper case. Not sure where I am to look.
Initial: https://github.com/cocoapods/specs.git:
After install : https://github.com/CocoaPods/Specs.git:

All 10 comments

thanks @hmps !

This change should not be applied to all spec repos, only to the master repo.
I noticed with this change it lowercased a path to our custom repo which will break on case-sensitive filesystems @dnkoutso FYI.

@hmps can you point me to the CircleCI issue you have opened?

Sorry @dnkoutso, can't do that due to it containing information that is private to my employer.

I can create a "clean" version of it and post it on their forum though. They're usually pretty responsive there. Would that help?

It looks like as of 1.8.0, this is no longer working correctly.
I'm seeing this issue in my codebase, and looks like flutter is too: https://github.com/flutter/flutter/issues/41253

Likely a side-effect due to the switch over to CDN, but it's breaking our workflow also now.

@dnkoutso can we re-open this and investigate?

I am not sure what the issue is exactly. I prefer a new issue with a clear sample app and steps to repro.

AFAIK this code hasnt been touched since 1.5 but yes master specs repo is no longer cloned by default.

I am facing the same issue but reversed. For me pod install changes, lower case to upper case. Not sure where I am to look.
Initial: https://github.com/cocoapods/specs.git:
After install : https://github.com/CocoaPods/Specs.git:

https://github.com/CocoaPods/Core/commit/0ef56902276b554eb532f9f88ecb84db97c61afd#diff-51c0c8e797e0afc659b1418e32c01525L492
This commit might make the change?

I have cocoapods v1.9.1 and I'm currently facing a similar issue where the diff after pod install is like this -

 SPEC REPOS:
-  https://github.com/CocoaPods/Specs.git:
+  trunk:
     - boost-for-react-native
     - Bugsnag
     ...

Any ideas what could be going wrong?

My colleague worked out that this is because of the name of the repo locally. To fix it I had to delete the repo and re-clone it:

pod repo remove master
cd ~/.cocoapods/repos 
git clone https://github.com/cocoapods/specs.git master

Thanks to @smcleman for the fix.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pronebird picture pronebird  路  3Comments

Curtis-Halbrook picture Curtis-Halbrook  路  3Comments

iosdev-republicofapps picture iosdev-republicofapps  路  3Comments

spencerkohan picture spencerkohan  路  3Comments

steffendsommer picture steffendsommer  路  3Comments