错误:无法在 Xcode Build 中生成进程(参数列表太长)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/53226087/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
error: unable to spawn process (Argument list too long) in Xcode Build
提问by Falguni
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 "
“错误:无法生成进程(参数列表太长)
** 存档失败 **
以下构建命令失败:CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (1 failure)
退出代码 =65"
I went through this link: Xcode export localization throws error "Argument list too long"
我浏览了这个链接: Xcode 导出本地化抛出错误“参数列表太长”
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?
本文提供了一个很好的临时解决方案,说明了减少路径层次结构的问题。但这似乎不是一个合适的方法。谁能为我提供解决此问题的不同方法?
回答by Vlad Krupenko
A few days ago I faced a similar challenge. I want to provide details and share my research with SO community.
几天前,我遇到了类似的挑战。我想提供详细信息并与 SO 社区分享我的研究。
First of all I found this thread and I followed the link in the asked question.
And yes, thats right, the answer marked in the link is correct, but the solutions to this problem did not suit me.
首先,我找到了这个线程,然后我按照所问问题中的链接进行了操作。
是的,没错,链接中标记的答案是正确的,但是此问题的解决方案不适合我。
Problem
问题
In my case, I had this problem when I changed the folder hierarchy in my project to be more convenient and suitable for me.
@oOEric option did not suit me, because according to the rules, the hierarchy of groups in Xcode should coincide with the hierarchy of folders in the system.
But I've already had about 1680 swift files to compiling.
就我而言,当我将项目中的文件夹层次结构更改为更方便和更适合我时,我遇到了这个问题。
@oOEric 选项不适合我,因为根据规则,Xcode 中组的层次结构应与系统中的文件夹层次结构一致。
但是我已经有大约 1680 个 swift 文件要编译。
The problem was that I had too long path to the compiled files and their number was too large.
问题是我编译文件的路径太长,而且它们的数量太大。
Research
研究
Then I start research and found swift jira with the same bug. Here some links:
然后我开始研究并发现 swift jira 具有相同的错误。这里有一些链接:
But here I didn't find some solutions for me.
但在这里我没有找到适合我的解决方案。
Most of all I was pleased with this response of the swift developers.
最重要的是,我对 swift 开发人员的这种回应感到满意。
Again, this is an Xcode-side issue, not a Swift-side issue. Commenting here won't make the Xcode engineers work any faster! (We're not all the same people at Apple.)
同样,这是 Xcode 方面的问题,而不是 Swift 方面的问题。在这里发表评论不会让 Xcode 工程师工作得更快!(我们在 Apple 并不都是一样的人。)
Okey, after this answer, I was finally convinced that if it is an Xcode bug, then the solution should be sought in Xcode.
Okey,经过这个回答,我终于确信,如果它是 Xcode 的错误,那么应该在 Xcode 中寻求解决方案。
Solutions
解决方案
- Temporary solution
- 临时解决方案
You need to move your project higher in the hierarchy of your system.
您需要在系统的层次结构中将项目移至更高的位置。
I choose this one, because I have really big project and the use of other solutions will require more than one day from me.
我选择这个,因为我有一个非常大的项目,使用其他解决方案需要我一天以上的时间。
In my case, I conducted an experiment and calculated that the length of the path to the project should be no more than 50 characters.
就我而言,我进行了实验,计算出项目路径的长度不应超过 50 个字符。
But this is a temporary solution. If your project grows further, you will have to shorten the path or use other solutions.
但这是一个临时解决方案。如果您的项目进一步发展,您将不得不缩短路径或使用其他解决方案。
- Cocoa Touch Framework target
- Cocoa Touch 框架目标
This solution is suitable for files that do not use dependencies.
此解决方案适用于不使用依赖项的文件。
First of all you need to add Cocoa Touch Framework as a target to you main project.
首先,您需要将 Cocoa Touch Framework 作为目标添加到您的主项目中。
This target should be added automatically to Embedded Binariesand Linked Framework and Libraries.
此目标应自动添加到嵌入式二进制文件和链接框架和库中。
After this you need to find some files without dependencies and change target membership to your "TestTarget".
在此之后,您需要找到一些没有依赖关系的文件并将目标成员资格更改为您的“TestTarget”。
Don't forgetclasses, properties, methods, enums, protocols from cocoa touch framework should have open or public access.
不要忘记cocoa touch 框架中的类、属性、方法、枚举、协议应该具有开放或公共访问权限。
And don't forget clean your DerivedData folder.
并且不要忘记清理您的 DerivedData 文件夹。
- Modular iOS
- 模块化iOS
This solution has a more integrated approach.
此解决方案具有更集成的方法。
If you want to use any dependencies in your Cocoa Touch Frameworks you should go to this guide and make more complex refactoring for your big project!
如果你想在你的 Cocoa Touch 框架中使用任何依赖,你应该去这个指南并为你的大项目进行更复杂的重构!
I think this is the best solution.
我认为这是最好的解决方案。
I hope this big answer will help someone!
我希望这个大答案会对某人有所帮助!
回答by blaszku
In my case, it was about custom configurations in .xcconfig files. My config files were including Pods configurations like:
就我而言,它是关于 .xcconfig 文件中的自定义配置。我的配置文件包括 Pods 配置,例如:
// 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.
当我将 Firebase pod 添加到我的 Podfile 中时,这产生了您提到的错误。
So to make this compile again I had to:
所以要再次编译,我必须:
- remove all above inclusion,
- make them explicitly set in the Project -> Info -> Configuration, as follows:
- 删除所有上述包含,
- 使它们在Project -> Info -> Configuration 中明确设置,如下所示:
回答by user3257307
I solved this by setting build system to Legacy build system
in file-> workspace setting -> select workspace setting
我通过将构建系统设置为Legacy build system
文件-> 工作区设置-> 选择工作区设置来解决此问题
回答by oOEric
I solved this by reducing the hierarchy of groups in Xcode.
我通过减少 Xcode 中组的层次结构解决了这个问题。
e.g. original files at project_name/project_name/About/Model/Text I removed the groups "Model", "Text" and moved files under project_name/project_name/About/
例如,project_name/project_name/About/Model/Text 中的原始文件我删除了“Model”、“Text”组并移动了 project_name/project_name/About/ 下的文件
回答by Григорий Бернгардт
I made simple script for temporary fix that problem. https://github.com/gregoryvit/flatter
我制作了简单的脚本来临时解决这个问题。https://github.com/gregoryvit/flatter
It simply move all swift files in Xcode project to root group.
它只是将 Xcode 项目中的所有 swift 文件移动到根组。
回答by Jayprakash Dubey
Error - unable to spawn process (Argument list too long)
错误 - 无法生成进程(参数列表太长)
There are many reason for this error. Some of these are mentioned below:
这个错误有很多原因。其中一些如下所述:
- Your project might have many swift files(say more than 2000)
- Most of the Swift source files may be deeply nested inside directories
- 你的项目可能有很多 swift 文件(比如 2000 多个)
- 大多数 Swift 源文件可能深深嵌套在目录中
- Many of these files have absolute paths with more than 150 characters(eg. /Macintosh HD?/?Users?/jayprakashnd?/?mySampleProject/Module1…)
- 其中许多文件的绝对路径超过 150 个字符(例如。/Macintosh HD?/?Users?/jayprakashnd?/?mySampleProject/Module1...)
Xcode swift complier takes the absolute paths of all source files while so compiling, the ARG_MX limit is reached and build fails.
Xcode swift 编译器在编译时采用所有源文件的绝对路径,达到 ARG_MX 限制并且构建失败。
This has been fixed in Xcode 11wherein a flag is used to set unlimited number of swift files.
这已在Xcode 11 中得到修复,其中一个标志用于设置无限数量的 swift 文件。
Solutions:
解决方案:
Switch to Xcode 11and add USE_SWIFT_RESPONSE_FILEto YESin build settings - User Defined Section
If you cannot switch to Xcode 11 then take a new checkout of your project in Macintosh HD? ? ?Users? directory with folder name as minimalas possible.
切换到Xcode 11并在build settings - User Defined Section中将USE_SWIFT_RESPONSE_FILE添加到YES
如果您无法切换到 Xcode 11,那么在 Macintosh HD 中重新检查您的项目?? ?用户?文件夹名称尽可能少的目录。
Solution 2 worked for me like a charm!
解决方案 2 对我很有用!
回答by Kirill Karmazin
If you faced this issue on your Flutter project while building in Release mode (or Archive) check out my this answer: https://stackoverflow.com/a/61446892/5502121Long story short:
如果您在以发布模式(或存档)构建时在 Flutter 项目中遇到此问题,请查看我的答案:https: //stackoverflow.com/a/61446892/5502121长话短说:
- set your build system to New Build Systemin File > Project Settings…
- remove
ios
andbuild_ios
folders - run
flutter create .
to init newios
module - run
pod install
- run
flutter pub get
- check your Xcode build config (it should be Releasemode and General iOS Device)
- 在“文件”>“项目设置”中将您的构建系统设置为“新建构建系统”...
- 删除
ios
和build_ios
文件夹 - 运行
flutter create .
以初始化新ios
模块 - 跑
pod install
- 跑
flutter pub get
- 检查您的 Xcode 构建配置(它应该是Release模式和General iOS Device)
and you're good to go
你可以走了
回答by atalayasa
It happened to me when I use Xcode 11 beta version using Live Preview. Then I solved it by restarting Xcode after that error has gone.
当我使用 Live Preview 使用 Xcode 11 beta 版本时,这发生在我身上。然后我通过在错误消失后重新启动 Xcode 来解决它。
回答by A. Trejo
I have fixed this issue, moving my folder of My Xcode project to the mac root and changing my name Folder to less characters.
我已经解决了这个问题,将我的 Xcode 项目文件夹移动到 mac 根目录并将我的名称文件夹更改为更少的字符。
Terminal: cd /
Change name folder to BX (example).
终端:cd /
将名称文件夹更改为 BX(示例)。
回答by Pedro Menezes
xcode11
xcode11
-build setting
- 构建设置
-user-defined
-用户自定义
-add setting: USE_SWIFT_RESPONSE_FILE
- 添加设置:USE_SWIFT_RESPONSE_FILE
-setValue: YES
-setValue: 是
Doing this you enable xcode to have more files than is allowed. But im not sure if this always solve the problem.
这样做可以使 xcode 拥有比允许更多的文件。但我不确定这是否总能解决问题。