Xcode 10 archiving fails - only on command line (xcodebuild)

Eventually I figured it out, it's something that looks really UNRELATED, and yet it was the only thing that fixed the described issue for me.

Go to your build settings and remove any recursive search paths you have there. That's it. (any search path that ends with ** is a recursive one).

Good luck!


A related case in which this error appears is by running:

xcodebuild -scheme sharetec build

In my case I just had to tune up a little more the parameters like this:

xcodebuild -workspace [WP_NAME].xcworkspace -scheme [A_TARGET] -sdk iphoneos clean build

So the error disappears.