[swift-build-dev] Swift Compilation - Reaching ARG_MAX limit causing Xcode build failure

bhargav gurlanka bhargav.grlnk at gmail.com
Wed Aug 16 05:17:47 CDT 2017

We have moderately complex Swift project with around 2,000 Swift files in a
single module.

Most of the Swift source files are deeply nested inside directories and 90%
of these files have absolute paths with more than 150 characters (assuming
project is in "/Volumes/Macintosh HD2/Project" folder)

Because Swift compiler (Xcode 8.3.2) takes the absolute paths of all source
files while compiling, the ARG_MAX limit is reached and build fails with:

Build operation failed without specifying any errors. Individual build
tasks may have failed for unknown reasons.

One possible cause is if there are too many (possibly zombie) processes; in
this case, rebooting may fix the problem.

Some individual build task failures (up to 12) may be listed below.

Have anybody experienced this issue before?

We temporarily fixed this issue by renaming longer folder names to shorter

I'm assuming that breaking this monolithic module into smaller ones might
fix the issue, but are there any other better solutions?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-build-dev/attachments/20170816/e94febf0/attachment.html>

More information about the swift-build-dev mailing list