Error: Unable to Spawn Process (Argument List Too Long) in Xcode Build

Error: unable to spawn process (Argument list too long) Xcode 10.1

Enable Legacy System for workspace setting
Sample Image

Xcode export localization throws error Argument list too long

I also asked this question on Apple developer forums, here is the link: https://forums.developer.apple.com/thread/86762

“Argument list too long” sounds like E2BIG, which you get when you try to run a child process with a huge argument list (I believe the current limit is 256 KiB). I suspect that Export for Localizations is running some sort of command line tool to do that work (probably the extractLocStrings tool, which you’ll find lurking within Xcode’s app bundle) and passing it full paths to each of the files in your project. Depending on how many files you have and how long those paths are, it’s easy to run into problems like this.

One of the ‘fun’ things about bugs like this is that they are dependent on where you place your project. Things might work if the project is at the top of your home directory but fail if it’s nested deep inside a subdirectory.
That also suggests a potential workaround, namely, to move your project further up in the directory hierarchy.

Finally, you should definitely file a bug about this. I believe we’ve seen this before (r. 30703294) but your report will help reinforce that this is causing problems for developers in the field. Please post your bug number, just for the record.

Several days ago before I read this answer, I managed to get the export working by deleting some folders via Xcode (remove references only). Initially I suspected that there's an invalid format within the folders that I deleted, but when I tried deleting other folders, the export process works just fine.

I also tried exporting strings using Xcode 9, and I didn't encounter the problem. So hopefully this bug is only for Xcode 8.3.3 and below.

XCode fails to create archive with 'unable to spawn process /usr/bin/make' error

Despite XCode provided only error: unable to spawn process '/usr/bin/make' (No such file or directory) message, the real reason was in the same target's External Build Tool Configuration Directory path value. It required different directories for debug and release builds

Failed to launch AssetCatalogSimulatorAgent via CoreSimulator spawn (Xcode)


Solved

  1. Delete xCode (you can use CleanMyMac)
  2. Delete the developer folder from Library/Developper
  3. Go here LINK download Xcode 13.2.1 (not 13.4.1)
  4. Install and "Voila" !

Solution found by DaveWoodX
https://twitter.com/davewoodx/status/1544820336629358601

Zombie: Archiving Failed using Integration Menu


UPDATE (Edit 3)

The issue has been fixed on Xcode 11, from beta 3:

  • Xcode uses response files by default to pass input files to the Swift compiler. To turn this behavior off, set USE_SWIFT_RESPONSE_FILE to NO.

  • You can use an unlimited number of Swift files in a target. (35879960)

Old answer

I've only seen this error arising when the total of files (notice all their respective absolute paths count) exceed the command line length limit (looks like it's imposed by the OS, currently 262144 bytes on my rMBP). It's a known issue.

To fix this (AFAIK), you have 2 options:

  • Fast (short term): Put your project on a shorter path on the server (like moving the project from /Users/mrjimoy_05_server/myprojects/mycoolproject/ to /p/mycoolproject)

  • Better (long term): While the first solution might work, for now, you'll probably reach the same point where you're now in the near future. So a better solution is to modularize your app (separate it into frameworks/projects). Since every module will get built separately, it'll be much harder to reach the limit and get this error again.

I hope it helps.

PD: Looks like the error thrown by the New Build System is:

unable to spawn process (File exists)

Edit 1

The error thrown by the New Build System on Xcode 10 now is:

unable to spawn process (Argument list too long)

Edit 2

The Swift team have solved this issue, but it also needs some work from the Xcode team, which hasn't been done yet on the latest released Xcode version (10.2)



Related Topics



Leave a reply



Submit