Command CompileSwiftSources failed with a nonzero exit code Xcode 10 [duplicate]
I read some same issue but their solutions did not work for me. My project works in Xcode 9.4, but when I come to Xcode 10 and recreate my project, I get this Error. My project must add /usr/include/libxml2 , and if I add this, I get a different Error redefinition of madule libxml2
. The log is:
Add "-Xcc -I$(SDKROOT)/usr/include/libxml2" to OTHER_SWIFT_FLAGS in Xcode project.
If I add "-Xcc -I$(SDKROOT)/usr/include/libxml2", there is the following error:
:0: error: unknown argument: '-Xcc -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk/usr/include/libxml2' Command CompileSwiftSources failed with a nonzero exit code
What can I do?
This is a known issue as stated in Swift 4.2 Release Notes for Xcode 10 Release Notes.
Workaround: Disable batch mode by adding a user-defined build setting named SWIFT_ENABLE_BATCH_MODE and set it to NO.
Go to your target's build settings and add this user-defined setting. Worked for me.