GithubHelp home page GithubHelp logo

Failed to build iOS project about infer HOT 10 CLOSED

facebook avatar facebook commented on April 27, 2024
Failed to build iOS project

from infer.

Comments (10)

Xuyuanp avatar Xuyuanp commented on April 27, 2024 1

same error

from infer.

markddaa avatar markddaa commented on April 27, 2024 1

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

from infer.

martinoluca avatar martinoluca commented on April 27, 2024

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

from infer.

markddaa avatar markddaa commented on April 27, 2024

I clean every time before build

from infer.

martinoluca avatar martinoluca commented on April 27, 2024

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

from infer.

markddaa avatar markddaa commented on April 27, 2024

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.

from infer.

markddaa avatar markddaa commented on April 27, 2024

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

from infer.

martinoluca avatar martinoluca commented on April 27, 2024

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 #2

from infer.

muzixiaowu avatar muzixiaowu commented on April 27, 2024

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~

from infer.

martinoluca avatar martinoluca commented on April 27, 2024

Hello @markddaa,
This issue has already been discussed in #232 (comment) please try adding that argument to your build command and see if it helps.

Thanks

from infer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.