infer icon indicating copy to clipboard operation
infer copied to clipboard

Failed to build iOS project

Open markddaa opened this issue 11 years ago • 10 comments

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

markddaa avatar Jun 15 '15 06:06 markddaa

same error

Xuyuanp avatar Jun 15 '15 08:06 Xuyuanp

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

markddaa avatar Jun 15 '15 08:06 markddaa

Please try cleaning your builds first with a command like this: xcodebuild -workspace <your_workspace> -scheme <your_scheme> -configuration Debug -sdk iphonesimulator clean

martinoluca avatar Jun 15 '15 08:06 martinoluca

I clean every time before build

markddaa avatar Jun 15 '15 08:06 markddaa

The detailed error message should be few lines above the one you reported. Could you please paste it if possible?

martinoluca avatar Jun 15 '15 08:06 martinoluca

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           ^ In file included from /Users/markddaa/Temp/training_ios/Training/NATViewController.m:27: /Users/markddaa/Temp/training_ios/Training/NATViewController.h:30:77: error:        cannot find protocol declaration for 'CBPeripheralManagerDelegate'   ...NATViewController : UIViewController <CLLocationManagerDelegate, CBPerip...                                                                       ^ /Users/markddaa/Temp/training_ios/Training/NATViewController.m:62:31: error:        unknown type name 'CLLocationManager' @property (nonatomic, strong) CLLocationManager *locationManager;                               ^ /Users/markddaa/Temp/training_ios/Training/NATViewController.m:62:1: error:        property with 'retain (or strong)' attribute must be of object type @property (nonatomic, strong) CLLocationManager *locationManager; ^ /Users/markddaa/Temp/training_ios/Training/NATViewController.m:63:31: error:        unknown type name 'CLBeaconRegion' @property (nonatomic, strong) CLBeaconRegion *beaconRegion;                               ^ /Users/markddaa/Temp/training_ios/Training/NATViewController.m:63:1: error:        property with 'retain (or strong)' attribute must be of object type @property (nonatomic, strong) CLBeaconRegion *beaconRegion; ^ /Users/markddaa/Temp/training_ios/Training/NATViewController.m:64:31: error:        unknown type name 'CBPeripheralManager' @property (nonatomic, strong) CBPeripheralManager *peripheralManager;                               ^ /Users/markddaa/Temp/training_ios/Training/NATViewController.m:64:1: error:        property with 'retain (or strong)' attribute must be of object type @property (nonatomic, strong) CBPeripheralManager *peripheralManager; ^ /Users/markddaa/Temp/training_ios/Training/NATViewController.m:176:39: error:        expected a type

  • (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.

markddaa avatar Jun 15 '15 08:06 markddaa

looks like it caused by beacon functions somehow, I use CoreLocation and CoreBluetooth inside my project.

markddaa avatar Jun 15 '15 08:06 markddaa

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

martinoluca avatar Jun 15 '15 08:06 martinoluca

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 :86: In file included from /Users/liguang/Documents/infer/facebook-clang-plugins/clang/bin/../lib/clang/3.8.0/include/tgmath.h:29: /Users/liguang/Documents/infer/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.
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~

muzixiaowu avatar Jan 21 '16 08:01 muzixiaowu

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

martinoluca avatar Jan 21 '16 09:01 martinoluca