[cfe-dev] Fail to analyze an .m File

Alberto Lagos via cfe-dev cfe-dev at lists.llvm.org
Thu Oct 3 11:48:18 PDT 2019


Hi,

I'm bulding a libTooling utility to inspect some aspects (Preprocessor
directives mostly) of the iOS source file (Objective-C for now). But when i
run:

./tool IndexingViewController.m -- -fmodules -std=gnu99 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.4.sdk


The following errors appear:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.4.sdk/usr/include/module.modulemap:118:11:
error: header 'stdarg.h' not found
   header "stdarg.h" // note: supplied by the compiler
          ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.4.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:10:
note:
      submodule of top-level module 'Darwin' implicitly imported here
#include <sys/types.h>
         ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.4.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:17:10:
fatal error:
      'stdarg.h' file not found
#include <stdarg.h>
         ^~~~~~~~~~
While building module 'UIKit' imported from
~/Desktop/tool/IndexingViewController.m:1:
While building module 'Foundation' imported from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
In file included from <module-includes>:1:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.4.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
~/Desktop/tool/IndexingViewController.m:1:
In file included from <module-includes>:1:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:9:
fatal error: could
      not build module 'Foundation'
#import <Foundation/Foundation.h>
 ~~~~~~~^
~/Desktop/tool/IndexingViewController.m:1:9: fatal error: could not build
module 'UIKit'
@import UIKit;
 ~~~~~~~^~~~~
5 errors generated

Error while processing ~/Desktop/tool/IndexingViewController.m.

It seems that is not finding the includes for iOS witch is weird since is
all there. Probably is using some other includes?. If i run the tool
without modules enable (-fmodules) i have only one error:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h
stdarg.h was not found.
In file included from~/Desktop/tool/IndexingViewController.m:2:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.4.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:17:10:
fatal error: 'stdarg.h'
      file not found
#include <stdarg.h>
         ^~~~~~~~~~
stdbool.h was not found.

What i'm doing wrong?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20191003/8cc6fd37/attachment.html>


More information about the cfe-dev mailing list