fatal error: could not build module 'Darwin'
hi,my project add a new lib,so change setting Apple LLVM 7.0 -Language - Modules----> Enable Modules(C and Objective-C) to yes, but change to no my project build failed.
run infer --pmd-xml -- xcodebuild -workspace Vodka.xcworkspace -scheme Vodka -configuration Debug -sdk phones
The following build commands failed:
CompileC /Users/speedxserver/Library/Developer/Xcode/DerivedData/Vodka-fitiszjztfkbvlekgavzarcpcjwq/Build/Intermediates/Vodka.build/Debug-iphoneos/Vodka.build/Objects-normal/armv7/CyclingMapStatsView.o Vodka/MVC/View/Cycling/CyclingMapStatsView.mm normal armv7 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Traceback (most recent call last):
File "/usr/local/bin/infer", line 178, in
log:
While building module 'UIKit' imported from /Users/speedxserver/.jenkins/jobs/StaticAnalysis_For_iOS/workspace/Vodka/Public/beastbikes.pch:2:
While building module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKitDefines.h:8:
In file included from
include <type_traits>
2 errors generated.
While building module 'UIKit' imported from /Users/speedxserver/.jenkins/jobs/StaticAnalysis_For_iOS/workspace/Vodka/Public/beastbikes.pch:2:
In file included from <module-includes>:2:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKitDefines.h:8:9: fatal error: could not build module 'Darwin'
#import <Availability.h>
~~~~~~~^
While building module 'UIKit' imported from /Users/speedxserver/.jenkins/jobs/StaticAnalysis_For_iOS/workspace/Vodka/Public/beastbikes.pch:2:
While building module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:8:
While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from <module-includes>:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:11:10: fatal error: could not build module 'Darwin'
#include <sys/types.h>
~~~~~~~~^
1 error generated.
While building module 'UIKit' imported from /Users/speedxserver/.jenkins/jobs/StaticAnalysis_For_iOS/workspace/Vodka/Public/beastbikes.pch:2:
While building module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:8:
In file included from <module-includes>:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: fatal error: could not build module 'CoreFoundation'
#include <CoreFoundation/CoreFoundation.h>
~~~~~~~~^
While building module 'UIKit' imported from /Users/speedxserver/.jenkins/jobs/StaticAnalysis_For_iOS/workspace/Vodka/Public/beastbikes.pch:2:
While building module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:8:
While building module 'ObjectiveC' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:6:
In file included from <module-includes>:2:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/usr/include/objc/./message.h:29:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/usr/include/objc/objc.h:31:10: fatal error: could not build module 'Darwin'
#include <sys/types.h> // for __DARWIN_NULL
~~~~~~~~^
1 error generated.
While building module 'UIKit' imported from /Users/speedxserver/.jenkins/jobs/StaticAnalysis_For_iOS/workspace/Vodka/Public/beastbikes.pch:2:
While building module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:8:
While building module 'Dispatch' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSDateIntervalFormatter.h:6:
In file included from <module-includes>:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/usr/include/dispatch/dispatch.h:25:10: fatal error: could not build module 'Darwin'
#include <Availability.h>
~~~~~~~~^
While building module 'UIKit' imported from /Users/speedxserver/.jenkins/jobs/StaticAnalysis_For_iOS/workspace/Vodka/Public/beastbikes.pch:2:
While building module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:8:
While building module 'Dispatch' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSDateIntervalFormatter.h:6:
While building module 'os' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/usr/include/dispatch/dispatch.h:48:
In file included from <module-includes>:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/usr/include/os/base.h:24:10: fatal error: could not build module 'Darwin'
#include <sys/cdefs.h>
~~~~~~~~^
1 error generated.
2 errors generated.
if run: xcodebuild -workspace Vodka.xcworkspace -scheme Vodka -configuration Debug -sdk phones
Build SUCCEEDED
This should be fixed in the latest version of infer (see #335). Please re-open if switching to latest infer doesn't solve your issue. You'll have to compile Infer with clang from source to try; we'll also be making a new release shortly.