cocoapods-binary icon indicating copy to clipboard operation
cocoapods-binary copied to clipboard

"Multiple commands produce..." errors in Xcode 12.2, Big Sur

Open kacper1703 opened this issue 4 years ago • 16 comments

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

kacper1703 avatar Dec 02 '20 07:12 kacper1703

I have the same problem. Although I can use version 0.4.1 on an ad hoc basis.

siggb avatar Dec 06 '20 12:12 siggb

What's the workaround for this? Due to this issue, I haven't been able to build my projects on Big Sur and Xcode 12.2 unless I remove precompiled pods.

Is the accepted workaround to just run gem uninstall cocoapods-binary and then gem install cocoapods-binary -v 0.4.1 to downgrade to 0.4.1? That seems to work for me.

🙏

tejen avatar Dec 08 '20 08:12 tejen

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

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

siggb avatar Dec 08 '20 09:12 siggb

Same issue here, but downgrading to 0.4.1 didn't help me...

geraldeersteling avatar Jan 06 '21 12:01 geraldeersteling

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

kingnight avatar Mar 30 '21 02:03 kingnight

@kingnight nice yeah that works as well 🔥 Cumbersome to delete all duplicate lines in all output-files.xcfilelist and input-files.xcfilelist files, but surprised the issue was that simple.

tejen avatar Mar 31 '21 04:03 tejen

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

scottasoutherland avatar Apr 19 '21 22:04 scottasoutherland

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

dinghaoz avatar Jun 11 '21 12:06 dinghaoz

I meet the same problem

captain-black avatar Sep 25 '21 13:09 captain-black

I meet the same problem

Jacky-LinPeng avatar Nov 28 '21 12:11 Jacky-LinPeng

having the same problem

amiravisar89 avatar Nov 30 '21 14:11 amiravisar89

Anybody found solution for this?

shreeshakedlaya-cred avatar Jan 22 '22 18:01 shreeshakedlaya-cred

@dinghaoz Tried with your approach but im getting these errors.

[!] An error occurred while processing the post-integrate hook of the Podfile.

undefined method `delete_prefix' for nil:NilClass

/Users/my_username/Documents/Github/my_project/Podfile:164:in `block (3 levels) in patch_cocoapods_binary_dsyms'
/Users/my_username/Documents/Github/my_project/Podfile:162:in `each'
/Users/my_username/Documents/Github/my_project/Podfile:162:in `block (2 levels) in patch_cocoapods_binary_dsyms'
/Users/my_username/Documents/Github/my_project/Podfile:161:in `each'
/Users/my_username/Documents/Github/my_project/Podfile:161:in `block in patch_cocoapods_binary_dsyms'
/Users/my_username/Documents/Github/my_project/Podfile:160:in `each'
/Users/my_username/Documents/Github/my_project/Podfile:160:in `patch_cocoapods_binary_dsyms'
/Users/my_username/Documents/Github/my_project/Podfile:200:in `block (2 levels) in from_ruby'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.2/lib/cocoapods-core/podfile.rb:213:in `post_integrate!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:973:in `run_podfile_post_integrate_hook'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:961:in `block in run_podfile_post_integrate_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:149:in `message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:960:in `run_podfile_post_integrate_hooks'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:861:in `block in integrate_user_project'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:856:in `integrate_user_project'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-binary-0.4.4/lib/cocoapods-binary/helper/feature_switches.rb:64:in `call'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-binary-0.4.4/lib/cocoapods-binary/helper/feature_switches.rb:64:in `block in <class:Installer>'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:182:in `integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:167:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'

I think nil case is not handled in the code. Any idea?

shreesha-kedilaya avatar Jan 23 '22 14:01 shreesha-kedilaya

It worked! Thanks dinghaoz sir!

Misa-s avatar Feb 05 '22 15:02 Misa-s

@dinghaoz thanks, your solution worked for me as well.

Matejy avatar Jul 28 '22 08:07 Matejy

Hi! @dinghaoz post_integrate script worked for me to solve most of the errors. Somehow there's one remaining one for me:

Multiple commands produce '/Users/ABCD/Library/Developer/Xcode/DerivedData/foo/Build/Products/Debug-iphonesimulator/foo.app/Pods-foo-metadata.plist'

Target 'foo' (project 'foo') has copy command from '/Users/ABCD/Developer/foo/Pods/Pods-foo-metadata.plist' to '/Users/ABCD/Library/Developer/Xcode/DerivedData/foo/Build/Products/Debug-iphonesimulator/foo.app/Pods-foo-metadata.plist'

Target 'foo' (project 'foo') has copy command from '/Users/ABCD/Developer/foo/Pods/_Prebuild/Pods-foo-metadata.plist' to '/Users/ABCD/Library/Developer/Xcode/DerivedData/foo/Build/Products/Debug-iphonesimulator/foo.app/Pods-foo-metadata.plist'

Any idea on how to fix it? 😕

miquelalvarado avatar Sep 07 '22 14:09 miquelalvarado