Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command CompileSwiftSources failed with a nonzero exit code Xcode 10 [duplicate]

Tags:

swift

xcode10

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?

like image 446
ALI MOJARRAD GHAHFARROKHI Avatar asked Sep 16 '18 04:09

ALI MOJARRAD GHAHFARROKHI


People also ask

What is nonzero exit code?

A non-zero exit status indicates failure. This seemingly counter-intuitive scheme is used so there is one well-defined way to indicate success and a variety of ways to indicate various failure modes. When a command terminates on a fatal signal whose number is N , Bash uses the value 128+ N as the exit status.


1 Answers

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.

like image 80
Yaroslav Avatar answered Oct 20 '22 02:10

Yaroslav