Cocoapods: Build fails with Apple's new build system (dependency cycle)

Created on 16 Oct 2017  Â·  5Comments  Â·  Source: CocoaPods/CocoaPods

Report

What did you do?

I built the project with Apple's new build system

What did you expect to happen?

To be able to run the app.

What happened instead?

The app compiles once correctly. However, if I try to compile it a second time, I get the following error:

error: Dependency cycle detected between targets: 

node: /Users/auser/Library/Developer/Xcode/DerivedData/Instayacht-cobdnjihnjfzxsdpraqubqvgilhk/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/PromiseKit.build/Objects-normal/x86_64/PromiseKit-Swift.h ->

target PromiseKit: CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler ->

node: /Users/auser/Library/Developer/Xcode/DerivedData/Instayacht-cobdnjihnjfzxsdpraqubqvgilhk/Build/Products/Debug-iphonesimulator/PromiseKit/PromiseKit.framework/Headers/PromiseKit-Swift.h ->

target PromiseKit: Ditto /Users/auser/Library/Developer/Xcode/DerivedData/Instayacht-cobdnjihnjfzxsdpraqubqvgilhk/Build/Products/Debug-iphonesimulator/PromiseKit/PromiseKit.framework/Headers/PromiseKit-Swift.h /Users/auser/Library/Developer/Xcode/DerivedData/Instayacht-cobdnjihnjfzxsdpraqubqvgilhk/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/PromiseKit.build/Objects-normal/x86_64/PromiseKit-Swift.h ->

node: /Users/auser/Library/Developer/Xcode/DerivedData/Instayacht-cobdnjihnjfzxsdpraqubqvgilhk/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/PromiseKit.build/Objects-normal/x86_64/PromiseKit-Swift.h/ ->

node: /Users/auser/Library/Developer/Xcode/DerivedData/Instayacht-cobdnjihnjfzxsdpraqubqvgilhk/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/PromiseKit.build/Objects-normal/x86_64/PromiseKit-Swift.h

CocoaPods Environment

Cocoapods 1.3.1

ℹ Please replace this with the output of pod env.

### Stack
   CocoaPods : 1.3.1
        Ruby : ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
    RubyGems : 2.5.2
        Host : Mac OS X 10.13 (17A405)
       Xcode : 9.0 (9A235)
         Git : git version 2.13.5 (Apple Git-94)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib
Repositories : 
            master - https://github.com/CocoaPods/Specs.git @ 68d9944ba915a1786cd88e3df1f127d374f5fc00

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-deintegrate : 1.0.1
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.2.0
cocoapods-try         : 1.1.0

Podfile

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

def shared_pods
    use_frameworks!
    inhibit_all_warnings!

    pod 'Alamofire', '~>4.4'
    pod 'XCGLogger', '~>4.0'
    pod 'TLIndexPathTools'
    pod 'ObjectMapper', '~>2.2.5'
    pod 'SWRevealViewController'
    pod 'Kingfisher', '~>4.0'
    pod 'SnapKit', '~>4.0.0'
    pod 'Texture', '~>2.0'
    pod 'Atributika', '~>4.0'
    pod 'ARSLineProgress', '~>2.0'
    pod 'IQKeyboardManagerSwift', '4.0.8'
    pod 'MARKRangeSlider', '~>1.1'
    pod 'Realm'
    pod 'RealmSwift', '~>2.10.1'
    pod 'XLPagerTabStrip', '~>7.0.0'
    pod 'ActionSheetPicker-3.0', '~>2.2'
    pod 'DZNEmptyDataSet'
    pod 'ImagePicker', '~>2.1'
    pod 'FSCalendar'
    pod 'JDStatusBarNotification'
    pod 'OneSignal', '>= 2.5.2', '< 3.0'

    pod 'PromiseKit', '~>4.3'
    pod 'PromiseKit/CoreLocation', '~>4.3'

    pod 'GooglePlaces'
    pod 'GooglePlacePicker'
    pod 'GoogleMaps'
    pod 'GoogleAnalytics'

    pod 'BraintreeDropIn'
    pod 'Braintree'

    pod 'Reveal-SDK', :configurations => ['Debug']

end

target 'MyTarget' do
    shared_pods

    #some dependencies are not yet ready for swift 4.
    #we need to configure them to compile in legacy swift 3
    #and then import them in swift 4.0 projects
    #hence, this post-install script.
    post_install do |installer|
        installer.pods_project.targets.each do |target|
            if [
                'Locksmith',
                'Alamofire',
                'ImagePicker',
                'XCGLogger',
                'IQKeyboardManagerSwift',
                'ARSLineProgress',
                'ObjectMapper',
                'XLPagerTabStrip'
                ].include? target.name
                target.build_configurations.each do |config|
                    config.build_settings['SWIFT_VERSION'] = '3.2'
                end
            end
        end
    end

end

target 'Playground' do
    shared_pods
end

Originally reported here: https://github.com/mxcl/PromiseKit/issues/724

Seems an issue with Cocoapods.

new build system

Most helpful comment

To my knowledge this was a bug in PromiseKit (well the new build-system could have avoided it), either way I fixed it in PromiseKit 6.

Bug was that a header imported the generated PromiseKit-Swift.h. Strictly we only did this if it was already generated, but the new-build-system didn't realize that, and well, what we were doing was unsupported anyway. Got told off by Swift core.

All 5 comments

There is no work being done currently for the new build system as it is still under development by Apple.

I will tag it as such but I do not think anyone will tackle this for 1.4.0 or even 1.5.0.

I'd be interested to see a sample project that demonstrates the issue as well.

Having this one too. It appears only on Debug scheme and empty DerivedData folder. If you select Release scheme - it does not fail. If you build the project with the old build system and then switch to new build system - it doesn't fail too.

To my knowledge this was a bug in PromiseKit (well the new build-system could have avoided it), either way I fixed it in PromiseKit 6.

Bug was that a header imported the generated PromiseKit-Swift.h. Strictly we only did this if it was already generated, but the new-build-system didn't realize that, and well, what we were doing was unsupported anyway. Got told off by Swift core.

Nice. Going close for now. CocoaPods does not interfere with the build system itself. It seems like an actual compilation issue here than a CocoaPods settings issue that could cause the new or old build system to fail.

Was this page helpful?
0 / 5 - 0 ratings