infer icon indicating copy to clipboard operation
infer copied to clipboard

fatal error: could not build module 'Darwin'

Open Hellengo opened this issue 10 years ago • 2 comments

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 main() File "/usr/local/bin/infer", line 142, in main capture_exitcode = imported_module.gen_instance(args, cmd).capture() File "/usr/local/Cellar/infer/0.8.0/libexec/infer/lib/python/inferlib/capture/xcodebuild.py", line 78, in capture utils.stdout(exc.output) File "/usr/local/Cellar/infer/0.8.0/libexec/infer/lib/python/inferlib/utils.py", line 298, in stdout print(encode(s, errors=errors)) File "/usr/local/Cellar/infer/0.8.0/libexec/infer/lib/python/inferlib/utils.py", line 294, in encode return u.encode(encoding=config.LOCALE, errors=errors) AttributeError: 'NoneType' object has no attribute 'encode' Build step 'Execute shell' marked build as failure

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 :86: In file included from /usr/local/Cellar/infer/0.8.0/libexec/facebook-clang-plugins/clang/bin/../lib/clang/3.8.0/include/tgmath.h:29: /usr/local/Cellar/infer/0.8.0/libexec/facebook-clang-plugins/clang/bin/../include/c++/v1/math.h:309:10: fatal error: could not build module 'std'

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.

Hellengo avatar Apr 15 '16 07:04 Hellengo

if run: xcodebuild -workspace Vodka.xcworkspace -scheme Vodka -configuration Debug -sdk phones

Build SUCCEEDED

Hellengo avatar Apr 15 '16 07:04 Hellengo

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.

jvillard avatar Apr 20 '16 15:04 jvillard