cocoapods-binary: "Multiple commands produce..." errors in Xcode 12.2, Big Sur

For a following Podfile, when trying to build the project multiple errors appear. Excluding some of these frameworks using :binary => false does not help.

Multiple commands produce '/Users/ABCD/Library/Developer/Xcode/DerivedData/MyProject-gfnmwygetouofcguhjlnrmdzrhbp/Build/Products/Debug-iphonesimulator/nanopb/nanopb.framework.dSYM':
1) That command depends on command in Target 'nanopb' (project 'Pods'): script phase “[CP] Copy dSYMs”
2) That command depends on command in Target 'nanopb' (project 'Pods'): script phase “[CP] Copy dSYMs”
3) That command depends on command in Target 'nanopb' (project 'Pods'): script phase “[CP] Copy dSYMs”

Multiple commands produce '/Users/ABCD/Library/Developer/Xcode/DerivedData/MyProject-gfnmwygetouofcguhjlnrmdzrhbp/Build/Products/Debug-iphonesimulator/SwiftyRSA/SwiftyRSA.framework.dSYM':
1) That command depends on command in Target 'SwiftyRSA' (project 'Pods'): script phase “[CP] Copy dSYMs”
2) That command depends on command in Target 'SwiftyRSA' (project 'Pods'): script phase “[CP] Copy dSYMs”

Multiple commands produce '/Users/ABCD/Library/Developer/Xcode/DerivedData/MyProject-gfnmwygetouofcguhjlnrmdzrhbp/Build/Products/Debug-iphonesimulator/PromiseKit/PromiseKit.framework.dSYM':
1) That command depends on command in Target 'PromiseKit' (project 'Pods'): script phase “[CP] Copy dSYMs”
2) That command depends on command in Target 'PromiseKit' (project 'Pods'): script phase “[CP] Copy dSYMs”

Multiple commands produce '/Users/ABCD/Library/Developer/Xcode/DerivedData/MyProject-gfnmwygetouofcguhjlnrmdzrhbp/Build/Products/Debug-iphonesimulator/MyMyProject.app/Pods-MyProject-metadata.plist':
1) Target 'MyProject' (project 'MyProject') has copy command from '/Users/ABCD/Documents/Projekty/MyProject-ios/Pods/Pods-MyProject-metadata.plist' to '/Users/ABCD/Library/Developer/Xcode/DerivedData/MyProject-gfnmwygetouofcguhjlnrmdzrhbp/Build/Products/Debug-iphonesimulator/MyMyProject.app/Pods-MyProject-metadata.plist'
2) Target 'MyProject' (project 'MyProject') has copy command from '/Users/ABCD/Documents/Projekty/MyProject-ios/Pods/_Prebuild/Pods-MyProject-metadata.plist' to '/Users/ABCD/Library/Developer/Xcode/DerivedData/MyProject-gfnmwygetouofcguhjlnrmdzrhbp/Build/Products/Debug-iphonesimulator/MyMyProject.app/Pods-MyProject-metadata.plist'
...
platform :ios, '12.0'
use_frameworks!
inhibit_all_warnings!
plugin 'cocoapods-binary'
plugin 'cocoapods-acknowledgements'
all_binary!

pod 'SwiftLint', '0.41.0'

def alamofireImage
  pod 'AlamofireImage', '3.6.0'
end

def alamofire
  pod 'Alamofire', '4.9.1'
end

def stubs
  pod 'OHHTTPStubs/Swift', '9.0.0', :binary => false
end

def instabug
  pod 'Instabug', '10.0.3'
end

def auth0
  pod 'Auth0', '1.30.1'
end

def promiseKit
  pod 'PromiseKit/Alamofire', '~> 6.0', :binary => false
end

def MyProjectKitPods
  alamofire
  auth0
  instabug
  promiseKit
  stubs
end

def firebase
  pod 'FirebaseAnalytics', '7.1.0'
  pod 'FirebaseCore', '7.1.0'
  pod 'FirebaseInstanceID', '7.1.0'
  pod 'FirebaseRemoteConfig', '7.1.0'
end

def MyProjectPods
  alamofireImage
  auth0
  firebase
  instabug
  promiseKit
  pod 'FlexiblePageControl', '1.0.8'
  pod 'Former', :configurations => ['Debug', 'Beta']
  pod 'Hero', '1.5.0'
  pod 'lottie-ios', '3.1.9'
  pod 'MagazineLayout', '1.6.3'
  pod 'Pulley', '2.9.0'
  pod 'SwiftGen', '6.4.0'
  pod 'SwiftyMarkdown', '1.2.3'
  pod 'ShowTime', '2.5.2'
end

def extensionKitPods
  instabug
end

target 'MyProject' do
  MyProjectPods
end

target 'MyProjectTests' do
  MyProjectPods
end

target 'MyProjectKit' do
  MyProjectKitPods
end

target 'MyProjectKitTests' do
  MyProjectKitPods
end

target 'ExtensionKit' do
  extensionKitPods
end

target 'ExtensionKitTests' do
  extensionKitPods
end

post_install do |installer|
    require 'fileutils'
    FileUtils.cp_r('Pods/Target Support Files/Pods-MyProject/Pods-MyProject-acknowledgements.markdown',
                   'MyProject/Resources/Legal/LicenseAgreement.md', :remove_destination => true)

    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
      end
    end
end

class ::Pod::Generator::Acknowledgements
    def header_title
        ""
    end
end

Environment:

   CocoaPods : 1.10.0
       Xcode : 12.2 (12B45b)
cocoapods-binary           : 0.4.4
plugin 'cocoapods-binary'
MacOS Big Sur 11.0.1

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 9
  • Comments: 16

Commits related to this issue

Most upvoted comments

besides the “Multiple commands produce” issue, there is a backslash missing in every *-copy-dsyms.sh file:

"${DERIVED_FILES_DIR}" => "${DERIVED_FILES_DIR}/"

Based on @scottasoutherland’s code, I patched it with

def patch_cocoapods_binary_dsyms(installer)
  installer.generated_projects.each do |project|
    project.targets.each do |target|
      target.shell_script_build_phases.each do |phase|
        
        shell_file = phase.shell_script.strip.gsub!(/\A"|"\Z/, '').delete_prefix "${PODS_ROOT}"
        shell_file = File.join("./Pods", shell_file)
        
        shell_script = File.read(shell_file, chomp: true)
        fixed_shell_script = shell_script.gsub("\"${DERIVED_FILES_DIR}\"", "\"${DERIVED_FILES_DIR}/\"")

        File.open(shell_file, "w") do |f|
          f.write(fixed_shell_script)
        end
        
        phase.input_file_list_paths.each do |file_list_path|
          dedupe_file_list(file_list_path)
        end
        
        phase.output_file_list_paths.each do |file_list_path|
          dedupe_file_list(file_list_path)
        end
      end
    end
  end
end

def dedupe_file_list(file_list_path)
  file_list_path = file_list_path.delete_prefix "${PODS_ROOT}"
  file_list_path = File.join("./Pods", file_list_path)
  
  contents = File.readlines(file_list_path, chomp: true)
  contents = contents.uniq
  File.open(file_list_path, "w") do |file|
    file.puts contents
  end
end

post_integrate do |installer|
  patch_cocoapods_binary_dsyms(installer)
end

If you want to fix this automatically you can put this in your Podfile

post_integrate do |installer|
  patch_cocoapods_binary_dsyms(installer)
end

def patch_cocoapods_binary_dsyms(installer)
  installer.generated_projects.each do |project|
    project.targets.each do |target|
      target.shell_script_build_phases.each do |phase|
        phase.input_file_list_paths.each do |file_list_path|
          dedupe_file_list(file_list_path)
        end
        
        phase.output_file_list_paths.each do |file_list_path|
          dedupe_file_list(file_list_path)
        end
      end
    end
  end
end

def dedupe_file_list(file_list_path)
  file_list_path = file_list_path.delete_prefix "${PODS_ROOT}"
  file_list_path = File.join(PODS_DIR, file_list_path)
  contents = File.readlines(file_list_path, chomp: true)
  contents = contents.uniq
  File.open(file_list_path, "w") do |file|
    file.puts contents
  end
end

Yeah, kind of. I updated my Gemfile to this:

source 'https://rubygems.org'
gem 'cocoapods', '~> 1.10.0'
gem 'cocoapods-binary', '0.4.1'

You can fix this by hand ,for example
Pods/Target Support Files/AFNetworking/AFNetworking-copy-dsyms-output-files.xcfilelist

Delete duplicate lines,left only one line ${DWARF_DSYM_FOLDER_PATH}/AFNetworking.framework.dSYM