Failed to build iOS project
What I use: infer --incremental -- xcodebuild -workspace Training.xcworkspace -scheme 'Training' -configuration Debug -sdk iphonesimulator
What I got:
** BUILD FAILED **
The following build commands failed: CompileC /Users/markddaa/Library/Developer/Xcode/DerivedData/Training-fexrtaxksrhecgdraobzsohhrqly/Build/Intermediates/Training.build/Debug-iphonesimulator/Training.build/Objects-normal/i386/NATViewController.o Training/NATViewController.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure) None
=====UPDATED==== I clean every time before build like this:
xcodebuild -workspace Training.xcworkspace -scheme 'Training' -configuration Debug -sdk iphonesimulator clean
same error
I assume it's caused by some third part libraries? I use Cocoapods in most of my projects, some run ok some fail when using Infer, but all of them run build fine will xcodebuild tool directly in command line, which makes me thinking it might be a bug in Infer
Please try cleaning your builds first with a command like this:
xcodebuild -workspace <your_workspace> -scheme <your_scheme> -configuration Debug -sdk iphonesimulator clean
I clean every time before build
The detailed error message should be few lines above the one you reported. Could you please paste it if possible?
In file included from /Users/markddaa/Temp/training_ios/Training/NATViewController.m:27:
/Users/markddaa/Temp/training_ios/Training/NATViewController.h:27:1: error: use
of '@import' when modules are disabled
@import CoreLocation;
^
/Users/markddaa/Temp/training_ios/Training/NATViewController.h:28:1: error: use
of '@import' when modules are disabled
@import CoreBluetooth;
^
/Users/markddaa/Temp/training_ios/Training/NATViewController.h:30:50: error:
cannot find protocol declaration for 'CLLocationManagerDelegate'; did you
mean 'NSLayoutManagerDelegate'?
...NATViewController : UIViewController <CLLocationManagerDelegate, CBPerip...
^~~~~~~~~~~~~~~~~~~~~~~~~
NSLayoutManagerDelegate
In file included from /Users/markddaa/Temp/training_ios/Training/NATViewController.m:1:
In file included from /Users/markddaa/Temp/training_ios/Training/Training-Prefix.pch:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:130:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.3.sdk/System/Library/Frameworks/UIKit.framework/Headers/NSLayoutManager.h:277:11: note:
'NSLayoutManagerDelegate' declared here
@protocol NSLayoutManagerDelegate
- (NSString *)detailsStringForBeacon:(CLBeacon *)beacon ^ /Users/markddaa/Temp/training_ios/Training/NATViewController.m:439:26: error: expected a type
- (void)locationManager:(CLLocationManager )manager didChangeAuthorizat... ^ /Users/markddaa/Temp/training_ios/Training/NATViewController.m:439:84: error: expected a type ...)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status ^ /Users/markddaa/Temp/training_ios/Training/NATViewController.m:486:26: error: expected a type
- (void)locationManager:(CLLocationManager *)manager ^ /Users/markddaa/Temp/training_ios/Training/NATViewController.m:488:26: error: expected a type inRegion:(CLBeaconRegion *)region { ^ /Users/markddaa/Temp/training_ios/Training/NATViewController.m:522:26: error: expected a type
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLR... ^ /Users/markddaa/Temp/training_ios/Training/NATViewController.m:529:26: error: expected a type
- (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRe... ^ /Users/markddaa/Temp/training_ios/Training/NATViewController.m:534:26: error: expected a type
- (void)locationManager:(CLLocationManager )manager didDetermineState:(... ^ /Users/markddaa/Temp/training_ios/Training/NATViewController.m:534:73: error: expected a type ...)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)r... ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated.
looks like it caused by beacon functions somehow, I use CoreLocation and CoreBluetooth inside my project.
Thank you @markddaa for reporting the entire error message, the cause of your issue is this:
error: use of '@import' when modules are disabled
It is a known issue and there's a task open for that here https://github.com/facebook/infer/issues/2
what I use: infer -- xcodebuild -workspace ~/Downloads/workspace/iOSWorkspace/BaiduBoxApp.xcworkspace -scheme BaiduBoxApp -configuration Debug -sdk iphonesimulator
what I got:
In file included from /Users/liguang/Documents/infer/facebook-clang-plugins/clang/bin/../include/c++/v1/cstddef:43:
/Users/liguang/Documents/infer/facebook-clang-plugins/clang/bin/../include/c++/v1/stddef.h:46:15: fatal error:
cyclic dependency in module 'Darwin': Darwin -> std -> Darwin
#include_next <stddef.h>
^
1 error generated.
While building module 'Darwin' imported from /Users/liguang/Downloads/workspace/iOSWorkspace/BaiduBoxApp/BoxCore/BoxCore-Prefix.pch:5:
In file included from
2 errors generated.
In file included from <built-in>:363:
In file included from <command line>:21:
/Users/liguang/Downloads/workspace/iOSWorkspace/BaiduBoxApp/BoxCore/BoxCore-Prefix.pch:5:9: fatal error:
could not build module 'Darwin'
#import <Availability.h>
~~~~~~~^
While building module 'UIKit' imported from /Users/liguang/Downloads/workspace/iOSWorkspace/BaiduBoxApp/BoxCore/BoxCore-Prefix.pch:15:
In file included from <module-includes>:2:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.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/liguang/Downloads/workspace/iOSWorkspace/BaiduBoxApp/BoxCore/BoxCore-Prefix.pch:15:
While building module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAccelerometer.h:8:
While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from <module-includes>:2:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.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/liguang/Downloads/workspace/iOSWorkspace/BaiduBoxApp/BoxCore/BoxCore-Prefix.pch:15:
***
***
** BUILD FAILED **
The following build commands failed:
CompileC /Users/liguang/Library/Developer/Xcode/DerivedData/BaiduBoxApp-etvhlrqpeligjvfqjifuyfqdjgca/Build/Intermediates/BaiduBoxApp.build/Debug-iphonesimulator/BoxCore.build/Objects-normal/i386/BBAVoiceRecognitionViewController.o BoxCore/Classes/UI/View/BBAVoiceRecognitionViewController.mm normal i386 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
None
Anyone know what should I do to solve this problem?
thanks~
Hello @markddaa, This issue has already been discussed in https://github.com/facebook/infer/issues/232#issuecomment-169744110 please try adding that argument to your build command and see if it helps.
Thanks