Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kacper1703 opened this issue Dec 2, 2020 · 16 comments
Open

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

kacper1703 opened this issue Dec 2, 2020 · 16 comments

Comments

@kacper1703
Copy link

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
@siggb
Copy link

siggb commented Dec 6, 2020

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

@tejen
Copy link

tejen commented Dec 8, 2020

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.

🙏

@siggb
Copy link

siggb commented Dec 8, 2020

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

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

@geraldeersteling
Copy link

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

@kingnight
Copy link

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

@tejen
Copy link

tejen commented Mar 31, 2021

@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.

@scottasoutherland
Copy link

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

@dinghaoz
Copy link

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

@captain-black
Copy link

I meet the same problem

1 similar comment
@Jacky-LinPeng
Copy link

I meet the same problem

@amiravisar89
Copy link

having the same problem

@shreeshakedlaya-cred
Copy link

Anybody found solution for this?

@shreesha-kedilaya
Copy link

shreesha-kedilaya commented Jan 23, 2022

@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?

@ghost
Copy link

ghost commented Feb 5, 2022

It worked! Thanks dinghaoz sir!

@Matejy
Copy link

Matejy commented Jul 28, 2022

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

@miquelalvarado
Copy link

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? 😕

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests