Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Argument list too long: recursive header expansion failed at /Applications/iWork '09/Pages.app/.../Contents/Resources

When I am building my project it is showing the following error. This is the first time Im facing this error:

Argument list too long: recursive header expansion failed at /Applications/iWork '09/Pages.app/Contents/Resources/Templates/Modern Business Cards.template/Contents/Resources.

How can I solve this?

like image 696
Raviraja Avatar asked Jul 19 '10 05:07

Raviraja


2 Answers

This is an Xcode "problem", as the error is generated from having a recursive search in your header search path. I've solved this in the past by unchecking the "Recursive" flag on items in the Header search path and instead link to each directory directly. There might be other (better) ways to solve this problem but it appears to be somewhat a bug with Xcode not reporting the error correctly when it is hit with a path it can not fully resolve.

There is also some info here about this error:

Xcode 3.1 problem checking dependencies | Cocoabuilder

There someone wrote,

Since GCC doesn't natively support recursive search paths, Xcode simulates them by expanding such a path into a discrete -I or -F or -L flag for each directory under the parent directory, but this can rapidly expand to the point that it results in a command line too long to be issued.

The difference between Xcode 3.0 and 3.1 here is that Xcode 3.0 would silently stop expanding the recursive search path if it got too long and simply use whatever it had computed up to that point, which would result in semi-deterministic (and extremely difficult to diagnose) errors for certain types of projects. So now Xcode emits an error if it was unable to fully expand the recursive search path.

So you may need to remove that recursive search path, or modify it to expand to a smaller set of directories, or convert it to a smaller set of non-recursive search paths. Or, alternately, reorganize your source to have fewer directories the path can expand to.

Incidentally, having a smaller set of expansions could also lead to somewhat-faster compilation times, since it's fewer directories that the compiler has to search in when compiling each file. (I don't know the magnitude of impact this would have, though.)

like image 138
Alex Gray Avatar answered Oct 18 '22 19:10

Alex Gray


I experienced the same error today.

My problem was within Build Settings where I had this setting
USER_HEADER_SEARCH_PATHS = ../../**

Since I had moved the project around in the file system, the parent-parent-dir no longer pointed to the root of the project, but instead it pointed to the folder with all the projects I have ever made.

I solved it by changing it to point the root folder of the project, like this:
USER_HEADER_SEARCH_PATHS = ../**

like image 25
neoneye Avatar answered Oct 18 '22 19:10

neoneye