问题
A project that compiles fine in Xcode 11 beta 3, cannot compile in beta 4 with errors in the pods:
<unknown>:0: error: unknown argument: '-Wno-shorten-64-to-32'
Command CompileSwiftSources failed with a nonzero exit code
The pod in question is Down, a Markdown library in Swift.
This is very similar to this other SO question but with a different "unknown argument":
error: unknown argument: '-Wno-shorten-64-to-32'
Any suggestions?
回答1:
Commenting out this line in the Down.podspec file:
spec.compiler_flags = '-Wno-shorten-64-to-32'
worked for me, at least for now. No promises that there aren't any side effects though. I have a local version of the pod for various reasons, so this was fairly simple for me to do; your results may vary, but it will get you up and running again for the time being.
回答2:
For the benefit of anyone else coming across this discussion, take a look at this CocoaPods thread. It turns out that there's a problem with CocoaPods passing flags to Swift that are not acceptable, and the beta 4 compiler now rejects such flags while the previous one did not. In the case of Down, the -Wno-shorten-64-to-32
flag is OK for the Objective-C compiler, but not Swift. Down could fix this in the near term by taking out the
spec.compiler_flags = '-Wno-shorten-64-to-32'
line, as Mike Glass has suggested here, but in the longer run CocoaPods will have to permit separating compiler flags between different compilers followed by a corresponding Down update if required to match whatever new podspec syntax the CocoaPods fix requires.
来源:https://stackoverflow.com/questions/57089656/xcode-11-beta-4-build-error-command-compileswiftsources-failed-with-a-nonzero