error: unable to spawn process (Argument list too long) in Xcode Build

Falguni picture Falguni · Nov 9, 2018 · Viewed 13.4k times · Source

I am getting this error:

"error: unable to spawn process (Argument list too long)

** ARCHIVE FAILED **

The following build commands failed: CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (1 failure)

Exitcode =65 "

I went through this link: Xcode export localization throws error "Argument list too long"

This article provides a good temporary solution of the problem stating to reduce the path hierarchy. But this does not seem to be an appropriate approach. Can anyone provide me with a different approach to the solution for this problem?

Screenshot added

Answer

blaszku picture blaszku · Jan 24, 2020

In my case, it was about custom configurations in .xcconfig files. My config files were including Pods configurations like:

// Development.xcconfig

#include "Pods/Target Support Files/Pods-MyProject/Pods-MyProject.debug (development).xcconfig"
#include "Pods/Target Support Files/Pods-MyProjectTests/Pods-MyProjectTests.debug (development).xcconfig"

#include "Pods/Target Support Files/Pods-MyProject/Pods-MyProject.release (development).xcconfig"
#include "Pods/Target Support Files/Pods-MyProjectTests/Pods-MyProjectTests.release (development).xcconfig"
// Production.xcconfig

#include "Pods/Target Support Files/Pods-MyProject/Pods-MyProject.debug (production).xcconfig"
#include "Pods/Target Support Files/Pods-MyProjectTests/Pods-MyProjectTests.debug (production).xcconfig"

#include "Pods/Target Support Files/Pods-MyProject/Pods-MyProject.release (production).xcconfig"
#include "Pods/Target Support Files/Pods-MyProjectTests/Pods-MyProjectTests.release (production).xcconfig"

This produced the error you mentioned, when I added Firebase pods into my Podfile.

So to make this compile again I had to:

  1. remove all above inclusion,
  2. make them explicitly set in the Project -> Info -> Configuration, as follows:

Solution

Quick tip:

If you don't want manually setting up corresponding target configurations (those with red icon), mark them as None and run pod install. This will automatically change it for you. Quick tip